diff options
Diffstat (limited to 'modules/sanitycheck/hooks')
-rw-r--r-- | modules/sanitycheck/hooks/hook_cron.php | 59 | ||||
-rw-r--r-- | modules/sanitycheck/hooks/hook_frontpage.php | 18 | ||||
-rw-r--r-- | modules/sanitycheck/hooks/hook_moduleinfo.php | 20 | ||||
-rw-r--r-- | modules/sanitycheck/hooks/hook_sanitycheck.php | 12 |
4 files changed, 54 insertions, 55 deletions
diff --git a/modules/sanitycheck/hooks/hook_cron.php b/modules/sanitycheck/hooks/hook_cron.php index 37c020e..44abd49 100644 --- a/modules/sanitycheck/hooks/hook_cron.php +++ b/modules/sanitycheck/hooks/hook_cron.php @@ -4,39 +4,38 @@ * * @param array &$croninfo Output */ -function sanitycheck_hook_cron(&$croninfo) { - assert('is_array($croninfo)'); - assert('array_key_exists("summary", $croninfo)'); - assert('array_key_exists("tag", $croninfo)'); +function sanitycheck_hook_cron(&$croninfo) +{ + assert('is_array($croninfo)'); + assert('array_key_exists("summary", $croninfo)'); + assert('array_key_exists("tag", $croninfo)'); - SimpleSAML\Logger::info('cron [sanitycheck]: Running cron in cron tag [' . $croninfo['tag'] . '] '); + SimpleSAML\Logger::info('cron [sanitycheck]: Running cron in cron tag [' . $croninfo['tag'] . '] '); - try { - - $sconfig = SimpleSAML_Configuration::getOptionalConfig('config-sanitycheck.php'); + try { + $sconfig = SimpleSAML_Configuration::getOptionalConfig('config-sanitycheck.php'); - $cronTag = $sconfig->getString('cron_tag', NULL); - if ($cronTag === NULL || $cronTag !== $croninfo['tag']) { - return; - } + $cronTag = $sconfig->getString('cron_tag', null); + if ($cronTag === null || $cronTag !== $croninfo['tag']) { + return; + } - $info = array(); - $errors = array(); - $hookinfo = array( - 'info' => &$info, - 'errors' => &$errors, - ); - - SimpleSAML\Module::callHooks('sanitycheck', $hookinfo); - - if (count($errors) > 0) { - foreach ($errors AS $err) { - $croninfo['summary'][] = 'Sanitycheck error: ' . $err; - } - } - - } catch (Exception $e) { - $croninfo['summary'][] = 'Error executing sanity check: ' . $e->getMessage(); - } + $info = array(); + $errors = array(); + $hookinfo = array( + 'info' => &$info, + 'errors' => &$errors, + ); + SimpleSAML\Module::callHooks('sanitycheck', $hookinfo); + + if (count($errors) > 0) { + foreach ($errors AS $err) { + $croninfo['summary'][] = 'Sanitycheck error: ' . $err; + } + } + + } catch (Exception $e) { + $croninfo['summary'][] = 'Error executing sanity check: ' . $e->getMessage(); + } } diff --git a/modules/sanitycheck/hooks/hook_frontpage.php b/modules/sanitycheck/hooks/hook_frontpage.php index 27d55ab..b40e657 100644 --- a/modules/sanitycheck/hooks/hook_frontpage.php +++ b/modules/sanitycheck/hooks/hook_frontpage.php @@ -4,14 +4,14 @@ * * @param array &$links The links on the frontpage, split into sections. */ -function sanitycheck_hook_frontpage(&$links) { - assert('is_array($links)'); - assert('array_key_exists("links", $links)'); - - $links['config']['santitycheck'] = array( - 'href' => SimpleSAML\Module::getModuleURL('sanitycheck/index.php'), - 'text' => array('en' => 'Sanity check of your SimpleSAMLphp setup'), - 'shorttext' => array('en' => 'SanityCheck'), - ); +function sanitycheck_hook_frontpage(&$links) +{ + assert('is_array($links)'); + assert('array_key_exists("links", $links)'); + $links['config']['santitycheck'] = array( + 'href' => SimpleSAML\Module::getModuleURL('sanitycheck/index.php'), + 'text' => array('en' => 'Sanity check of your SimpleSAMLphp setup'), + 'shorttext' => array('en' => 'SanityCheck'), + ); } diff --git a/modules/sanitycheck/hooks/hook_moduleinfo.php b/modules/sanitycheck/hooks/hook_moduleinfo.php index c186727..679ac17 100644 --- a/modules/sanitycheck/hooks/hook_moduleinfo.php +++ b/modules/sanitycheck/hooks/hook_moduleinfo.php @@ -4,16 +4,16 @@ * * @param array &$moduleinfo The links on the frontpage, split into sections. */ -function sanitycheck_hook_moduleinfo(&$moduleinfo) { - assert('is_array($moduleinfo)'); - assert('array_key_exists("info", $moduleinfo)'); +function sanitycheck_hook_moduleinfo(&$moduleinfo) +{ + assert('is_array($moduleinfo)'); + assert('array_key_exists("info", $moduleinfo)'); - $moduleinfo['info']['sanitycheck'] = array( - 'name' => array('en' => 'Sanity check'), - 'description' => array('en' => 'This module adds functionality for other modules to provide santity checks.'), - - 'dependencies' => array('core'), - 'uses' => array('cron'), - ); + $moduleinfo['info']['sanitycheck'] = array( + 'name' => array('en' => 'Sanity check'), + 'description' => array('en' => 'This module adds functionality for other modules to provide santity checks.'), + 'dependencies' => array('core'), + 'uses' => array('cron'), + ); } diff --git a/modules/sanitycheck/hooks/hook_sanitycheck.php b/modules/sanitycheck/hooks/hook_sanitycheck.php index c15f1c6..867eab5 100644 --- a/modules/sanitycheck/hooks/hook_sanitycheck.php +++ b/modules/sanitycheck/hooks/hook_sanitycheck.php @@ -4,11 +4,11 @@ * * @param array &$hookinfo hookinfo */ -function sanitycheck_hook_sanitycheck(&$hookinfo) { - assert('is_array($hookinfo)'); - assert('array_key_exists("errors", $hookinfo)'); - assert('array_key_exists("info", $hookinfo)'); +function sanitycheck_hook_sanitycheck(&$hookinfo) +{ + assert('is_array($hookinfo)'); + assert('array_key_exists("errors", $hookinfo)'); + assert('array_key_exists("info", $hookinfo)'); - $hookinfo['info'][] = '[sanitycheck] At least the sanity check itself is working :)'; - + $hookinfo['info'][] = '[sanitycheck] At least the sanity check itself is working :)'; } |