@@ -330,31 +330,28 @@ public function configure_amavis() {
330330
331331 $ config_dir = $ conf ['postfix ' ]['config_dir ' ];
332332
333- // Adding amavis-services to the master.cf file if the service does not already exists
334- $ add_amavis = !$ this ->get_postfix_service ('amavis ' ,'unix ' );
335- $ add_amavis_10025 = !$ this ->get_postfix_service ('127.0.0.1:10025 ' ,'inet ' );
336- $ add_amavis_10027 = !$ this ->get_postfix_service ('127.0.0.1:10027 ' ,'inet ' );
337-
338- if ($ add_amavis || $ add_amavis_10025 || $ add_amavis_10027 ) {
339- //* backup master.cf
340- if (is_file ($ config_dir .'/master.cf ' )) copy ($ config_dir .'/master.cf ' , $ config_dir .'/master.cf~ ' );
341- // adjust amavis-config
342- if ($ add_amavis ) {
343- $ content = rfsel ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/master_cf_amavis.master ' , 'tpl/master_cf_amavis.master ' );
344- af ($ config_dir .'/master.cf ' , $ content );
345- unset($ content );
346- }
347- if ($ add_amavis_10025 ) {
348- $ content = rfsel ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/master_cf_amavis10025.master ' , 'tpl/master_cf_amavis10025.master ' );
349- af ($ config_dir .'/master.cf ' , $ content );
350- unset($ content );
351- }
352- if ($ add_amavis_10027 ) {
353- $ content = rfsel ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/master_cf_amavis10027.master ' , 'tpl/master_cf_amavis10027.master ' );
354- af ($ config_dir .'/master.cf ' , $ content );
355- unset($ content );
356- }
357- }
333+ // Adding amavis-services to the master.cf file
334+
335+ // backup master.cf
336+ if (is_file ($ config_dir .'/master.cf ' )) copy ($ config_dir .'/master.cf ' , $ config_dir .'/master.cf~ ' );
337+
338+ // first remove the old service definitions
339+ $ this ->remove_postfix_service ('amavis ' ,'unix ' );
340+ $ this ->remove_postfix_service ('127.0.0.1:10025 ' ,'inet ' );
341+ $ this ->remove_postfix_service ('127.0.0.1:10027 ' ,'inet ' );
342+
343+ // then add them back
344+ $ content = rfsel ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/master_cf_amavis.master ' , 'tpl/master_cf_amavis.master ' );
345+ af ($ config_dir .'/master.cf ' , $ content );
346+ unset($ content );
347+
348+ $ content = rfsel ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/master_cf_amavis10025.master ' , 'tpl/master_cf_amavis10025.master ' );
349+ af ($ config_dir .'/master.cf ' , $ content );
350+ unset($ content );
351+
352+ $ content = rfsel ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/master_cf_amavis10027.master ' , 'tpl/master_cf_amavis10027.master ' );
353+ af ($ config_dir .'/master.cf ' , $ content );
354+ unset($ content );
358355
359356 removeLine ('/etc/sysconfig/freshclam ' , 'FRESHCLAM_DELAY=disabled-warn # REMOVE ME ' , 1 );
360357 replaceLine ('/etc/freshclam.conf ' , 'Example ' , '# Example ' , 1 );
0 commit comments