diff --git a/admin_domains.php b/admin_domains.php index e4170e8b..fc88f711 100644 --- a/admin_domains.php +++ b/admin_domains.php @@ -640,8 +640,8 @@ if ($page == 'domains' || $page == 'overview') { // update customer/admin counters \Froxlor\User::updateCounters(false); - \Froxlor\System\Cronjob::inserttask('1'); - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); $result_str = $result['imported'] . ' / ' . $result['all'] . (! empty($result['note']) ? ' (' . $result['note'] . ')' : ''); \Froxlor\UI\Response::standard_success('domain_import_successfully', $result_str, array( diff --git a/admin_settings.php b/admin_settings.php index 4e9aba21..162fe4d3 100644 --- a/admin_settings.php +++ b/admin_settings.php @@ -66,11 +66,11 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') { 'page' => $page ), $_part, $settings_all, $settings_part, $only_enabledisable)) { $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting"); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); // Using nameserver, insert a task which rebuilds the server config - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); // cron.d file - \Froxlor\System\Cronjob::inserttask('99'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_CRON); \Froxlor\UI\Response::standard_success('settingssaved', '', array( 'filename' => $filename, @@ -146,12 +146,12 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') { if (isset($_POST['send']) && $_POST['send'] == 'send') { $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles"); - \Froxlor\System\Cronjob::inserttask('1'); - \Froxlor\System\Cronjob::inserttask('10'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::CREATE_QUOTA); // Using nameserver, insert a task which rebuilds the server config - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); // cron.d file - \Froxlor\System\Cronjob::inserttask('99'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_CRON); \Froxlor\UI\Response::standard_success('rebuildingconfigs', '', array( 'filename' => 'admin_index.php' diff --git a/admin_updates.php b/admin_updates.php index 2b0e3420..9f6357df 100644 --- a/admin_updates.php +++ b/admin_updates.php @@ -65,7 +65,7 @@ if ($page == 'overview') { eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_end') . "\";"); \Froxlor\User::updateCounters(); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); @chmod(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php', 0440); $successful_update = true; diff --git a/lib/Froxlor/Api/Commands/Certificates.php b/lib/Froxlor/Api/Commands/Certificates.php index 69ffc718..a611eedf 100644 --- a/lib/Froxlor/Api/Commands/Certificates.php +++ b/lib/Froxlor/Api/Commands/Certificates.php @@ -323,7 +323,7 @@ class Certificates extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resou )); // trigger removing of certificate from acme.sh if let's encrypt if ($chk['letsencrypt'] == '1') { - \Froxlor\System\Cronjob::inserttask('12', $chk['domain']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_DOMAIN_SSL, $chk['domain']); } $this->logger()->logAction($this->isAdmin() ? \Froxlor\FroxlorLogger::ADM_ACTION : \Froxlor\FroxlorLogger::USR_ACTION, LOG_INFO, "[API] removed ssl-certificate for '" . $chk['domain'] . "'"); return $this->response(200, "successful", $result); @@ -421,7 +421,7 @@ class Certificates extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resou ); Database::pexecute($stmt, $params, true, true); // insert task to re-generate webserver-configs (#1260) - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); return true; } } diff --git a/lib/Froxlor/Api/Commands/Cronjobs.php b/lib/Froxlor/Api/Commands/Cronjobs.php index d6bd7889..34c0f218 100644 --- a/lib/Froxlor/Api/Commands/Cronjobs.php +++ b/lib/Froxlor/Api/Commands/Cronjobs.php @@ -114,7 +114,7 @@ class Cronjobs extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceE ), true, true); // insert task to re-generate the cron.d-file - \Froxlor\System\Cronjob::inserttask('99'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_CRON); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "[API] cronjob with description '" . $result['module'] . '/' . $result['cronfile'] . "' has been updated by '" . $this->getUserDetail('loginname') . "'"); $result = $this->apiCall('Cronjobs.get', array( 'id' => $id diff --git a/lib/Froxlor/Api/Commands/CustomerBackups.php b/lib/Froxlor/Api/Commands/CustomerBackups.php index 84941cec..f899b6ca 100644 --- a/lib/Froxlor/Api/Commands/CustomerBackups.php +++ b/lib/Froxlor/Api/Commands/CustomerBackups.php @@ -108,7 +108,7 @@ class CustomerBackups extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Re 'backup_web' => $backup_web ); // schedule backup job - \Froxlor\System\Cronjob::inserttask('20', $task_data); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::CREATE_CUSTOMER_BACKUP, $task_data); $this->logger()->logAction($this->isAdmin() ? \Froxlor\FroxlorLogger::ADM_ACTION : \Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "[API] added customer-backup job for '" . $customer['loginname'] . "'. Target directory: " . $userpath); return $this->response(200, "successful", $task_data); diff --git a/lib/Froxlor/Api/Commands/Customers.php b/lib/Froxlor/Api/Commands/Customers.php index e89031c3..b1dd1034 100644 --- a/lib/Froxlor/Api/Commands/Customers.php +++ b/lib/Froxlor/Api/Commands/Customers.php @@ -645,10 +645,10 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource unset($ins_data); // insert task to create homedir etc. - \Froxlor\System\Cronjob::inserttask('2', $loginname, $guid, $guid, $store_defaultindex); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::CREATE_HOME, $loginname, $guid, $guid, $store_defaultindex); // Using filesystem - quota, insert a task which cleans the filesystem - quota - \Froxlor\System\Cronjob::inserttask('10'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::CREATE_QUOTA); // Add htpasswd for the stats-pages $htpasswdPassword = \Froxlor\System\Crypt::makeCryptPassword($password, true); @@ -674,7 +674,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "[API] automatically added " . $stats_folder . " htpasswd for user '" . $loginname . "'"); Database::pexecute($ins_stmt, $ins_data, true, true); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); // add default FTP-User // also, add froxlor-local user to ftp-group (if exists!) to @@ -739,7 +739,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource 'customerid' => $customerid ), true, true); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "[API] automatically added standardsubdomain for user '" . $loginname . "'"); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); } } @@ -1088,7 +1088,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource 'customerid' => $result['customerid'] ), true, true); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "[API] automatically added standardsubdomain for user '" . $result['loginname'] . "'"); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); } } @@ -1102,11 +1102,11 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_ERR, "[API] Unable to delete standard-subdomain: " . $e->getMessage()); } $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "[API] automatically deleted standardsubdomain for user '" . $result['loginname'] . "'"); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); } if ($phpenabled != $result['phpenabled'] || $perlenabled != $result['perlenabled'] || $email != $result['email']) { - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); } // activate/deactivate customer services @@ -1192,7 +1192,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource ), true, true); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "[API] " . ($deactivated ? 'deactivated' : 'reactivated') . " user '" . $result['loginname'] . "'"); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); } // Disable or enable POP3 Login for customers Mail Accounts @@ -1304,7 +1304,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource if ($this->isAdmin()) { // Using filesystem - quota, insert a task which cleans the filesystem - quota - \Froxlor\System\Cronjob::inserttask('10'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::CREATE_QUOTA); $admin_update_query = "UPDATE `" . TABLE_PANEL_ADMINS . "` SET `customers_used` = `customers_used` "; @@ -1512,9 +1512,9 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource 'did' => $row['id'] ), true, true); // remove domains DNS from powerDNS if used, #581 - \Froxlor\System\Cronjob::inserttask('11', $row['domain']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_DOMAIN_PDNS, $row['domain']); // remove domain from acme.sh / lets encrypt if used - \Froxlor\System\Cronjob::inserttask('12', $row['domain']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_DOMAIN_SSL, $row['domain']); } // remove customer domains $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid` = :id"); @@ -1643,18 +1643,18 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource } // rebuild configs - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); // Using nameserver, insert a task which rebuilds the server config - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); if ($delete_userfiles == 1) { // insert task to remove the customers files from the filesystem - \Froxlor\System\Cronjob::inserttask('6', $result['loginname']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_CUSTOMER_FILES, $result['loginname']); } // Using filesystem - quota, insert a task which cleans the filesystem - quota - \Froxlor\System\Cronjob::inserttask('10'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::CREATE_QUOTA); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, "[API] deleted customer '" . $result['loginname'] . "'"); return $this->response(200, "successful", $result); diff --git a/lib/Froxlor/Api/Commands/DirOptions.php b/lib/Froxlor/Api/Commands/DirOptions.php index fc54f0cb..d5c0c010 100644 --- a/lib/Froxlor/Api/Commands/DirOptions.php +++ b/lib/Froxlor/Api/Commands/DirOptions.php @@ -123,7 +123,7 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc Database::pexecute($stmt, $params, true, true); $id = Database::lastInsertId(); $this->logger()->logAction($this->isAdmin() ? \Froxlor\FroxlorLogger::ADM_ACTION : \Froxlor\FroxlorLogger::USR_ACTION, LOG_INFO, "[API] added directory-option for '" . $userpath . "'"); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); $result = $this->apiCall('DirOptions.get', array( 'id' => $id @@ -248,7 +248,7 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc } if (($options_indexes != $result['options_indexes']) || ($error404path != $result['error404path']) || ($error403path != $result['error403path']) || ($error500path != $result['error500path']) || ($options_cgi != $result['options_cgi'])) { - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); $stmt = Database::prepare(" UPDATE `" . TABLE_PANEL_HTACCESS . "` SET `options_indexes` = :options_indexes, @@ -413,7 +413,7 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc "id" => $id ), true, true); $this->logger()->logAction($this->isAdmin() ? \Froxlor\FroxlorLogger::ADM_ACTION : \Froxlor\FroxlorLogger::USR_ACTION, LOG_INFO, "[API] deleted directory-option for '" . str_replace($customer_data['documentroot'], '/', $result['path']) . "'"); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); return $this->response(200, "successful", $result); } diff --git a/lib/Froxlor/Api/Commands/DirProtections.php b/lib/Froxlor/Api/Commands/DirProtections.php index 241592d2..8137b93e 100644 --- a/lib/Froxlor/Api/Commands/DirProtections.php +++ b/lib/Froxlor/Api/Commands/DirProtections.php @@ -106,7 +106,7 @@ class DirProtections extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Res Database::pexecute($stmt, $params, true, true); $id = Database::lastInsertId(); $this->logger()->logAction($this->isAdmin() ? \Froxlor\FroxlorLogger::ADM_ACTION : \Froxlor\FroxlorLogger::USR_ACTION, LOG_INFO, "[API] added directory-protection for '" . $username . " (" . $path . ")'"); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); $result = $this->apiCall('DirProtections.get', array( 'id' => $id @@ -251,7 +251,7 @@ class DirProtections extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Res UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET " . $upd_query . " WHERE `id` = :id AND `customerid`= :cid "); Database::pexecute($upd_stmt, $upd_params, true, true); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); } $this->logger()->logAction($this->isAdmin() ? \Froxlor\FroxlorLogger::ADM_ACTION : \Froxlor\FroxlorLogger::USR_ACTION, LOG_INFO, "[API] updated directory-protection '" . $result['username'] . " (" . $result['path'] . ")'"); @@ -385,7 +385,7 @@ class DirProtections extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Res )); $this->logger()->logAction($this->isAdmin() ? \Froxlor\FroxlorLogger::ADM_ACTION : \Froxlor\FroxlorLogger::USR_ACTION, LOG_INFO, "[API] deleted htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'"); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); return $this->response(200, "successful", $result); } } diff --git a/lib/Froxlor/Api/Commands/DomainZones.php b/lib/Froxlor/Api/Commands/DomainZones.php index a51e59e0..7c0b385b 100644 --- a/lib/Froxlor/Api/Commands/DomainZones.php +++ b/lib/Froxlor/Api/Commands/DomainZones.php @@ -336,7 +336,7 @@ class DomainZones extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour $dom_entries[] = $new_entry; // re-generate bind configs - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); $result = $this->apiCall('DomainZones.get', array( 'id' => $id @@ -542,7 +542,7 @@ class DomainZones extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour ), true, true); if ($del_stmt->rowCount() > 0) { // re-generate bind configs - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); return $this->response(200, "successful", true); } return $this->response(304, "successful", true); diff --git a/lib/Froxlor/Api/Commands/Domains.php b/lib/Froxlor/Api/Commands/Domains.php index 5718808b..3113f528 100644 --- a/lib/Froxlor/Api/Commands/Domains.php +++ b/lib/Froxlor/Api/Commands/Domains.php @@ -857,9 +857,9 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn \Froxlor\Domain\Domain::triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $this->logger()); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); // Using nameserver, insert a task which rebuilds the server config - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, "[API] added domain '" . $domain . "'"); @@ -1465,7 +1465,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn $iswildcarddomain = ($serveraliasoption == '0') ? '1' : '0'; if ($documentroot != $result['documentroot'] || $ssl_redirect != $result['ssl_redirect'] || $wwwserveralias != $result['wwwserveralias'] || $iswildcarddomain != $result['iswildcarddomain'] || $phpenabled != $result['phpenabled'] || $openbasedir != $result['openbasedir'] || $phpsettingid != $result['phpsettingid'] || $mod_fcgid_starter != $result['mod_fcgid_starter'] || $mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] || $specialsettings != $result['specialsettings'] || $ssl_specialsettings != $result['ssl_specialsettings'] || $notryfiles != $result['notryfiles'] || $writeaccesslog != $result['writeaccesslog'] || $writeerrorlog != $result['writeerrorlog'] || $aliasdomain != $result['aliasdomain'] || $issubof != $result['ismainbutsubto'] || $email_only != $result['email_only'] || ($speciallogfile != $result['speciallogfile'] && $speciallogverified == '1') || $letsencrypt != $result['letsencrypt'] || $http2 != $result['http2'] || $hsts_maxage != $result['hsts'] || $hsts_sub != $result['hsts_sub'] || $hsts_preload != $result['hsts_preload'] || $ocsp_stapling != $result['ocsp_stapling']) { - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); } if ($speciallogfile != $result['speciallogfile'] && $speciallogverified != '1') { @@ -1473,11 +1473,11 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn } if ($isbinddomain != $result['isbinddomain'] || $zonefile != $result['zonefile'] || $dkim != $result['dkim'] || $isemaildomain != $result['isemaildomain']) { - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); } // check whether nameserver has been disabled, #581 if ($isbinddomain != $result['isbinddomain'] && $isbinddomain == 0) { - \Froxlor\System\Cronjob::inserttask('11', $result['domain']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_DOMAIN_PDNS, $result['domain']); } if ($isemaildomain == '0' && $result['isemaildomain'] == '1') { @@ -1506,7 +1506,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn 'id' => $id ), true, true); // remove domain from acme.sh / lets encrypt if used - \Froxlor\System\Cronjob::inserttask('12', $result['domain']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_DOMAIN_SSL, $result['domain']); } $updatechildren = ''; @@ -1984,16 +1984,16 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn \Froxlor\Domain\Domain::triggerLetsEncryptCSRForAliasDestinationDomain($result['aliasdomain'], $this->logger()); // remove domains DNS from powerDNS if used, #581 - \Froxlor\System\Cronjob::inserttask('11', $result['domain']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_DOMAIN_PDNS, $result['domain']); // remove domain from acme.sh / lets encrypt if used - \Froxlor\System\Cronjob::inserttask('12', $result['domain']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_DOMAIN_SSL, $result['domain']); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "[API] deleted domain/subdomains (#" . $result['id'] . ")"); \Froxlor\User::updateCounters(); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); // Using nameserver, insert a task which rebuilds the server config - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); return $this->response(200, "successful", $result); } throw new \Exception("Not allowed to execute given command.", 403); diff --git a/lib/Froxlor/Api/Commands/EmailAccounts.php b/lib/Froxlor/Api/Commands/EmailAccounts.php index 34b9d06b..9ee1d16c 100644 --- a/lib/Froxlor/Api/Commands/EmailAccounts.php +++ b/lib/Froxlor/Api/Commands/EmailAccounts.php @@ -499,7 +499,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso } if ($delete_userfiles) { - \Froxlor\System\Cronjob::inserttask('7', $customer['loginname'], $result['email_full']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_EMAIL_DATA, $customer['loginname'], $result['email_full']); } // decrease usage for customer diff --git a/lib/Froxlor/Api/Commands/FpmDaemons.php b/lib/Froxlor/Api/Commands/FpmDaemons.php index 36fed4e0..b443798b 100644 --- a/lib/Froxlor/Api/Commands/FpmDaemons.php +++ b/lib/Froxlor/Api/Commands/FpmDaemons.php @@ -229,7 +229,7 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc Database::pexecute($ins_stmt, $ins_data); $id = Database::lastInsertId(); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "[API] fpm-daemon with description '" . $description . "' has been created by '" . $this->getUserDetail('loginname') . "'"); $result = $this->apiCall('FpmDaemons.get', array( 'id' => $id @@ -351,7 +351,7 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc ); Database::pexecute($upd_stmt, $upd_data, true, true); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "[API] fpm-daemon with description '" . $description . "' has been updated by '" . $this->getUserDetail('loginname') . "'"); $result = $this->apiCall('FpmDaemons.get', array( 'id' => $id @@ -400,7 +400,7 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc 'id' => $id ), true, true); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "[API] fpm-daemon setting '" . $result['description'] . "' has been deleted by '" . $this->getUserDetail('loginname') . "'"); return $this->response(200, "successful", $result); } diff --git a/lib/Froxlor/Api/Commands/Froxlor.php b/lib/Froxlor/Api/Commands/Froxlor.php index 78c772c9..7aecb886 100644 --- a/lib/Froxlor/Api/Commands/Froxlor.php +++ b/lib/Froxlor/Api/Commands/Froxlor.php @@ -123,12 +123,12 @@ class Froxlor extends \Froxlor\Api\ApiCommand $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "User " . $this->getUserDetail('loginname') . " imported settings"); try { \Froxlor\SImExporter::import($json_str); - \Froxlor\System\Cronjob::inserttask('1'); - \Froxlor\System\Cronjob::inserttask('10'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::CREATE_QUOTA); // Using nameserver, insert a task which rebuilds the server config - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); // cron.d file - \Froxlor\System\Cronjob::inserttask('99'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_CRON); return $this->response(200, "successful", true); } catch (\Exception $e) { throw new \Exception($e->getMessage(), 406); diff --git a/lib/Froxlor/Api/Commands/Ftps.php b/lib/Froxlor/Api/Commands/Ftps.php index 9d7664b4..5b05cf13 100644 --- a/lib/Froxlor/Api/Commands/Ftps.php +++ b/lib/Froxlor/Api/Commands/Ftps.php @@ -234,7 +234,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit } $this->logger()->logAction($this->isAdmin() ? \Froxlor\FroxlorLogger::ADM_ACTION : \Froxlor\FroxlorLogger::USR_ACTION, LOG_INFO, "[API] added ftp-account '" . $username . " (" . $path . ")'"); - \Froxlor\System\Cronjob::inserttask(5); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::CREATE_FTP); if ($sendinfomail == 1) { $replace_arr = array( @@ -450,7 +450,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit } // it's the task for "new ftp" but that will // create all directories and correct their permissions - \Froxlor\System\Cronjob::inserttask(5); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::CREATE_FTP); $stmt = Database::prepare(" UPDATE `" . TABLE_FTP_USERS . "` @@ -628,11 +628,11 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit // refs #293 if ($delete_userfiles == 1) { - \Froxlor\System\Cronjob::inserttask('8', $customer_data['loginname'], $result['homedir']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_FTP_DATA, $customer_data['loginname'], $result['homedir']); } else { if (Settings::Get('system.nssextrausers') == 1) { // this is used so that the libnss-extrausers cron is fired - \Froxlor\System\Cronjob::inserttask(5); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::CREATE_FTP); } } diff --git a/lib/Froxlor/Api/Commands/IpsAndPorts.php b/lib/Froxlor/Api/Commands/IpsAndPorts.php index 4f8fd1e4..71d836fb 100644 --- a/lib/Froxlor/Api/Commands/IpsAndPorts.php +++ b/lib/Froxlor/Api/Commands/IpsAndPorts.php @@ -298,9 +298,9 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour Database::pexecute($ins_stmt, $ins_data); $ins_data['id'] = Database::lastInsertId(); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); // Using nameserver, insert a task which rebuilds the server config - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { $ip = '[' . $ip . ']'; @@ -511,9 +511,9 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour ); Database::pexecute($upd_stmt, $upd_data); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); // Using nameserver, insert a task which rebuilds the server config - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, "[API] changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'"); @@ -584,9 +584,9 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour 'id' => $id ), true, true); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); // Using nameserver, insert a task which rebuilds the server config - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, "[API] deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'"); return $this->response(200, "successful", $result); diff --git a/lib/Froxlor/Api/Commands/PhpSettings.php b/lib/Froxlor/Api/Commands/PhpSettings.php index 6689241a..ae59726f 100644 --- a/lib/Froxlor/Api/Commands/PhpSettings.php +++ b/lib/Froxlor/Api/Commands/PhpSettings.php @@ -364,7 +364,7 @@ class PhpSettings extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour Database::pexecute($ins_stmt, $ins_data, true, true); $ins_data['id'] = Database::lastInsertId(); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "[API] php setting with description '" . $description . "' has been created by '" . $this->getUserDetail('loginname') . "'"); $result = $this->apiCall('PhpSettings.get', array( @@ -565,7 +565,7 @@ class PhpSettings extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour ); Database::pexecute($upd_stmt, $upd_data, true, true); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "[API] php setting with description '" . $description . "' has been updated by '" . $this->getUserDetail('loginname') . "'"); $result = $this->apiCall('PhpSettings.get', array( @@ -622,7 +622,7 @@ class PhpSettings extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour 'id' => $id ), true, true); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); $this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "[API] php setting '" . $result['description'] . "' has been deleted by '" . $this->getUserDetail('loginname') . "'"); return $this->response(200, "successful", $result); } diff --git a/lib/Froxlor/Api/Commands/SubDomains.php b/lib/Froxlor/Api/Commands/SubDomains.php index c3a0a322..16717ea5 100644 --- a/lib/Froxlor/Api/Commands/SubDomains.php +++ b/lib/Froxlor/Api/Commands/SubDomains.php @@ -359,9 +359,9 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc \Froxlor\Domain\Domain::addRedirectToDomain($subdomain_id, $redirectcode); } - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); // Using nameserver, insert a task which rebuilds the server config - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); Customers::increaseUsage($customer['customerid'], 'subdomains_used'); @@ -733,11 +733,11 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc 'id' => $id ), true, true); // remove domain from acme.sh / lets encrypt if used - \Froxlor\System\Cronjob::inserttask('12', $result['domain']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_DOMAIN_SSL, $result['domain']); } - \Froxlor\System\Cronjob::inserttask('1'); - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); $idna_convert = new \Froxlor\Idna\IdnaWrapper(); $this->logger()->logAction($this->isAdmin() ? \Froxlor\FroxlorLogger::ADM_ACTION : \Froxlor\FroxlorLogger::USR_ACTION, LOG_INFO, "[API] edited domain '" . $idna_convert->decode($result['domain']) . "'"); } @@ -1019,13 +1019,13 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc 'domainid' => $id ), true, true); - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); // Using nameserver, insert a task which rebuilds the server config - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); // remove domains DNS from powerDNS if used, #581 - \Froxlor\System\Cronjob::inserttask('11', $result['domain']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_DOMAIN_PDNS, $result['domain']); // remove domain from acme.sh / lets encrypt if used - \Froxlor\System\Cronjob::inserttask('12', $result['domain']); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::DELETE_DOMAIN_SSL, $result['domain']); // reduce subdomain-usage-counter Customers::decreaseUsage($customer['customerid'], 'subdomains_used'); diff --git a/lib/Froxlor/Cron/MasterCron.php b/lib/Froxlor/Cron/MasterCron.php index 0c4c88e4..2f2b52a0 100644 --- a/lib/Froxlor/Cron/MasterCron.php +++ b/lib/Froxlor/Cron/MasterCron.php @@ -63,13 +63,13 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron if (strtolower($argv[$x]) == '--force') { // really force re-generating of config-files by // inserting task 1 - \Froxlor\System\Cronjob::inserttask('1'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); // bind (if enabled, \Froxlor\System\Cronjob::inserttask() checks this) - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); // set quotas (if enabled) - \Froxlor\System\Cronjob::inserttask('10'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::CREATE_QUOTA); // also regenerate cron.d-file - \Froxlor\System\Cronjob::inserttask('99'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_CRON); array_push($jobs_to_run, 'tasks'); define('CRON_IS_FORCED', 1); } elseif (strtolower($argv[$x]) == '--debug') { diff --git a/lib/Froxlor/Cron/System/TasksCron.php b/lib/Froxlor/Cron/System/TasksCron.php index b78575f0..99c93944 100644 --- a/lib/Froxlor/Cron/System/TasksCron.php +++ b/lib/Froxlor/Cron/System/TasksCron.php @@ -4,6 +4,8 @@ namespace Froxlor\Cron\System; use Froxlor\Database\Database; use Froxlor\Settings; +use Froxlor\Cron\TaskId; + /** * This file is part of the Froxlor project. * Copyright (c) 2003-2009 the SysCP Team (see authors). @@ -45,55 +47,55 @@ class TasksCron extends \Froxlor\Cron\FroxlorCron $row['data'] = json_decode($row['data'], true); } - if ($row['type'] == '1') { + if ($row['type'] == TaskId::REBUILD_VHOST) { /** * TYPE=1 MEANS TO REBUILD APACHE VHOSTS.CONF */ self::rebuildWebserverConfigs(); - } elseif ($row['type'] == '2') { + } elseif ($row['type'] == TaskId::CREATE_HOME) { /** * TYPE=2 MEANS TO CREATE A NEW HOME AND CHOWN */ self::createNewHome($row); - } elseif ($row['type'] == '4' && (int) Settings::Get('system.bind_enable') != 0) { + } elseif ($row['type'] == TaskId::REBUILD_DNS && (int) Settings::Get('system.bind_enable') != 0) { /** * TYPE=4 MEANS THAT SOMETHING IN THE BIND CONFIG HAS CHANGED. * REBUILD froxlor_bind.conf IF BIND IS ENABLED */ self::rebuildDnsConfigs(); - } elseif ($row['type'] == '5') { + } elseif ($row['type'] == TaskId::CREATE_FTP) { /** * TYPE=5 MEANS THAT A NEW FTP-ACCOUNT HAS BEEN CREATED, CREATE THE DIRECTORY */ self::createNewFtpHome($row); - } elseif ($row['type'] == '6') { + } elseif ($row['type'] == TaskId::DELETE_CUSTOMER_FILES) { /** * TYPE=6 MEANS THAT A CUSTOMER HAS BEEN DELETED AND THAT WE HAVE TO REMOVE ITS FILES */ self::deleteCustomerData($row); - } elseif ($row['type'] == '7') { + } elseif ($row['type'] == TaskId::DELETE_EMAIL_DATA) { /** * TYPE=7 Customer deleted an email account and wants the data to be deleted on the filesystem */ self::deleteEmailData($row); - } elseif ($row['type'] == '8') { + } elseif ($row['type'] == TaskId::DELETE_FTP_DATA) { /** * TYPE=8 Customer deleted a ftp account and wants the homedir to be deleted on the filesystem * refs #293 */ self::deleteFtpData($row); - } elseif ($row['type'] == '10' && (int) Settings::Get('system.diskquota_enabled') != 0) { + } elseif ($row['type'] == TaskId::CREATE_QUOTA && (int) Settings::Get('system.diskquota_enabled') != 0) { /** * TYPE=10 Set the filesystem - quota */ self::setFilesystemQuota(); - } elseif ($row['type'] == '11' && Settings::Get('system.dns_server') == 'PowerDNS') { + } elseif ($row['type'] == TaskId::DELETE_DOMAIN_PDNS && Settings::Get('system.dns_server') == 'PowerDNS') { /** * TYPE=11 domain has been deleted, remove from pdns database if used */ \Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_NOTICE, "Removing PowerDNS entries for domain " . $row['data']['domain']); \Froxlor\Dns\PowerDNS::cleanDomainZone($row['data']['domain']); - } elseif ($row['type'] == '12') { + } elseif ($row['type'] == TaskId::DELETE_DOMAIN_SSL) { /** * TYPE=12 domain has been deleted, remove from acme.sh/let's encrypt directory if used */ diff --git a/lib/Froxlor/Cron/TaskId.php b/lib/Froxlor/Cron/TaskId.php new file mode 100644 index 00000000..f862e2fe --- /dev/null +++ b/lib/Froxlor/Cron/TaskId.php @@ -0,0 +1,105 @@ +getConstants(); + } + return in_array($numericid, $reflContants, true); + } + + /** + * Get constant name by id + * @param int|string $id cron task id (legacy string support) + * @return string|false constant name or false if not found + */ + public static function convertToConstant($id) { + static $reflContants; + if (!is_numeric($id)) { + return false; + } + $numericid = (int)$id; + if (!is_array($reflContants)) { + $reflClass = new \ReflectionClass(get_called_class()); + $reflContants = $reflClass->getConstants(); + } + return array_search($numericid, $reflContants, true); + } +} + diff --git a/lib/Froxlor/Settings/Store.php b/lib/Froxlor/Settings/Store.php index 1f8a3a60..d282947c 100644 --- a/lib/Froxlor/Settings/Store.php +++ b/lib/Froxlor/Settings/Store.php @@ -174,7 +174,7 @@ class Store $returnvalue = self::storeSettingField($fieldname, $fielddata, $newfieldvalue); if ($returnvalue !== false) { - \Froxlor\System\Cronjob::inserttask('4'); + \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); } return $returnvalue; } diff --git a/lib/Froxlor/System/Cronjob.php b/lib/Froxlor/System/Cronjob.php index a08dbaa0..030b555b 100644 --- a/lib/Froxlor/System/Cronjob.php +++ b/lib/Froxlor/System/Cronjob.php @@ -4,6 +4,8 @@ namespace Froxlor\System; use Froxlor\Settings; use Froxlor\Database\Database; +use Froxlor\Cron\TaskId; + class Cronjob { @@ -109,13 +111,13 @@ class Cronjob INSERT INTO `" . TABLE_PANEL_TASKS . "` SET `type` = :type, `data` = :data "); - if ($type == '1' || $type == '3' || $type == '4' || $type == '5' || $type == '10' || $type == '99') { + if ($type == TaskId::REBUILD_VHOST || $type == TaskId::REBUILD_DNS || $type == TaskId::CREATE_FTP || $type == TaskId::CREATE_QUOTA || $type == TaskId::REBUILD_CRON) { // 4 = bind -> if bind disabled -> no task - if ($type == '4' && Settings::Get('system.bind_enable') == '0') { + if ($type == TaskId::REBUILD_DNS && Settings::Get('system.bind_enable') == '0') { return; } // 10 = quota -> if quota disabled -> no task - if ($type == '10' && Settings::Get('system.diskquota_enabled') == '0') { + if ($type == TaskId::CREATE_QUOTA && Settings::Get('system.diskquota_enabled') == '0') { return; } @@ -132,7 +134,7 @@ class Cronjob 'type' => $type, 'data' => '' )); - } elseif ($type == '2' && $param1 != '' && $param2 != '' && $param3 != '' && ($param4 == 0 || $param4 == 1)) { + } elseif ($type == TaskId::CREATE_HOME && $param1 != '' && $param2 != '' && $param3 != '' && ($param4 == 0 || $param4 == 1)) { $data = array(); $data['loginname'] = $param1; $data['uid'] = $param2; @@ -140,56 +142,56 @@ class Cronjob $data['store_defaultindex'] = $param4; $data = json_encode($data); Database::pexecute($ins_stmt, array( - 'type' => '2', + 'type' => TaskId::CREATE_HOME, 'data' => $data )); - } elseif ($type == '6' && $param1 != '') { + } elseif ($type == TaskId::DELETE_CUSTOMER_FILES && $param1 != '') { $data = array(); $data['loginname'] = $param1; $data = json_encode($data); Database::pexecute($ins_stmt, array( - 'type' => '6', + 'type' => TaskId::DELETE_CUSTOMER_FILES, 'data' => $data )); - } elseif ($type == '7' && $param1 != '' && $param2 != '') { + } elseif ($type == TaskId::DELETE_EMAIL_DATA && $param1 != '' && $param2 != '') { $data = array(); $data['loginname'] = $param1; $data['email'] = $param2; $data = json_encode($data); Database::pexecute($ins_stmt, array( - 'type' => '7', + 'type' => TaskId::DELETE_EMAIL_DATA, 'data' => $data )); - } elseif ($type == '8' && $param1 != '' && $param2 != '') { + } elseif ($type == TaskId::DELETE_FTP_DATA && $param1 != '' && $param2 != '') { $data = array(); $data['loginname'] = $param1; $data['homedir'] = $param2; $data = json_encode($data); Database::pexecute($ins_stmt, array( - 'type' => '8', + 'type' => TaskId::DELETE_FTP_DATA, 'data' => $data )); - } elseif ($type == '11' && $param1 != '' && Settings::Get('system.bind_enable') == '1' && Settings::Get('system.dns_server') == 'PowerDNS') { + } elseif ($type == TaskId::DELETE_DOMAIN_PDNS && $param1 != '' && Settings::Get('system.bind_enable') == '1' && Settings::Get('system.dns_server') == 'PowerDNS') { // -> if bind disabled or dns-server not PowerDNS -> no task $data = array(); $data['domain'] = $param1; $data = json_encode($data); Database::pexecute($ins_stmt, array( - 'type' => '11', + 'type' => TaskId::DELETE_DOMAIN_PDNS, 'data' => $data )); - } elseif ($type == '12' && $param1 != '') { + } elseif ($type == TaskId::DELETE_DOMAIN_SSL && $param1 != '') { $data = array(); $data['domain'] = $param1; $data = json_encode($data); Database::pexecute($ins_stmt, array( - 'type' => '12', + 'type' => TaskId::DELETE_DOMAIN_SSL, 'data' => $data )); - } elseif ($type == '20' && is_array($param1)) { + } elseif ($type == TaskId::CREATE_CUSTOMER_BACKUP && is_array($param1)) { $data = json_encode($param1); Database::pexecute($ins_stmt, array( - 'type' => '20', + 'type' => TaskId::CREATE_CUSTOMER_BACKUP, 'data' => $data )); } @@ -248,57 +250,23 @@ class Cronjob $row['data'] = json_decode($row['data'], true); } - // rebuilding webserver-configuration - if ($row['type'] == '1') { - $task_desc = $lng['tasks']['rebuild_webserverconfig']; - } elseif ($row['type'] == '2') { - // adding new user/ - $loginname = ''; + $task_id = $row['type']; + if (\Froxlor\Cron\TaskId::isValid($task_id)) { + $task_constname = \Froxlor\Cron\TaskId::convertToConstant($task_id); + $task_desc = isset($lng['tasks'][$task_constname]) ? $lng['tasks'][$task_constname] : $task_constname; + if (is_array($row['data'])) { - $loginname = $row['data']['loginname']; + // task includes loginname + if (isset($row['data']['loginname'])) { + $loginname = $row['data']['loginname']; + $task_desc = str_replace('%loginname%', $loginname, $task_desc); + } + // task includes domain data + if (isset($row['data']['domain'])) { + $domain = $row['data']['domain']; + $task_desc = str_replace('%domain%', $domain, $task_desc); + } } - $task_desc = $lng['tasks']['adding_customer']; - $task_desc = str_replace('%loginname%', $loginname, $task_desc); - } elseif ($row['type'] == '4') { - // rebuilding bind-configuration - $task_desc = $lng['tasks']['rebuild_bindconfig']; - } elseif ($row['type'] == '5') { - // creating ftp-user directory - $task_desc = $lng['tasks']['creating_ftpdir']; - } elseif ($row['type'] == '6') { - // deleting user-files - $loginname = ''; - if (is_array($row['data'])) { - $loginname = $row['data']['loginname']; - } - $task_desc = $lng['tasks']['deleting_customerfiles']; - $task_desc = str_replace('%loginname%', $loginname, $task_desc); - } elseif ($row['type'] == '7') { - // deleting email-account - $task_desc = $lng['tasks']['remove_emailacc_files']; - } elseif ($row['type'] == '8') { - // deleting ftp-account - $task_desc = $lng['tasks']['remove_ftpacc_files']; - } elseif ($row['type'] == '10') { - // Set FS - quota - $task_desc = $lng['tasks']['diskspace_set_quota']; - } elseif ($row['type'] == '11') { - // remove domain from pdns database if used - $task_desc = sprintf($lng['tasks']['remove_pdns_domain'], $row['data']['domain']); - } elseif ($row['type'] == '12') { - // remove domains ssl files - $task_desc = sprintf($lng['tasks']['remove_ssl_domain'], $row['data']['domain']); - } elseif ($row['type'] == '20') { - // deleting user-files - $loginname = ''; - if (is_array($row['data'])) { - $loginname = $row['data']['loginname']; - } - $task_desc = $lng['tasks']['backup_customerfiles']; - $task_desc = str_replace('%loginname%', $loginname, $task_desc); - } elseif ($row['type'] == '99') { - // re-generating of cron.d-file - $task_desc = $lng['tasks']['regenerating_crond']; } else { // unknown $task_desc = "ERROR: Unknown task type '" . $row['type'] . "'"; diff --git a/lng/czech.lng.php b/lng/czech.lng.php index 57340117..04c58dc6 100644 --- a/lng/czech.lng.php +++ b/lng/czech.lng.php @@ -954,11 +954,11 @@ $lng['update']['noupdatesavail'] = 'You already have the latest Froxlor $lng['admin']['specialsettingsforsubdomains'] = 'Apply specialsettings to all subdomains (*.example.com)'; $lng['serversettings']['specialsettingsforsubdomains']['description'] = 'If yes these custom vHost-settings will be added to all subdomains; if no subdomain-specialsettings are being removed.'; $lng['tasks']['outstanding_tasks'] = 'Outstanding cron-tasks'; -$lng['tasks']['rebuild_webserverconfig'] = 'Rebuilding webserver-configuration'; -$lng['tasks']['adding_customer'] = 'Adding new customer %loginname%'; -$lng['tasks']['rebuild_bindconfig'] = 'Rebuilding bind-configuration'; -$lng['tasks']['creating_ftpdir'] = 'Creating directory for new ftp-user'; -$lng['tasks']['deleting_customerfiles'] = 'Deleting customer-files %loginname%'; +$lng['tasks']['REBUILD_VHOST'] = 'Rebuilding webserver-configuration'; +$lng['tasks']['CREATE_HOME'] = 'Adding new customer %loginname%'; +$lng['tasks']['REBUILD_DNS'] = 'Rebuilding bind-configuration'; +$lng['tasks']['CREATE_FTP'] = 'Creating directory for new ftp-user'; +$lng['tasks']['DELETE_CUSTOMER_FILES'] = 'Deleting customer-files %loginname%'; $lng['tasks']['noneoutstanding'] = 'There are currently no outstanding tasks for Froxlor'; // ADDED IN FROXLOR 0.9.1 @@ -1524,7 +1524,7 @@ $lng['serversettings']['diskquota_enabled'] = 'Kvóta aktivována?'; $lng['serversettings']['diskquota_repquota_path']['description'] = 'Path to repquota'; $lng['serversettings']['diskquota_quotatool_path']['description'] = 'Path to quotatool'; $lng['serversettings']['diskquota_customer_partition']['description'] = 'Partition, on which the customer files are stored'; -$lng['tasks']['diskspace_set_quota'] = 'Set quota on filesystem'; +$lng['tasks']['CREATE_QUOTA'] = 'Set quota on filesystem'; $lng['error']['session_timeout'] = 'Moc nízká hodnota'; $lng['error']['session_timeout_desc'] = 'You should not set the session timeout lower than 1 minute.'; @@ -1554,7 +1554,7 @@ $lng['admin']['speciallogwarning'] = 'WARNING: By changing this setting you will // ADDED IN 0.9.28-svn2 $lng['serversettings']['vmail_maildirname']['title'] = 'Maildir name'; $lng['serversettings']['vmail_maildirname']['description'] = 'Maildir directory into user\'s account. Normally \'Maildir\', in some implementations \'.maildir\', and directly into user\'s directory if left blank.'; -$lng['tasks']['remove_emailacc_files'] = 'Delete customer e-mail data.'; +$lng['tasks']['DELETE_EMAIL_DATA'] = 'Delete customer e-mail data.'; // ADDED IN 0.9.28-svn5 $lng['error']['operationnotpermitted'] = 'Operace nepovolena!'; @@ -1683,8 +1683,8 @@ $lng['panel']['ftpdesc'] = 'FTP description'; $lng['admin']['cronsettings'] = 'Cronjob settings'; $lng['serversettings']['system_cronconfig']['title'] = 'Cron configuration file'; $lng['serversettings']['system_cronconfig']['description'] = 'Path to the cron-service configuration-file. This file will be updated regularly and automatically by froxlor.
Note: Please be sure to use the same filename as for the main froxlor cronjob (default: /etc/cron.d/froxlor)!

If you are using FreeBSD, please specify /etc/crontab here!'; -$lng['tasks']['remove_ftpacc_files'] = 'Delete customer ftp-account data.'; -$lng['tasks']['regenerating_crond'] = 'Rebuilding the cron.d-file'; +$lng['tasks']['DELETE_FTP_DATA'] = 'Delete customer ftp-account data.'; +$lng['tasks']['REBUILD_CRON'] = 'Rebuilding the cron.d-file'; $lng['serversettings']['system_crondreload']['title'] = 'Cron-daemon reload command'; $lng['serversettings']['system_crondreload']['description'] = 'Specify the command to execute in order to reload your systems cron-daemon'; $lng['admin']['integritycheck'] = 'Ověření databáze'; @@ -1889,7 +1889,7 @@ $lng['serversettings']['backupenabled']['title'] = "Povolit zálohy pro zákazn $lng['serversettings']['backupenabled']['description'] = "If activated, the customer will be able to schedule backup jobs (cron-backup) which generates an archive within his docroot (subdirectory chosable by customer)"; $lng['extras']['path_protection_label'] = 'Important'; $lng['extras']['path_protection_info'] = 'We strongly recommend protecting the given path, see "Extras" -> "Directory protection"'; -$lng['tasks']['backup_customerfiles'] = 'Backup job for customer %loginname%'; +$lng['tasks']['CREATE_CUSTOMER_BACKUP'] = 'Backup job for customer %loginname%'; $lng['error']['dns_domain_nodns'] = 'DNS pro tuto doménu je vypnuto'; $lng['error']['dns_content_empty'] = 'No content given'; @@ -2057,8 +2057,8 @@ $lng['panel']['ihave_configured'] = 'I have configured the services'; $lng['panel']['system_is_configured'] = 'System is already set as configured'; $lng['panel']['settings_before_configuration'] = 'Please be sure you adjusted the settings prior to configuring the services here'; $lng['panel']['alternative_cmdline_config'] = 'Alternatively, just run the following command as root-user in your shell to configure the services automatically'; -$lng['tasks']['remove_pdns_domain'] = 'Delete domain %s from PowerDNS database'; -$lng['tasks']['remove_ssl_domain'] = 'Delete ssl files of domain %s'; +$lng['tasks']['DELETE_DOMAIN_PDNS'] = 'Delete domain %domain% from PowerDNS database'; +$lng['tasks']['DELETE_DOMAIN_SSL'] = 'Delete ssl files of domain %domain%'; $lng['admin']['novhostcontainer'] = '

None of the IPs and ports has the "' . $lng['admin']['ipsandports']['create_vhostcontainer'] . '" option enabled, many settings here will not be available'; $lng['serversettings']['errorlog_level']['title'] = 'Error log-level'; $lng['serversettings']['errorlog_level']['description'] = 'Specify the error log level. Default is "warn" for apache-users and "error" for nginx-users.'; diff --git a/lng/dutch.lng.php b/lng/dutch.lng.php index 6198b37a..e38c1202 100644 --- a/lng/dutch.lng.php +++ b/lng/dutch.lng.php @@ -862,11 +862,11 @@ $lng['update']['noupdatesavail'] = 'U gebruikt reeds de meest recente ve $lng['admin']['specialsettingsforsubdomains'] = 'Speciale instellingen toepassen op alle subdomeinen (*.example.com)'; $lng['serversettings']['specialsettingsforsubdomains']['description'] = 'Indien "Ja" zullen deze aangepaste VHost-instellingen worden toegepast op alle subdomeinen.'; $lng['tasks']['outstanding_tasks'] = 'Uitstaande cron-taken'; -$lng['tasks']['rebuild_webserverconfig'] = 'Bezig met opnieuw opbouwen van de configuratie van de webserver'; -$lng['tasks']['adding_customer'] = 'Klant met naam %loginname% wordt toegevoegd'; -$lng['tasks']['rebuild_bindconfig'] = 'Opnieuw opbouwen bind-configuratie'; -$lng['tasks']['creating_ftpdir'] = 'Map aanmaken voor nieuwe FTP-gebruiker'; -$lng['tasks']['deleting_customerfiles'] = 'Verwijderen klantbestanden van %loginname%'; +$lng['tasks']['REBUILD_VHOST'] = 'Bezig met opnieuw opbouwen van de configuratie van de webserver'; +$lng['tasks']['CREATE_HOME'] = 'Klant met naam %loginname% wordt toegevoegd'; +$lng['tasks']['REBUILD_DNS'] = 'Opnieuw opbouwen bind-configuratie'; +$lng['tasks']['CREATE_FTP'] = 'Map aanmaken voor nieuwe FTP-gebruiker'; +$lng['tasks']['DELETE_CUSTOMER_FILES'] = 'Verwijderen klantbestanden van %loginname%'; $lng['tasks']['noneoutstanding'] = 'Er zijn op dit moment geen uitstaande taken voor Froxlor'; // ADDED IN FROXLOR 0.9.1 diff --git a/lng/english.lng.php b/lng/english.lng.php index fdbcac52..0fe92d57 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -957,11 +957,11 @@ $lng['update']['noupdatesavail'] = 'You already have the latest Froxlor $lng['admin']['specialsettingsforsubdomains'] = 'Apply specialsettings to all subdomains (*.example.com)'; $lng['serversettings']['specialsettingsforsubdomains']['description'] = 'If yes these custom vHost-settings will be added to all subdomains; if no subdomain-specialsettings are being removed.'; $lng['tasks']['outstanding_tasks'] = 'Outstanding cron-tasks'; -$lng['tasks']['rebuild_webserverconfig'] = 'Rebuilding webserver-configuration'; -$lng['tasks']['adding_customer'] = 'Adding new customer %loginname%'; -$lng['tasks']['rebuild_bindconfig'] = 'Rebuilding bind-configuration'; -$lng['tasks']['creating_ftpdir'] = 'Creating directory for new ftp-user'; -$lng['tasks']['deleting_customerfiles'] = 'Deleting customer-files %loginname%'; +$lng['tasks']['REBUILD_VHOST'] = 'Rebuilding webserver-configuration'; +$lng['tasks']['CREATE_HOME'] = 'Adding new customer %loginname%'; +$lng['tasks']['REBUILD_DNS'] = 'Rebuilding bind-configuration'; +$lng['tasks']['CREATE_FTP'] = 'Creating directory for new ftp-user'; +$lng['tasks']['DELETE_CUSTOMER_FILES'] = 'Deleting customer-files %loginname%'; $lng['tasks']['noneoutstanding'] = 'There are currently no outstanding tasks for Froxlor'; // ADDED IN FROXLOR 0.9.1 @@ -1527,7 +1527,7 @@ $lng['serversettings']['diskquota_enabled'] = 'Quota activated?'; $lng['serversettings']['diskquota_repquota_path']['description'] = 'Path to repquota'; $lng['serversettings']['diskquota_quotatool_path']['description'] = 'Path to quotatool'; $lng['serversettings']['diskquota_customer_partition']['description'] = 'Partition, on which the customer files are stored'; -$lng['tasks']['diskspace_set_quota'] = 'Set quota on filesystem'; +$lng['tasks']['CREATE_QUOTA'] = 'Set quota on filesystem'; $lng['error']['session_timeout'] = 'Value too low'; $lng['error']['session_timeout_desc'] = 'You should not set the session timeout lower than 1 minute.'; @@ -1557,7 +1557,7 @@ $lng['admin']['speciallogwarning'] = 'WARNING: By changing this setting you will // ADDED IN 0.9.28-svn2 $lng['serversettings']['vmail_maildirname']['title'] = 'Maildir name'; $lng['serversettings']['vmail_maildirname']['description'] = 'Maildir directory into user\'s account. Normally \'Maildir\', in some implementations \'.maildir\', and directly into user\'s directory if left blank.'; -$lng['tasks']['remove_emailacc_files'] = 'Delete customer e-mail data.'; +$lng['tasks']['DELETE_EMAIL_DATA'] = 'Delete customer e-mail data.'; // ADDED IN 0.9.28-svn5 $lng['error']['operationnotpermitted'] = 'Operation not permitted!'; @@ -1688,8 +1688,8 @@ $lng['panel']['ftpdesc'] = 'FTP description'; $lng['admin']['cronsettings'] = 'Cronjob settings'; $lng['serversettings']['system_cronconfig']['title'] = 'Cron configuration file'; $lng['serversettings']['system_cronconfig']['description'] = 'Path to the cron-service configuration-file. This file will be updated regularly and automatically by froxlor.
Note: Please be sure to use the same filename as for the main froxlor cronjob (default: /etc/cron.d/froxlor)!

If you are using FreeBSD, please specify /etc/crontab here!'; -$lng['tasks']['remove_ftpacc_files'] = 'Delete customer ftp-account data.'; -$lng['tasks']['regenerating_crond'] = 'Rebuilding the cron.d-file'; +$lng['tasks']['DELETE_FTP_DATA'] = 'Delete customer ftp-account data.'; +$lng['tasks']['REBUILD_CRON'] = 'Rebuilding the cron.d-file'; $lng['serversettings']['system_crondreload']['title'] = 'Cron-daemon reload command'; $lng['serversettings']['system_crondreload']['description'] = 'Specify the command to execute in order to reload your systems cron-daemon'; $lng['admin']['integritycheck'] = 'Database validation'; @@ -1894,7 +1894,7 @@ $lng['serversettings']['backupenabled']['title'] = "Enable backup for customers" $lng['serversettings']['backupenabled']['description'] = "If activated, the customer will be able to schedule backup jobs (cron-backup) which generates an archive within his docroot (subdirectory chosable by customer)"; $lng['extras']['path_protection_label'] = 'Important'; $lng['extras']['path_protection_info'] = 'We strongly recommend protecting the given path, see "Extras" -> "Directory protection"'; -$lng['tasks']['backup_customerfiles'] = 'Backup job for customer %loginname%'; +$lng['tasks']['CREATE_CUSTOMER_BACKUP'] = 'Backup job for customer %loginname%'; $lng['error']['dns_domain_nodns'] = 'DNS is not enabled for this domain'; $lng['error']['dns_content_empty'] = 'No content given'; @@ -2063,8 +2063,8 @@ $lng['panel']['ihave_configured'] = 'I have configured the services'; $lng['panel']['system_is_configured'] = 'System is already set as configured'; $lng['panel']['settings_before_configuration'] = 'Please be sure you adjusted the settings prior to configuring the services here'; $lng['panel']['alternative_cmdline_config'] = 'Alternatively, just run the following command as root-user in your shell to configure the services automatically'; -$lng['tasks']['remove_pdns_domain'] = 'Delete domain %s from PowerDNS database'; -$lng['tasks']['remove_ssl_domain'] = 'Delete ssl files of domain %s'; +$lng['tasks']['DELETE_DOMAIN_PDNS'] = 'Delete domain %domain% from PowerDNS database'; +$lng['tasks']['DELETE_DOMAIN_SSL'] = 'Delete ssl files of domain %domain%'; $lng['admin']['novhostcontainer'] = '

None of the IPs and ports has the "' . $lng['admin']['ipsandports']['create_vhostcontainer'] . '" option enabled, many settings here will not be available'; $lng['serversettings']['errorlog_level']['title'] = 'Error log-level'; $lng['serversettings']['errorlog_level']['description'] = 'Specify the error log level. Default is "warn" for apache-users and "error" for nginx-users.'; diff --git a/lng/german.lng.php b/lng/german.lng.php index a897f907..7be69d45 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -928,11 +928,11 @@ $lng['update']['noupdatesavail'] = 'Ihre Froxlor-Version ist aktuell.'; $lng['serversettings']['errorlog_level']['title'] = 'Ausführlichkeit des Fehlerprotokolls'; $lng['serversettings']['errorlog_level']['description'] = 'Steuert die Ausführlichkeit des Fehlerprotokolls. Voreinstellung ist "warn" bei Apache und "error" bei Nginx.'; diff --git a/lng/italian.lng.php b/lng/italian.lng.php index 0807cd92..24d937d3 100644 --- a/lng/italian.lng.php +++ b/lng/italian.lng.php @@ -884,11 +884,11 @@ $lng['update']['noupdatesavail'] = 'È già presente l\'ultima versione $lng['admin']['specialsettingsforsubdomains'] = 'Applica le impostazioni speciali a tutti i sottodomini (*.esempio.com)'; $lng['serversettings']['specialsettingsforsubdomains']['description'] = 'Se si queste impostazioni personalizzate dei vhost saranno aggiunte a tutti sottodomini; se no le impostazioni speciali dei sottodomini verranno rimosse.'; $lng['tasks']['outstanding_tasks'] = 'Processi Cron in sospeso'; -$lng['tasks']['rebuild_webserverconfig'] = 'Ricostruzione della configurazione del webserver'; -$lng['tasks']['adding_customer'] = 'Aggiunto il nuovo cliente %loginname%'; -$lng['tasks']['rebuild_bindconfig'] = 'Ricostruzione della configurazione di bind'; -$lng['tasks']['creating_ftpdir'] = 'Creazione delle cartelle per i nuovi utenti ftp'; -$lng['tasks']['deleting_customerfiles'] = 'Eliminazione dei file del cliente %loginname%'; +$lng['tasks']['REBUILD_VHOST'] = 'Ricostruzione della configurazione del webserver'; +$lng['tasks']['CREATE_HOME'] = 'Aggiunto il nuovo cliente %loginname%'; +$lng['tasks']['REBUILD_DNS'] = 'Ricostruzione della configurazione di bind'; +$lng['tasks']['CREATE_FTP'] = 'Creazione delle cartelle per i nuovi utenti ftp'; +$lng['tasks']['DELETE_CUSTOMER_FILES'] = 'Eliminazione dei file del cliente %loginname%'; $lng['tasks']['noneoutstanding'] = 'Attualmente non ci sono processi in sospeso per Froxlor'; // ADDED IN FROXLOR 0.9.1 @@ -1486,7 +1486,7 @@ $lng['serversettings']['diskquota_enabled'] = 'Quota attivita?'; $lng['serversettings']['diskquota_repquota_path']['description'] = 'Percorso a repquota'; $lng['serversettings']['diskquota_quotatool_path']['description'] = 'Percorso al quotatool'; $lng['serversettings']['diskquota_customer_partition']['description'] = 'Partizione, sulla quale sono salvati i dati dei clienti'; -$lng['tasks']['diskspace_set_quota'] = 'Setta quota al filesystem'; +$lng['tasks']['CREATE_QUOTA'] = 'Setta quota al filesystem'; $lng['error']['session_timeout'] = 'Valore troppo basso'; $lng['error']['session_timeout_desc'] = 'Non dovresti settare il timeout della sessione ad un valore minore di 1 minuto.'; $lng['admin']['assignedmax'] = 'Assegnato / Max'; @@ -1506,7 +1506,7 @@ $lng['admin']['delete_statistics'] = 'Elimina Statistiche'; $lng['admin']['speciallogwarning'] = 'AVVISO: Cambiando questa impostazione perderai tutte le vecchie statistiche per questo dominio. Se sei sicuro che vuoi cambiare questo digita "%s" nel campo sottostante e clicca il bottone "elimina".

'; $lng['serversettings']['vmail_maildirname']['title'] = 'nome Maildir'; $lng['serversettings']['vmail_maildirname']['description'] = 'cartella Maildir nell account utente. Normalmente \'Maildir\', in alcune implementazioni \'.maildir\', e direttamente nella cartella utente se lasciato vuoto.'; -$lng['tasks']['remove_emailacc_files'] = 'Elimina i dati di posta elettronica del cliente.'; +$lng['tasks']['DELETE_EMAIL_DATA'] = 'Elimina i dati di posta elettronica del cliente.'; $lng['error']['operationnotpermitted'] = 'Operazione non permessa!'; $lng['error']['featureisdisabled'] = 'Funzionalità %s è disabilitata. Perfavore contatta il tuo fornitore di servizi.'; $lng['serversettings']['catchall_enabled']['title'] = 'Usa Catchall'; @@ -1616,8 +1616,8 @@ $lng['admin']['cronsettings'] = 'Impostazioni Cronjob'; $lng['serversettings']['system_cronconfig']['title'] = 'File di configurazione Cron'; $lng['serversettings']['system_cronconfig']['description'] = 'Percorso al file di configurazione del servizio cron. Questo file verrà aggiornato regolarmente ed automaticamente da froxlor.
Nota: Perfavore sii sicuro di usare lo stesso nome di file come per il cronjob principale di froxlor (predefinito: /etc/cron.d/froxlor)!

Se usi FreeBSD, qui specifica: /etc/crontab!'; -$lng['tasks']['remove_ftpacc_files'] = 'Elimina i dati account-ftp del cliente.'; -$lng['tasks']['regenerating_crond'] = 'Ricostruisci il file cron.d'; +$lng['tasks']['DELETE_FTP_DATA'] = 'Elimina i dati account-ftp del cliente.'; +$lng['tasks']['REBUILD_CRON'] = 'Ricostruisci il file cron.d'; $lng['serversettings']['system_crondreload']['title'] = 'Commando per riavviare il servizio Cron'; $lng['serversettings']['system_crondreload']['description'] = 'Specifica il commando da eseguire per riavviare il servizio cron del tuo sistema'; $lng['admin']['integritycheck'] = 'Validazione Database'; diff --git a/phpunit.xml b/phpunit.xml index 94672a8c..aee8fd5b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -30,6 +30,7 @@ tests/PhpAndFpm tests/Traffic tests/Froxlor + tests/Cron diff --git a/tests/Cron/TaskIdTest.php b/tests/Cron/TaskIdTest.php new file mode 100644 index 00000000..397ffe87 --- /dev/null +++ b/tests/Cron/TaskIdTest.php @@ -0,0 +1,84 @@ + 1, + + 'CREATE_HOME' => 2, + + 'REBUILD_DNS' => 4, + + 'CREATE_FTP' => 5, + + 'DELETE_CUSTOMER_FILES' => 6, + + 'DELETE_EMAIL_DATA' => 7, + + 'DELETE_FTP_DATA' => 8, + + 'CREATE_QUOTA' => 10, + + 'DELETE_DOMAIN_PDNS' => 11, + + 'DELETE_DOMAIN_SSL' => 12, + + 'CREATE_CUSTOMER_BACKUP' => 20, + + 'REBUILD_CRON' => 99, + ); + + public function testValidTaskId() + { + + $isId99Valid = TaskId::isValid(99); + $this->assertTrue($isId99Valid, "Task id 99 must be valid"); + + $isIdStringValid = TaskId::isValid('99'); + $this->assertTrue($isIdStringValid, "String task ids should be valid"); + + $isNegativeValid = TaskId::isValid(-1); + $this->assertFalse($isNegativeValid, "Negative task should be invalid"); + } + + public function testAcceptNewTaskId() + { + $isTESTTASKValid = TaskIdExtended::isValid(10101010); + $this->assertTrue($isTESTTASKValid); + } + + + public function testFixedTaskIdTable() + { + $isTESTTASKValid = TaskIdExtended::isValid(10101010); + $this->assertTrue($isTESTTASKValid); + } + + public function testIdMappingCorrect() { + foreach($this->fixedids as $name => $expected) { + $result = constant("\Froxlor\Cron\TaskId::$name"); + $this->assertEquals( $expected, $result, "Task $name has bad mapping"); + } + } + + public function testConvertToConstant() { + foreach($this->fixedids as $name => $taskid) { + $result = TaskId::convertToConstant($taskid); + $this->assertEquals( $name, $result, "Task $name has bad mapping from id to name"); + } + + $unknownIDResult = TaskId::isValid(10101010); + $this->assertFalse($unknownIDResult); + } +} + +class TaskIdExtended extends TaskId { + const TESTTASK = 10101010; +}