diff options
Diffstat (limited to 'apis')
-rw-r--r-- | apis/clientlog.inc.php | 2 | ||||
-rw-r--r-- | apis/cron.inc.php | 19 | ||||
-rw-r--r-- | apis/getconfig.inc.php | 2 |
3 files changed, 10 insertions, 13 deletions
diff --git a/apis/clientlog.inc.php b/apis/clientlog.inc.php index b68e4632..29838dfc 100644 --- a/apis/clientlog.inc.php +++ b/apis/clientlog.inc.php @@ -9,7 +9,7 @@ if (empty($_POST['type'])) die('Missing options.'); $type = mb_strtolower($_POST['type']); -if ($type{0} === '~' || $type{0} === '.') { +if ($type[0] === '~' || $type[0] === '.') { if (Module::isAvailable('statistics')) { require 'modules/statistics/api.inc.php'; } diff --git a/apis/cron.inc.php b/apis/cron.inc.php index d00c179c..03b6201f 100644 --- a/apis/cron.inc.php +++ b/apis/cron.inc.php @@ -14,15 +14,15 @@ define('CRON_KEY_STATUS', 'cron.key.status'); define('CRON_KEY_BLOCKED', 'cron.key.blocked'); // Crash report mode - used by system crontab entry -if (($report = Request::get('crashreport', false, 'string'))) { +if (($report = Request::get('crashreport', false, 'string')) !== false) { $list = Property::getList(CRON_KEY_STATUS); if (empty($list)) { error_log('Cron crash report triggered but no cronjob marked active.'); exit(0); } $str = array(); - foreach ($list as $item) { - Property::removeFromList(CRON_KEY_STATUS, $item); + foreach ($list as $subkey => $item) { + Property::removeFromListByKey(CRON_KEY_STATUS, $subkey); $entry = explode('|', $item, 2); if (count($entry) !== 2) continue; @@ -35,7 +35,7 @@ if (($report = Request::get('crashreport', false, 'string'))) { if (empty($str)) { $str = 'an unknown module'; } - $message = 'Conjob failed. No reply by ' . implode(', ', $str); + $message = 'Cronjob failed. No reply by ' . implode(', ', $str); $details = ''; if (is_readable($report)) { $details = file_get_contents($report); @@ -62,10 +62,7 @@ function getJobStatus($id) } // Hooks by other modules -/** - * @param Hook $hook - */ -function handleModule($hook) +function handleModule(Hook $hook): void { global $cron_log_text; $cron_log_text = ''; @@ -91,13 +88,13 @@ foreach (Hook::load('cron') as $hook) { $runtime = (time() - $status['start']); if ($runtime < 0) { // Clock skew - Property::removeFromList(CRON_KEY_STATUS, $status['string']); + Property::removeFromListByVal(CRON_KEY_STATUS, $status['string']); } elseif ($runtime < 900) { // Allow up to 15 minutes for a job to complete before we complain... continue; } else { // Consider job crashed - Property::removeFromList(CRON_KEY_STATUS, $status['string']); + Property::removeFromListByVal(CRON_KEY_STATUS, $status['string']); EventLog::failure('Cronjob for module ' . $hook->moduleId . ' seems to be stuck or has crashed.'); continue; } @@ -114,5 +111,5 @@ foreach (Hook::load('cron') as $hook) { // Logging EventLog::failure('Cronjob for module ' . $hook->moduleId . ' has crashed. Check the php or web server error log.', $e->getMessage()); } - Property::removeFromList(CRON_KEY_STATUS, $value); + Property::removeFromListByVal(CRON_KEY_STATUS, $value); } diff --git a/apis/getconfig.inc.php b/apis/getconfig.inc.php index 3fe05ed1..a5d5254d 100644 --- a/apis/getconfig.inc.php +++ b/apis/getconfig.inc.php @@ -6,7 +6,7 @@ */ if (!Module::isAvailable('baseconfig')) { - Util::traceError('Module baseconfig not available'); + ErrorHandler::traceError('Module baseconfig not available'); } require 'modules/baseconfig/api.inc.php';
\ No newline at end of file |