From 6085a0156a94f598c3760802999ab1a361b4b621 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Sat, 8 Jun 2024 10:55:58 +0200 Subject: [PATCH] Add patch for check quota plugin --- install_binaries.sh | 1 + squirrelmail_check_quota.patch | 458 +++++++++++++++++++++++++++++++++ 2 files changed, 459 insertions(+) create mode 100644 squirrelmail_check_quota.patch diff --git a/install_binaries.sh b/install_binaries.sh index 2c0e8aa..a08e402 100755 --- a/install_binaries.sh +++ b/install_binaries.sh @@ -79,6 +79,7 @@ if [ ! -e /var/www/mail/www/squirrelmail/plugins/check_quota/ ]; then rm check_quota-2.2-1.4.0.tar.gz cd $workingdir cp squirrelmail_plugin_hooks.php /var/www/mail/www/squirrelmail/config/plugin_hooks.php + patch -p1 -d /var/www/html/mail/squirrelmail/plugins/check_quota/ < squirrelmail_check_quota.patch fi # install snappymail diff --git a/squirrelmail_check_quota.patch b/squirrelmail_check_quota.patch new file mode 100644 index 0000000..c7d747d --- /dev/null +++ b/squirrelmail_check_quota.patch @@ -0,0 +1,458 @@ +diff -ruN check_quota_old/config.php check_quota/config.php +--- check_quota_old/config.php 1970-01-01 01:00:00.000000000 +0100 ++++ check_quota/config.php 2023-05-22 08:47:49.000000000 +0200 +@@ -0,0 +1,409 @@ ++ 'Mail', ++ '/dev/sda6' => 'Data', ++ ); ++ ++ ++/* ++ * You can use this list to exclude some filesystems in your quota output. ++ * This allows you to only show quota information for the filesystem that ++ * your mail accounts reside on, to avoid confusion. ++ * ++ * You don't need to add filesystems which do not have any ++ * quota support here. ++ * ++ * You will need to write the exact filesystem name and, if you want to ++ * hide that filesystem, you will need to set its value to 1. If you want ++ * to show that filesystem, you can remove its entry from this list, or ++ * you can set its value to 0. ++ * ++ * This setting is only used for UNIX quotas. ++ * ++ * If you use this setting, make sure to replace "/dev/hda8" and "/dev/sda1" ++ * below with the filesystems that are appropriate on your system. ++*/ ++ ++$settings['exclude_fs'] = array ( ++ '/dev/hda8' => 1, ++ '/dev/sda6' => 0, ++ ); ++ ++ ++/* ++ * Some IMAP servers use dynamic quotas, so the users may not be able to ++ * see their true quotas. In this situation you can override the max quota ++ * information returned by the plugin with these variables. For size-based ++ * quotas, change "imap_size_quota", for count-based quotas, change ++ * "imap_count_quota". ++ * ++ * Leave blank for server returned quota information to be displayed. ++ * ++ * This setting is only used for IMAP quotas. ++ * ++ * NOTE: Values must be entered in Kilobytes. ++*/ ++ ++$settings['imap_size_quota'] = ''; ++$settings['imap_count_quota'] = ''; ++ ++ ++/* ++ * As cPanel quotas work differently from UNIX or IMAP quotas, we have to ++ * use "du" to calculate these type of quotas. Using "du" can be very ++ * exhaustive for a slow or loaded server. So as a default, we calculate ++ * cPanel quotas only once for a logged in user. To refresh the quota ++ * information the user has to log out and log in again. This option ++ * overrides this behavior and refreshes cPanel quota information on every ++ * refresh of the folders list. ++ * ++ * CAUTION: enabling this may place unnecessarily high load on your server. ++ * ++ * cPanel quota information is always refreshed on the troubleshooting page, ++ * regardless of this option. ++ * ++ * This setting is only used for cPanel quotas. ++ * ++ * Default: Off ++ * 0: Off; calculate quota once at time of login ++ * 1: Always refresh cPanel information ++*/ ++ ++$settings['always_refresh_cpanel'] = 0; ++ ++ ++/******************** ++ * Troubleshooting * ++ ********************/ ++ ++/* ++ * Turn this on to see troubleshooting output from server for help ++ * debugging your Check Quota settings. This will add a link to ++ * the "Options" page with the name "Check Quota Troubleshooting". ++ * You should always turn this off when Check Quota is working as ++ * intended. ++ * ++ * Default: Off ++ * 0: Off / 1: On ++*/ ++ ++$settings['troubleshoot'] = 1; ++ +diff -ruN check_quota_old/functions.php check_quota/functions.php +--- check_quota_old/functions.php 2007-08-04 16:58:53.000000000 +0200 ++++ check_quota/functions.php 2023-05-22 08:14:04.000000000 +0200 +@@ -143,10 +143,11 @@ + */ + function check_quota_motd($args) + { ++ global $currentHookName; + if ( !sqgetGlobalVar('just_logged_in', $just_logged_in, SQ_SESSION) || empty($just_logged_in) ) + return FALSE; + +- if ( get_current_hook_name($args) != 'right_main_after_header' || !sqGetGlobalVar('check_quota_motd_displayed', $check_quota_motd_displayed, SQ_SESSION) || empty($check_quota_motd_displayed) ) ++ if ( $currentHookName !== 'right_main_after_header' || !sqGetGlobalVar('check_quota_motd_displayed', $check_quota_motd_displayed, SQ_SESSION) || empty($check_quota_motd_displayed) ) + { + global $check_quota; + +@@ -214,7 +215,7 @@ + * settings and checks the user's quota. + * + */ +- function CheckQuota() ++ function __construct() + { + $this->reset_debug(); + $this->load_settings(); +@@ -230,7 +231,6 @@ + global $settings; + + include_once(SM_PATH . 'plugins/check_quota/config.php'); +- + $this->settings = $settings; + unset ($settings); + } +diff -ruN check_quota_old/troubleshoot.php check_quota/troubleshoot.php +--- check_quota_old/troubleshoot.php 2007-08-06 11:16:29.000000000 +0200 ++++ check_quota/troubleshoot.php 2023-05-22 07:55:31.000000000 +0200 +@@ -42,7 +42,7 @@ + if ( empty($check_quota->settings['troubleshoot']) ) + { + unset($check_quota); +- exit(); ++// exit(); + } + + $cq_to = '';