diff --git a/modules/sanitycheck/config-templates/config-sanitycheck.php b/modules/sanitycheck/config-templates/config-sanitycheck.php index 748a21bfb3df15dd3833110fcf6964674687a687..ac40a0f48e8a5e1da222ce943bb5fd3deee5fcae 100644 --- a/modules/sanitycheck/config-templates/config-sanitycheck.php +++ b/modules/sanitycheck/config-templates/config-sanitycheck.php @@ -5,12 +5,12 @@ $config = array ( - /* - * Do you want to generate statistics using the cron module? If so, specify which cron tag to use. - * Examples: daily, weekly - * To not run statistics in cron, set value to - * 'cron_tag' => NULL, - */ - 'cron_tag' => 'hourly', + /* + * Do you want to generate statistics using the cron module? If so, specify which cron tag to use. + * Examples: daily, weekly + * To not run statistics in cron, set value to + * 'cron_tag' => null, + */ + 'cron_tag' => 'hourly', ); diff --git a/modules/sanitycheck/hooks/hook_cron.php b/modules/sanitycheck/hooks/hook_cron.php index 37c020e50d7e4ca79a5596dce3110ff53941c392..44abd493601c892b98b868b177fbc3df56378ef2 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 27d55abbc323a92475ae93d5935ffbb32836461a..b40e657fa1b10b4b44581ea00d98404a88b6ecc3 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 c18672711b4affdc27d4683e1904f487c2f0a763..679ac17e37a0d5eecabbc4c79f8e18f8c034b703 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 c15f1c68f503034811d8d8205464a0f633e20cc9..867eab503a9fb8bf90d1e5ab0e50298ffb0f6f24 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 :)'; } diff --git a/modules/sanitycheck/www/index.php b/modules/sanitycheck/www/index.php index 708348b0126b1b968421c146747d2bcece3e4e5a..e365db28d57a98282e3abe0528d0c0d8604fa42c 100644 --- a/modules/sanitycheck/www/index.php +++ b/modules/sanitycheck/www/index.php @@ -1,25 +1,23 @@ <?php - $config = SimpleSAML_Configuration::getInstance(); $info = array(); $errors = array(); $hookinfo = array( - 'info' => &$info, - 'errors' => &$errors, + 'info' => &$info, + 'errors' => &$errors, ); SimpleSAML\Module::callHooks('sanitycheck', $hookinfo); - if (isset($_REQUEST['output']) && $_REQUEST['output'] == 'text') { - - if (count($errors) === 0) { - echo 'OK'; - } else { - echo 'FAIL'; - } - exit; + + if (count($errors) === 0) { + echo 'OK'; + } else { + echo 'FAIL'; + } + exit; } $t = new SimpleSAML_XHTML_Template($config, 'sanitycheck:check.tpl.php');