From dda2b4745ef216566bf6acd6cfad9dc07770fdfb Mon Sep 17 00:00:00 2001 From: Marius Burkard Date: Wed, 26 Jun 2019 15:36:57 +0200 Subject: [PATCH] Renewal of letsencrypt does not restart/reload nginx, fixes #5033 --- server/cron.php | 5 ++++- server/lib/classes/modules.inc.php | 21 +++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/server/cron.php b/server/cron.php index 6f74bd3570..cd8f08ef0a 100644 --- a/server/cron.php +++ b/server/cron.php @@ -69,9 +69,10 @@ $conf['server_id'] = intval($conf['server_id']); // Load required base-classes -$app->uses('ini_parser,file,services,getconf,system,cron,functions'); +$app->uses('modules,ini_parser,file,services,getconf,system,cron,functions'); $app->load('libdatetime,cronjob'); +$app->modules->loadModules('web'); // read all cron jobs $path = SCRIPT_PATH . '/lib/classes/cron.d'; @@ -114,6 +115,8 @@ foreach($files as $f) { } unset($files); +$app->services->processDelayedActions(); + // Remove lock @unlink($conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock'); $app->log('Remove Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_cron_lock', LOGLEVEL_DEBUG); diff --git a/server/lib/classes/modules.inc.php b/server/lib/classes/modules.inc.php index aa95d473b2..3fd788d0a9 100644 --- a/server/lib/classes/modules.inc.php +++ b/server/lib/classes/modules.inc.php @@ -37,18 +37,32 @@ class modules { /* This function is called to load the modules from the mods-enabled or the mods-core folder */ - function loadModules($type) { + function loadModules($type = 'all') { global $app, $conf; $subPath = 'mods-enabled'; - if ($type == 'core') $subPath = 'mods-core'; + if ($type == 'core') { + $subPath = 'mods-core'; + } elseif ($type == 'all') { + $type = ''; + } elseif (!preg_match('/^\w+$/', $type)) { + $app->log('Invalid loadModules type ' . $type, LOGLEVEL_ERROR); + return false; + } else { + $subPath = 'mods-available'; + } + $loaded = false; $modules_dir = $conf['rootpath'].$conf['fs_div'].$subPath.$conf['fs_div']; if (is_dir($modules_dir)) { if ($dh = opendir($modules_dir)) { while (($file = readdir($dh)) !== false) { if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') { $module_name = substr($file, 0, -8); + if($type && $type !== 'core' && $type != $module_name) { + continue; + } + $loaded = true; include_once $modules_dir.$file; if($this->debug) $app->log('Loading Module: '.$module_name, LOGLEVEL_DEBUG); $app->loaded_modules[$module_name] = new $module_name; @@ -60,6 +74,9 @@ class modules { $app->log('Modules directory missing: '.$modules_dir, LOGLEVEL_ERROR); } + if($type && $type !== 'core' && $loaded === false) { + $app->log('Module ' . $type . ' not found.', LOGLEVEL_ERROR); + } } /* -- GitLab