mirror of
https://github.com/Froxlor/Froxlor.git
synced 2024-09-21 10:27:29 +00:00
don't insert task if feature is disabled even though they are not run but might be irritating for the admin, thx to fuchsi
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
parent
93f320ed6d
commit
ab410cc91e
@ -315,23 +315,17 @@ if($page == 'customers'
|
|||||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted user '" . $result['loginname'] . "'");
|
$log->logAction(ADM_ACTION, LOG_INFO, "deleted user '" . $result['loginname'] . "'");
|
||||||
inserttask('1');
|
inserttask('1');
|
||||||
|
|
||||||
# Using nameserver, insert a task which rebuilds the server config
|
// Using nameserver, insert a task which rebuilds the server config
|
||||||
if ($settings['system']['bind_enable'])
|
inserttask('4');
|
||||||
{
|
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($_POST['delete_userfiles'])
|
if (isset($_POST['delete_userfiles'])
|
||||||
&& (int)$_POST['delete_userfiles'] == 1)
|
&& (int)$_POST['delete_userfiles'] == 1
|
||||||
{
|
) {
|
||||||
inserttask('6', $result['loginname']);
|
inserttask('6', $result['loginname']);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Using filesystem - quota, insert a task which cleans the filesystem - quota
|
// Using filesystem - quota, insert a task which cleans the filesystem - quota
|
||||||
if ($settings['system']['diskquota_enabled'])
|
inserttask('10');
|
||||||
{
|
|
||||||
inserttask('10');
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* move old tickets to archive
|
* move old tickets to archive
|
||||||
@ -769,13 +763,10 @@ if($page == 'customers'
|
|||||||
$log->logAction(ADM_ACTION, LOG_INFO, "added user '" . $loginname . "'");
|
$log->logAction(ADM_ACTION, LOG_INFO, "added user '" . $loginname . "'");
|
||||||
inserttask('2', $loginname, $guid, $guid, $store_defaultindex);
|
inserttask('2', $loginname, $guid, $guid, $store_defaultindex);
|
||||||
|
|
||||||
# Using filesystem - quota, insert a task which cleans the filesystem - quota
|
// Using filesystem - quota, insert a task which cleans the filesystem - quota
|
||||||
if ($settings['system']['diskquota_enabled'])
|
inserttask('10');
|
||||||
{
|
|
||||||
inserttask('10');
|
|
||||||
}
|
|
||||||
// Add htpasswd for the webalizer stats
|
|
||||||
|
|
||||||
|
// Add htpasswd for the webalizer stats
|
||||||
if(CRYPT_STD_DES == 1)
|
if(CRYPT_STD_DES == 1)
|
||||||
{
|
{
|
||||||
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
|
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
|
||||||
@ -1280,11 +1271,8 @@ if($page == 'customers'
|
|||||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `name`='" . $db->escape($name) . "', `firstname`='" . $db->escape($firstname) . "', `gender`='" . $db->escape($gender) . "', `company`='" . $db->escape($company) . "', `street`='" . $db->escape($street) . "', `zipcode`='" . $db->escape($zipcode) . "', `city`='" . $db->escape($city) . "', `phone`='" . $db->escape($phone) . "', `fax`='" . $db->escape($fax) . "', `email`='" . $db->escape($email) . "', `customernumber`='" . $db->escape($customernumber) . "', `def_language`='" . $db->escape($def_language) . "', `password` = '" . $password . "', `diskspace`='" . $db->escape($diskspace) . "', `traffic`='" . $db->escape($traffic) . "', `subdomains`='" . $db->escape($subdomains) . "', `emails`='" . $db->escape($emails) . "', `email_accounts` = '" . $db->escape($email_accounts) . "', `email_forwarders`='" . $db->escape($email_forwarders) . "', `ftps`='" . $db->escape($ftps) . "', `tickets`='" . $db->escape($tickets) . "', `mysqls`='" . $db->escape($mysqls) . "', `deactivated`='" . $db->escape($deactivated) . "', `phpenabled`='" . $db->escape($phpenabled) . "', `email_quota`='" . $db->escape($email_quota) . "', `imap`='" . $db->escape($email_imap) . "', `pop3`='" . $db->escape($email_pop3) . "', `aps_packages`='" . (int)$number_of_aps_packages . "', `perlenabled`='" . $db->escape($perlenabled) . "', `email_autoresponder`='" . $db->escape($email_autoresponder) . "', `backup_allowed`='" . $db->escape($backup_allowed) . "' WHERE `customerid`='" . (int)$id . "'");
|
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `name`='" . $db->escape($name) . "', `firstname`='" . $db->escape($firstname) . "', `gender`='" . $db->escape($gender) . "', `company`='" . $db->escape($company) . "', `street`='" . $db->escape($street) . "', `zipcode`='" . $db->escape($zipcode) . "', `city`='" . $db->escape($city) . "', `phone`='" . $db->escape($phone) . "', `fax`='" . $db->escape($fax) . "', `email`='" . $db->escape($email) . "', `customernumber`='" . $db->escape($customernumber) . "', `def_language`='" . $db->escape($def_language) . "', `password` = '" . $password . "', `diskspace`='" . $db->escape($diskspace) . "', `traffic`='" . $db->escape($traffic) . "', `subdomains`='" . $db->escape($subdomains) . "', `emails`='" . $db->escape($emails) . "', `email_accounts` = '" . $db->escape($email_accounts) . "', `email_forwarders`='" . $db->escape($email_forwarders) . "', `ftps`='" . $db->escape($ftps) . "', `tickets`='" . $db->escape($tickets) . "', `mysqls`='" . $db->escape($mysqls) . "', `deactivated`='" . $db->escape($deactivated) . "', `phpenabled`='" . $db->escape($phpenabled) . "', `email_quota`='" . $db->escape($email_quota) . "', `imap`='" . $db->escape($email_imap) . "', `pop3`='" . $db->escape($email_pop3) . "', `aps_packages`='" . (int)$number_of_aps_packages . "', `perlenabled`='" . $db->escape($perlenabled) . "', `email_autoresponder`='" . $db->escape($email_autoresponder) . "', `backup_allowed`='" . $db->escape($backup_allowed) . "' WHERE `customerid`='" . (int)$id . "'");
|
||||||
$admin_update_query = "UPDATE `" . TABLE_PANEL_ADMINS . "` SET `customers_used` = `customers_used` ";
|
$admin_update_query = "UPDATE `" . TABLE_PANEL_ADMINS . "` SET `customers_used` = `customers_used` ";
|
||||||
|
|
||||||
# Using filesystem - quota, insert a task which cleans the filesystem - quota
|
// Using filesystem - quota, insert a task which cleans the filesystem - quota
|
||||||
if ($settings['system']['diskquota_enabled'])
|
inserttask('10');
|
||||||
{
|
|
||||||
inserttask('10');
|
|
||||||
}
|
|
||||||
|
|
||||||
if($mysqls != '-1'
|
if($mysqls != '-1'
|
||||||
|| $result['mysqls'] != '-1')
|
|| $result['mysqls'] != '-1')
|
||||||
|
@ -196,9 +196,8 @@ if($page == 'domains'
|
|||||||
inserttask('1');
|
inserttask('1');
|
||||||
|
|
||||||
// Using nameserver, insert a task which rebuilds the server config
|
// Using nameserver, insert a task which rebuilds the server config
|
||||||
if ($settings['system']['bind_enable'] = '1') {
|
inserttask('4');
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||||
}
|
}
|
||||||
elseif ($alias_check['count'] > 0) {
|
elseif ($alias_check['count'] > 0) {
|
||||||
@ -585,10 +584,9 @@ if($page == 'domains'
|
|||||||
$log->logAction(ADM_ACTION, LOG_INFO, "added domain '" . $domain . "'");
|
$log->logAction(ADM_ACTION, LOG_INFO, "added domain '" . $domain . "'");
|
||||||
inserttask('1');
|
inserttask('1');
|
||||||
|
|
||||||
# Using nameserver, insert a task which rebuilds the server config
|
// Using nameserver, insert a task which rebuilds the server config
|
||||||
if ($settings['system']['bind_enable']) {
|
inserttask('4');
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1087,9 +1085,7 @@ if($page == 'domains'
|
|||||||
|| $dkim != $result['dkim']
|
|| $dkim != $result['dkim']
|
||||||
|| $ipandport != $result['ipandport'])
|
|| $ipandport != $result['ipandport'])
|
||||||
{
|
{
|
||||||
if ($settings['system']['bind_enable'] == '1') {
|
inserttask('4');
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($isemaildomain == '0'
|
if($isemaildomain == '0'
|
||||||
|
@ -105,11 +105,9 @@ if($page == 'ipsandports'
|
|||||||
$log->logAction(ADM_ACTION, LOG_WARNING, "deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'");
|
$log->logAction(ADM_ACTION, LOG_WARNING, "deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'");
|
||||||
inserttask('1');
|
inserttask('1');
|
||||||
|
|
||||||
# Using nameserver, insert a task which rebuilds the server config
|
// Using nameserver, insert a task which rebuilds the server config
|
||||||
if ($settings['system']['bind_enable'])
|
inserttask('4');
|
||||||
{
|
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -251,11 +249,9 @@ if($page == 'ipsandports'
|
|||||||
$log->logAction(ADM_ACTION, LOG_WARNING, "added IP/port '" . $ip . ":" . $port . "'");
|
$log->logAction(ADM_ACTION, LOG_WARNING, "added IP/port '" . $ip . ":" . $port . "'");
|
||||||
inserttask('1');
|
inserttask('1');
|
||||||
|
|
||||||
# Using nameserver, insert a task which rebuilds the server config
|
// Using nameserver, insert a task which rebuilds the server config
|
||||||
if ($settings['system']['bind_enable'])
|
inserttask('4');
|
||||||
{
|
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -412,10 +408,8 @@ if($page == 'ipsandports'
|
|||||||
inserttask('1');
|
inserttask('1');
|
||||||
|
|
||||||
// Using nameserver, insert a task which rebuilds the server config
|
// Using nameserver, insert a task which rebuilds the server config
|
||||||
if ($settings['system']['bind_enable'])
|
inserttask('4');
|
||||||
{
|
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,11 +84,9 @@ if(($page == 'settings' || $page == 'overview')
|
|||||||
inserttask('1');
|
inserttask('1');
|
||||||
inserttask('5');
|
inserttask('5');
|
||||||
|
|
||||||
# Using nameserver, insert a task which rebuilds the server config
|
// Using nameserver, insert a task which rebuilds the server config
|
||||||
if ($settings['system']['bind_enable'])
|
inserttask('4');
|
||||||
{
|
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page));
|
standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,12 +127,9 @@ elseif($page == 'rebuildconfigs'
|
|||||||
inserttask('1');
|
inserttask('1');
|
||||||
inserttask('5');
|
inserttask('5');
|
||||||
inserttask('10');
|
inserttask('10');
|
||||||
|
// Using nameserver, insert a task which rebuilds the server config
|
||||||
|
inserttask('4');
|
||||||
|
|
||||||
# Using nameserver, insert a task which rebuilds the server config
|
|
||||||
if ($settings['system']['bind_enable'])
|
|
||||||
{
|
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
standard_success('rebuildingconfigs', '', array('filename' => 'admin_index.php'));
|
standard_success('rebuildingconfigs', '', array('filename' => 'admin_index.php'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -197,11 +197,9 @@ elseif($page == 'domains')
|
|||||||
$result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used`=`subdomains_used`-1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
$result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used`=`subdomains_used`-1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||||
inserttask('1');
|
inserttask('1');
|
||||||
|
|
||||||
# Using nameserver, insert a task which rebuilds the server config
|
// Using nameserver, insert a task which rebuilds the server config
|
||||||
if ($settings['system']['bind_enable'])
|
inserttask('4');
|
||||||
{
|
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -361,10 +359,8 @@ elseif($page == 'domains')
|
|||||||
inserttask('1');
|
inserttask('1');
|
||||||
|
|
||||||
// Using nameserver, insert a task which rebuilds the server config
|
// Using nameserver, insert a task which rebuilds the server config
|
||||||
if ($settings['system']['bind_enable'])
|
inserttask('4');
|
||||||
{
|
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -556,10 +552,8 @@ elseif($page == 'domains')
|
|||||||
inserttask('1');
|
inserttask('1');
|
||||||
|
|
||||||
// Using nameserver, insert a task which rebuilds the server config
|
// Using nameserver, insert a task which rebuilds the server config
|
||||||
if ($settings['system']['bind_enable'])
|
inserttask('4');
|
||||||
{
|
|
||||||
inserttask('4');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||||
|
@ -37,6 +37,14 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '
|
|||||||
|| $type == '5'
|
|| $type == '5'
|
||||||
|| $type == '10')
|
|| $type == '10')
|
||||||
{
|
{
|
||||||
|
// 4 = bind -> if bind disabled -> no task
|
||||||
|
if ($type == '4' && $settings['system']['bind_enable'] == '0') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 10 = quota -> if quota disabled -> no task
|
||||||
|
if ($type == '10' && $settings['system']['diskquota_enabled'] == '0') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$db->query('DELETE FROM `' . TABLE_PANEL_TASKS . '` WHERE `type`="' . $type . '"');
|
$db->query('DELETE FROM `' . TABLE_PANEL_TASKS . '` WHERE `type`="' . $type . '"');
|
||||||
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`) VALUES ("' . $type . '")');
|
$db->query('INSERT INTO `' . TABLE_PANEL_TASKS . '` (`type`) VALUES ("' . $type . '")');
|
||||||
}
|
}
|
||||||
|
@ -466,43 +466,34 @@ while($row = $db->fetch_array($result_tasks))
|
|||||||
/**
|
/**
|
||||||
* TYPE=10 Set the filesystem - quota
|
* TYPE=10 Set the filesystem - quota
|
||||||
*/
|
*/
|
||||||
elseif ($row['type'] == '10')
|
elseif ($row['type'] == '10' && (int)$settings['system']['diskquota_enabled'] != 0) {
|
||||||
{
|
|
||||||
if ($settings['system']['diskquota_enabled'])
|
|
||||||
{
|
|
||||||
fwrite($debugHandler, ' cron_tasks: Task10 started - setting filesystem quota' . "\n");
|
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task10 started - setting filesystem quota');
|
|
||||||
|
|
||||||
$usedquota = getFilesystemQuota();
|
fwrite($debugHandler, ' cron_tasks: Task10 started - setting filesystem quota' . "\n");
|
||||||
|
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task10 started - setting filesystem quota');
|
||||||
|
|
||||||
# Select all customers Froxlor knows about
|
$usedquota = getFilesystemQuota();
|
||||||
$result = $db->query("SELECT `guid`, `loginname`, `diskspace` FROM `" . TABLE_PANEL_CUSTOMERS . "`;");
|
|
||||||
while($row = $db->fetch_array($result))
|
|
||||||
{
|
|
||||||
# We do not want to set a quota for root by accident
|
|
||||||
if ($row['guid'] != 0)
|
|
||||||
{
|
|
||||||
# The user has no quota in Froxlor, but on the filesystem
|
|
||||||
if (($row['diskspace'] == 0 || $row['diskspace'] == -1024) && $usedquota[$row['guid']]['block']['hard'] != 0)
|
|
||||||
{
|
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Disabling quota for " . $row['loginname']);
|
|
||||||
safe_exec($settings['system']['diskquota_quotatool_path'] . " -u " . $row['guid'] . " -bl 0 -q 0 " . escapeshellarg($settings['system']['diskquota_customer_partition']));
|
|
||||||
}
|
|
||||||
|
|
||||||
# The user quota in Froxlor is different than on the filesystem
|
// Select all customers Froxlor knows about
|
||||||
elseif($row['diskspace'] != $usedquota[$row['guid']]['block']['hard'] && $row['diskspace'] != -1024)
|
$result = $db->query("SELECT `guid`, `loginname`, `diskspace` FROM `" . TABLE_PANEL_CUSTOMERS . "`;");
|
||||||
{
|
while ($row = $db->fetch_array($result)) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Setting quota for " . $row['loginname'] . " from " . $usedquota[$row['guid']]['block']['hard'] . " to " . $row['diskspace']);
|
// We do not want to set a quota for root by accident
|
||||||
safe_exec($settings['system']['diskquota_quotatool_path'] . " -u " . $row['guid'] . " -bl " . $row['diskspace'] . " -q " . $row['diskspace'] . " " . escapeshellarg($settings['system']['diskquota_customer_partition']));
|
if ($row['guid'] != 0) {
|
||||||
}
|
// The user has no quota in Froxlor, but on the filesystem
|
||||||
|
if (($row['diskspace'] == 0 || $row['diskspace'] == -1024)
|
||||||
|
&& $usedquota[$row['guid']]['block']['hard'] != 0
|
||||||
|
) {
|
||||||
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Disabling quota for " . $row['loginname']);
|
||||||
|
safe_exec($settings['system']['diskquota_quotatool_path'] . " -u " . $row['guid'] . " -bl 0 -q 0 " . escapeshellarg($settings['system']['diskquota_customer_partition']));
|
||||||
|
}
|
||||||
|
// The user quota in Froxlor is different than on the filesystem
|
||||||
|
elseif ($row['diskspace'] != $usedquota[$row['guid']]['block']['hard']
|
||||||
|
&& $row['diskspace'] != -1024
|
||||||
|
) {
|
||||||
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Setting quota for " . $row['loginname'] . " from " . $usedquota[$row['guid']]['block']['hard'] . " to " . $row['diskspace']);
|
||||||
|
safe_exec($settings['system']['diskquota_quotatool_path'] . " -u " . $row['guid'] . " -bl " . $row['diskspace'] . " -q " . $row['diskspace'] . " " . escapeshellarg($settings['system']['diskquota_customer_partition']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
fwrite($debugHandler, ' cron_tasks: Task10 skipped - filesystem quota not enabled' . "\n");
|
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task10 skipped - filesystem quota not enabled');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,5 +512,3 @@ if($db->num_rows($result_tasks) != 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$db->query('UPDATE `' . TABLE_PANEL_SETTINGS . '` SET `value` = UNIX_TIMESTAMP() WHERE `settinggroup` = \'system\' AND `varname` = \'last_tasks_run\' ');
|
$db->query('UPDATE `' . TABLE_PANEL_SETTINGS . '` SET `value` = UNIX_TIMESTAMP() WHERE `settinggroup` = \'system\' AND `varname` = \'last_tasks_run\' ');
|
||||||
|
|
||||||
?>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user