enhance master-cronjob parameter usage, you can now use --force-[cronname] to force any cronjob you like; now show mailbox sizes of emial accounts in the customers email overview, fixes #1007
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -66,6 +66,7 @@ elseif($page == 'emails')
|
|||||||
$emails[$row['domain']] = array();
|
$emails[$row['domain']] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$row['mboxsize'] = size_readable($row['mboxsize']);
|
||||||
$emails[$row['domain']][$row['email_full']] = $row;
|
$emails[$row['domain']][$row['email_full']] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ CREATE TABLE `mail_users` (
|
|||||||
`quota` bigint(13) NOT NULL default '0',
|
`quota` bigint(13) NOT NULL default '0',
|
||||||
`pop3` tinyint(1) NOT NULL default '1',
|
`pop3` tinyint(1) NOT NULL default '1',
|
||||||
`imap` tinyint(1) NOT NULL default '1',
|
`imap` tinyint(1) NOT NULL default '1',
|
||||||
|
`mboxsize` bigint(30) NOT NULL default '0',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `email` (`email`)
|
UNIQUE KEY `email` (`email`)
|
||||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||||
@@ -542,7 +543,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
|
|||||||
('panel', 'phpconfigs_hidestdsubdomain', '0'),
|
('panel', 'phpconfigs_hidestdsubdomain', '0'),
|
||||||
('panel', 'allow_theme_change_admin', '1'),
|
('panel', 'allow_theme_change_admin', '1'),
|
||||||
('panel', 'allow_theme_change_customer', '1'),
|
('panel', 'allow_theme_change_customer', '1'),
|
||||||
('panel', 'version', '0.9.29.1-dev1');
|
('panel', 'version', '0.9.29.1-dev2');
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `panel_tasks`;
|
DROP TABLE IF EXISTS `panel_tasks`;
|
||||||
@@ -832,7 +833,8 @@ INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `interval`, `isactive`,
|
|||||||
(6, 'froxlor/ticket', 'cron_used_tickets_reset.php', '1 DAY', '1', 'cron_ticketsreset'),
|
(6, 'froxlor/ticket', 'cron_used_tickets_reset.php', '1 DAY', '1', 'cron_ticketsreset'),
|
||||||
(7, 'froxlor/ticket', 'cron_ticketarchive.php', '1 MONTH', '1', 'cron_ticketarchive'),
|
(7, 'froxlor/ticket', 'cron_ticketarchive.php', '1 MONTH', '1', 'cron_ticketarchive'),
|
||||||
(8, 'froxlor/reports', 'cron_usage_report.php', '1 DAY', '1', 'cron_usage_report'),
|
(8, 'froxlor/reports', 'cron_usage_report.php', '1 DAY', '1', 'cron_usage_report'),
|
||||||
(9, 'froxlor/backup', 'cron_backup.php', '1 DAY', '1', 'cron_backup');
|
(9, 'froxlor/backup', 'cron_backup.php', '1 DAY', '1', 'cron_backup'),
|
||||||
|
(10, 'froxlor/core', 'cron_mailboxsize.php', '6 HOUR', '1', 'cron_mailboxsize');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2207,3 +2207,15 @@ if (isFroxlorVersion('0.9.29')) {
|
|||||||
|
|
||||||
updateToVersion('0.9.29.1-dev1');
|
updateToVersion('0.9.29.1-dev1');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isFroxlorVersion('0.9.29.1-dev1')) {
|
||||||
|
showUpdateStep("Updating from 0.9.29.1-dev1 to 0.9.29.1-dev2", true);
|
||||||
|
lastStepStatus(0);
|
||||||
|
|
||||||
|
showUpdateStep("Updating table layouts and contents");
|
||||||
|
$db->query("ALTER TABLE `".TABLE_MAIL_USERS."` ADD `mboxsize` bigint(30) NOT NULL default '0' AFTER `imap`;");
|
||||||
|
$db->query("INSERT INTO `cronjobs_run` SET `module` = 'froxlor/core', `cronfile` = 'cron_mailboxsize.php', `interval` = '6 HOUR', `isactive` = '1', `desc_lng_key` = 'cron_mailboxsize';");
|
||||||
|
lastStepStatus(0);
|
||||||
|
|
||||||
|
updateToVersion('0.9.29.1-dev2');
|
||||||
|
}
|
||||||
|
|||||||
@@ -74,6 +74,6 @@ define('PACKAGE_LOCKED', 1);
|
|||||||
define('PACKAGE_ENABLED', 2);
|
define('PACKAGE_ENABLED', 2);
|
||||||
|
|
||||||
// VERSION INFO
|
// VERSION INFO
|
||||||
$version = '0.9.29.1-dev1';
|
$version = '0.9.29.1-dev2';
|
||||||
$dbversion = '2';
|
$dbversion = '2';
|
||||||
$branding = '';
|
$branding = '';
|
||||||
|
|||||||
@@ -1960,3 +1960,6 @@ $lng['serversettings']['customerssl_directory']['title'] = 'Webserver customer-s
|
|||||||
$lng['serversettings']['customerssl_directory']['description'] = 'Where should customer-specified ssl-certificates be created?<br /><br /><div style="color:red">NOTE: This folder\'s content gets deleted regulary so avoid storing data in there manually.</div>';
|
$lng['serversettings']['customerssl_directory']['description'] = 'Where should customer-specified ssl-certificates be created?<br /><br /><div style="color:red">NOTE: This folder\'s content gets deleted regulary so avoid storing data in there manually.</div>';
|
||||||
$lng['admin']['note'] = 'Please note';
|
$lng['admin']['note'] = 'Please note';
|
||||||
$lng['admin']['phpfpm.ininote'] = 'Not all values you may want to define can be used in the php-fpm pool configuration';
|
$lng['admin']['phpfpm.ininote'] = 'Not all values you may want to define can be used in the php-fpm pool configuration';
|
||||||
|
|
||||||
|
// Added in Froxlor 0.9.29.1-dev
|
||||||
|
$lng['crondesc']['cron_mailboxsize'] = 'Calculating of mailbox-sizes';
|
||||||
|
|||||||
@@ -1681,3 +1681,6 @@ $lng['serversettings']['customerssl_directory']['title'] = 'Webserver-Kunden-SSL
|
|||||||
$lng['serversettings']['customerssl_directory']['description'] = 'Wo sollen kundenspezifizierte SSL-Zertifikate erstellt werden?<br /><br /><div style="color:red">ACHTUNG: Der Inhalt dieses Ordners wird regelmäßig geleert, daher sollten dort keinerlei Daten manuell abgelegt werden.</div>';
|
$lng['serversettings']['customerssl_directory']['description'] = 'Wo sollen kundenspezifizierte SSL-Zertifikate erstellt werden?<br /><br /><div style="color:red">ACHTUNG: Der Inhalt dieses Ordners wird regelmäßig geleert, daher sollten dort keinerlei Daten manuell abgelegt werden.</div>';
|
||||||
$lng['admin']['note'] = 'Bitte beachten';
|
$lng['admin']['note'] = 'Bitte beachten';
|
||||||
$lng['admin']['phpfpm.ininote'] = 'Nicht alle gewünschten Werte können in der php-fpm pool Konfiguration verwendet werden';
|
$lng['admin']['phpfpm.ininote'] = 'Nicht alle gewünschten Werte können in der php-fpm pool Konfiguration verwendet werden';
|
||||||
|
|
||||||
|
// Added in Froxlor 0.9.29.1-dev
|
||||||
|
$lng['crondesc']['cron_mailboxsize'] = 'Berechnung der Mailbox-Größen';
|
||||||
|
|||||||
@@ -19,23 +19,41 @@ include_once(dirname(__FILE__) . '/../lib/cron_init.php');
|
|||||||
|
|
||||||
$jobs_to_run = includeCronjobs($debugHandler, $pathtophpfiles);
|
$jobs_to_run = includeCronjobs($debugHandler, $pathtophpfiles);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check for --help
|
||||||
|
*/
|
||||||
|
if (isset($argv[1]) && strtolower($argv[1]) == '--help') {
|
||||||
|
echo "\n*** Froxlor Master Cronjob ***\n\n";
|
||||||
|
echo "Below are possible parameters for this file\n\n";
|
||||||
|
echo "--force\t\t\tforces re-generating of config-files (webserver, etc.)\n";
|
||||||
|
echo "--force-[cronname]\tforces the given cron to run, e.g. --force-backup, --force-traffic\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check for --force to include cron_tasks
|
* check for --force to include cron_tasks
|
||||||
* even if it's not its turn
|
* even if it's not its turn
|
||||||
*/
|
*/
|
||||||
if(isset($argv[1]) && strtolower($argv[1]) == '--force')
|
for ($x = 1; $x < count($argv); $x++) {
|
||||||
{
|
if (isset($argv[$x]) && strtolower($argv[$x]) == '--force') {
|
||||||
$crontasks = makeCorrectFile($pathtophpfiles.'/scripts/jobs/cron_tasks.php');
|
$crontasks = makeCorrectFile($pathtophpfiles.'/scripts/jobs/cron_tasks.php');
|
||||||
// really force re-generating of config-files by
|
// really force re-generating of config-files by
|
||||||
// inserting task 1
|
// inserting task 1
|
||||||
inserttask('1');
|
inserttask('1');
|
||||||
if (!in_array($crontasks, $jobs_to_run)) {
|
if (!in_array($crontasks, $jobs_to_run)) {
|
||||||
array_unshift($jobs_to_run, $crontasks);
|
array_unshift($jobs_to_run, $crontasks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (isset($argv[$x]) && substr(strtolower($argv[$x]), 0, 8) == '--force-') {
|
||||||
|
$crontasks = makeCorrectFile($pathtophpfiles.'/scripts/jobs/cron_'.substr(strtolower($argv[$x]), 8).'.php');
|
||||||
|
if (file_exists($crontasks)) {
|
||||||
|
if (!in_array($crontasks, $jobs_to_run)) {
|
||||||
|
array_unshift($jobs_to_run, $crontasks);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($jobs_to_run as $cron)
|
foreach ($jobs_to_run as $cron) {
|
||||||
{
|
|
||||||
require_once($cron);
|
require_once($cron);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,5 +71,3 @@ checkLastGuid();
|
|||||||
* shutdown cron
|
* shutdown cron
|
||||||
*/
|
*/
|
||||||
include_once($pathtophpfiles . '/lib/cron_shutdown.php');
|
include_once($pathtophpfiles . '/lib/cron_shutdown.php');
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
24
scripts/jobs/cron_mailboxsize.php
Normal file
24
scripts/jobs/cron_mailboxsize.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
fwrite($debugHandler, "calculating mailspace usage\n");
|
||||||
|
|
||||||
|
$maildirs = $db->query("SELECT `id`, CONCAT(`homedir`, `maildir`) AS `maildirpath` FROM `".TABLE_MAIL_USERS."` ORDER BY `id`");
|
||||||
|
|
||||||
|
while ($maildir = $db->fetch_array($maildirs)) {
|
||||||
|
|
||||||
|
$_maildir = makeCorrectDir($maildir['maildirpath']);
|
||||||
|
|
||||||
|
if (file_exists($_maildir)
|
||||||
|
&& is_dir($_maildir)
|
||||||
|
) {
|
||||||
|
$back = safe_exec('du -sb ' . escapeshellarg($_maildir) . '');
|
||||||
|
foreach ($back as $backrow) {
|
||||||
|
$emailusage = explode(' ', $backrow);
|
||||||
|
}
|
||||||
|
$emailusage = floatval($emailusage['0']);
|
||||||
|
unset($back);
|
||||||
|
$db->query("UPDATE `".TABLE_MAIL_USERS."` SET `mboxsize` = '".(int)$emailusage."' WHERE `id` ='".(int)$maildir['id']."'");
|
||||||
|
} else {
|
||||||
|
fwrite($debugHandler, 'maildir ' . $_maildir . ' does not exist' . "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{$row['email_full']}</td>
|
<td>{$row['email_full']}</td>
|
||||||
<td><if $row['destination'] == ''> <else>{$row['destination']}</if></td>
|
<td><if $row['destination'] == ''> <else>{$row['destination']}</if></td>
|
||||||
<td><if $row['popaccountid'] != 0>{$lng['panel']['yes']}</if><if $row['popaccountid'] == 0>{$lng['panel']['no']}</if></td>
|
<td><if $row['popaccountid'] != 0>{$lng['panel']['yes']} ({$row['mboxsize']})</if><if $row['popaccountid'] == 0>{$lng['panel']['no']}</if></td>
|
||||||
<if $settings['catchall']['catchall_enabled'] == '1'><td><if $row['iscatchall'] != 0>{$lng['panel']['yes']}</if><if $row['iscatchall'] == 0>{$lng['panel']['no']}</if></td></if>
|
<if $settings['catchall']['catchall_enabled'] == '1'><td><if $row['iscatchall'] != 0>{$lng['panel']['yes']}</if><if $row['iscatchall'] == 0>{$lng['panel']['no']}</if></td></if>
|
||||||
<if $settings['system']['mail_quota_enabled'] == '1'><td><if $row['quota'] == 0>{$lng['emails']['noquota']}<else>{$row['quota']} MB</if></if></td>
|
<if $settings['system']['mail_quota_enabled'] == '1'><td><if $row['quota'] == 0>{$lng['emails']['noquota']}<else>{$row['quota']} MB</if></if></td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
Reference in New Issue
Block a user