1

Topic: Don't change personalized values during update

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version: Debian
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? Yes
- Related log if you're reporting an issue:
====

Hello,
Would it be possible to do not reset changed values when upgrading iRedAdminPro ?

For example, in /libs/default_settings.py :
- MAILDIR_HASHED
- MAILDIR_PREPEND_DOMAIN
- MAILDIR_APPEND_TIMESTAMP
- AMAVISD_REMOVE_MAILLOG_IN_DAYS

Or a Y/N question during update to ask if we want to revert to default values these values ?

Thanks

Nicolas

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Don't change personalized values during update

i guess you missed top few lines in file "libs/default_settings.py":

# --------------------------------------
# WARNING
# --------------------------------------
# Please place all your custom settings in settings.py to override settings
# listed in this file, so that you can simply copy settings.py while upgrading
# iRedAdmin.
# --------------------------------------

So, if you want to change them, just copy them to iRedAdmin-Pro main config file "settings.py" -- it will be copied to new version during upgrading. Same to iRedAPD (developed by iRedMail team too).

3

Re: Don't change personalized values during update

ZhangHuangbin wrote:

i guess you missed top few lines in file "libs/default_settings.py":

# --------------------------------------
# WARNING
# --------------------------------------
# Please place all your custom settings in settings.py to override settings
# listed in this file, so that you can simply copy settings.py while upgrading
# iRedAdmin.
# --------------------------------------

So, if you want to change them, just copy them to iRedAdmin-Pro main config file "settings.py" -- it will be copied to new version during upgrading. Same to iRedAPD (developed by iRedMail team too).

Actually, I missed up these lines, sorry.

For example, I add these lines in settings.py :

NUM_TOP_SENDERS = 20
NUM_TOP_RECIPIENTS = 20

Restarted the server and I always have only 10 lines in the Dashboard.

What missed I ?

Nicolas

4

Re: Don't change personalized values during update

nicolasfo wrote:

NUM_TOP_SENDERS = 20
NUM_TOP_RECIPIENTS = 20

Oops, these 2 variables were not used in iRedAdmin-Pro at all. here's patch to fix it:

diff -r b3b0bc42a25f controllers/sql/basic.py
--- a/controllers/sql/basic.py    Thu Mar 30 23:39:52 2017 +0800
+++ b/controllers/sql/basic.py    Fri Mar 31 08:57:22 2017 +0800
@@ -225,13 +225,13 @@
                 reversedDomainNames=allReversedDomainNames,
                 logType='sent',
                 timeLength=86400,
-                number=10,
+                number=settings.NUM_TOP_SENDERS,
             )
             topRecipients = amavisdLogLib.get_top_users(
                 reversedDomainNames=allReversedDomainNames,
                 logType='received',
                 timeLength=86400,
-                number=10,
+                number=settings.NUM_TOP_RECIPIENTS,
             )
 
         return web.render(

Don't forget to restart Apache service (or uwsgi - if you're running Nginx) after patched.

5

Re: Don't change personalized values during update

Works perfectly, thanks.

But, there's a display bug. If I change this value, "Top 10 senders" and "Top 10 Recipients" is still displayed.
The change in  settings.py is not applied in the title of the chart. But it's not very important.

Thanks again

Nicolas

6

Re: Don't change personalized values during update

Fixed. Thanks for the feedback. smile