From 3c38a5b75dd7e1f245eae09975dba25eb4bb35b8 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Mon, 4 Feb 2019 09:30:19 +0100 Subject: [PATCH] Fixes for modules/cron --- modules/cron/hooks/hook_configpage.php | 3 ++- modules/cron/hooks/hook_cron.php | 3 ++- modules/cron/hooks/hook_frontpage.php | 3 ++- modules/cron/lib/Cron.php | 9 ++++++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/modules/cron/hooks/hook_configpage.php b/modules/cron/hooks/hook_configpage.php index dc3c8400b..136888a00 100644 --- a/modules/cron/hooks/hook_configpage.php +++ b/modules/cron/hooks/hook_configpage.php @@ -1,10 +1,11 @@ <?php + /** * Hook to add the cron module to the config page. * * @param \SimpleSAML\XHTML\Template &$template The template that we should alter in this hook. + * @return void */ - function cron_hook_configpage(\SimpleSAML\XHTML\Template &$template) { $template->data['links']['cron'] = [ diff --git a/modules/cron/hooks/hook_cron.php b/modules/cron/hooks/hook_cron.php index 61812906a..eb4718275 100644 --- a/modules/cron/hooks/hook_cron.php +++ b/modules/cron/hooks/hook_cron.php @@ -1,10 +1,11 @@ <?php + /** * Hook to run a cron job. * * @param array &$croninfo Output + * @return void */ - function cron_hook_cron(&$croninfo) { assert(is_array($croninfo)); diff --git a/modules/cron/hooks/hook_frontpage.php b/modules/cron/hooks/hook_frontpage.php index 73fcd215b..9a0401a27 100644 --- a/modules/cron/hooks/hook_frontpage.php +++ b/modules/cron/hooks/hook_frontpage.php @@ -1,10 +1,11 @@ <?php + /** * Hook to add the modinfo module to the frontpage. * * @param array &$links The links on the frontpage, split into sections. + * @return void */ - function cron_hook_frontpage(&$links) { assert(is_array($links)); diff --git a/modules/cron/lib/Cron.php b/modules/cron/lib/Cron.php index f8bda653b..5396a2cfe 100644 --- a/modules/cron/lib/Cron.php +++ b/modules/cron/lib/Cron.php @@ -1,6 +1,6 @@ <?php -namespace SimpleSAML\Module\cron; +namespace SimpleSAML\Module\cron; /** * Handles interactions with SSP's cron system/hooks. @@ -27,13 +27,12 @@ class Cron /** * Invoke the cron hook for the given tag - * @param $tag string The tag to use. Must be valid in the cronConfig + * @param string $tag The tag to use. Must be valid in the cronConfig * @return array the tag, and summary information from the run. * @throws Exception If an invalid tag specified */ public function runTag($tag) { - if (!$this->isValidTag($tag)) { throw new \Exception("Invalid cron tag '$tag''"); } @@ -53,6 +52,10 @@ class Cron return $croninfo; } + /** + * @param string $tag + * @return bool + */ public function isValidTag($tag) { if (!is_null($this->cronconfig->getValue('allowed_tags'))) { -- GitLab