Просмотр исходного кода

Add IMAP_SYSTEM variable checks

If dovecot is installed on the system, then add IMAP_SYSTEM variable during upgrade if necessary. 

When rebuilding mail domains, ensure that dovecot is installed prior to setting permissions on the IMAP/POP Authentication Password file to prevent an error message in the console.
Kristan Kenney 7 лет назад
Родитель
Сommit
1f780394ac
4 измененных файлов с 26 добавлено и 12 удалено
  1. 3 1
      func/rebuild.sh
  2. 8 0
      install/upgrade/0.9.8-28.sh
  3. 14 10
      web/templates/admin/add_web.html
  4. 1 1
      web/templates/admin/panel.html

+ 3 - 1
func/rebuild.sh

@@ -525,7 +525,9 @@ rebuild_mail_domain_conf() {
         chmod 771 /etc/$MAIL_SYSTEM/domains/$domain_idn
         chmod 770 $HOMEDIR/$user/mail/$domain_idn
         chown -R $MAIL_USER:mail $HOMEDIR/$user/conf/mail/$domain
-        chown -R dovecot:mail $HOMEDIR/$user/conf/mail/$domain/passwd
+        if [ "$IMAP_SYSTEM" = "dovecot" ]; then
+            chown -R dovecot:mail $HOMEDIR/$user/conf/mail/$domain/passwd
+        fi
         chown $user:mail $HOMEDIR/$user/mail/$domain_idn
     fi
 

+ 8 - 0
install/upgrade/0.9.8-28.sh

@@ -192,6 +192,14 @@ if [ -f /etc/dovecot/dovecot.conf ]; then
     sleep 0.5
 fi
 
+# Add IMAP system variable to configuration if dovecot is installed
+if [ -z  "$IMAP_SYSTEM" ]; then 
+    if [ -f /usr/bin/dovecot ]; then
+        echo "(*) Adding IMAP_SYSTEM variable to hestia.conf..."
+        echo "IMAP_SYSTEM = 'dovecot'" >> $HESTIA/conf/hestia.conf
+    fi
+fi
+
 # Rebuild mailboxes
 for user in `ls /usr/local/hestia/data/users/`; do
     echo "(*) Rebuilding mail domain for $user..."

+ 14 - 10
web/templates/admin/add_web.html

@@ -71,16 +71,20 @@
                                 </select>
                             </td>
                         </tr>
-                        <?php if($panel[$user]['DNS_DOMAINS'] != "0") { ?><tr>
-                            <td class="vst-text input-label">
-                                <label><input type="checkbox" size="20" class="vst-checkbox" name="v_dns" <?php if (empty($v_dns)&&$panel[$user]['DNS_DOMAINS'] != "0") echo "checked=yes"; ?>> <?php print __('DNS Support');?></label>
-                            </td>
-                        </tr><?php } ?>
-                        <?php if($panel[$user]['MAIL_DOMAINS'] != "0") { ?><tr>
-                            <td class="vst-text input-label">
-                                <label><input type="checkbox" size="20" class="vst-checkbox" name="v_mail" <?php if (empty($v_mail)&&$panel[$user]['MAIL_DOMAINS'] != "0") echo "checked=yes"; ?>> <?php print __('Mail Support');?></label>
-                            </td>
-                        </tr><?php } ?>
+                        <?php if ((isset($_SESSION['DNS_SYSTEM'])) && (!empty($_SESSION['DNS_SYSTEM']))) {?>	
+                            <?php if($panel[$user]['DNS_DOMAINS'] != "0") { ?><tr>
+                                <td class="vst-text input-label">
+                                    <label><input type="checkbox" size="20" class="vst-checkbox" name="v_dns" <?php if (empty($v_dns)&&$panel[$user]['DNS_DOMAINS'] != "0") echo "checked=yes"; ?>> <?php print __('DNS Support');?></label>
+                                </td>
+                            </tr><?php } ?>
+                        <?php } ?>
+                        <?php if ((isset($_SESSION['IMAP_SYSTEM'])) && (!empty($_SESSION['IMAP_SYSTEM']))) {?>		
+                            <?php if($panel[$user]['MAIL_DOMAINS'] != "0") { ?><tr>
+                                <td class="vst-text input-label">
+                                    <label><input type="checkbox" size="20" class="vst-checkbox" name="v_mail" <?php if (empty($v_mail)&&$panel[$user]['MAIL_DOMAINS'] != "0") echo "checked=yes"; ?>> <?php print __('Mail Support');?></label>
+                                </td>
+                            </tr><?php } ?>
+                        <?php } ?>
                         <tr>
                             <td class="step-top vst-text" style="/*padding: 32px 0 20px 0;*/">
                                 <a href="javascript:elementHideShow('advtable');" class="vst-advanced"><?php print __('Advanced options');?>&nbsp;<i class="fas fa-arrow-circle-right"></i></a>

+ 1 - 1
web/templates/admin/panel.html

@@ -76,7 +76,7 @@
 			<?php } ?>
 		<?php } ?>
 
-		<?php if ((isset($_SESSION['MAIL_SYSTEM'])) && (!empty($_SESSION['MAIL_SYSTEM']))) {?>			
+		<?php if ((isset($_SESSION['IMAP_SYSTEM'])) && (!empty($_SESSION['IMAP_SYSTEM']))) {?>			
 			<?php if($panel[$user]['MAIL_DOMAINS'] != "0") { ?>
 						<div class="l-stat__col <?php if($TAB == 'MAIL' ) echo 'l-stat__col--active' ?>">
 							<a href="/list/mail/">