Skip to content
Snippets Groups Projects
Commit 3a20131c authored by Thijs Kinkhorst's avatar Thijs Kinkhorst
Browse files

sanitycheck: formatting changes psr-2, no functional changes

parent 790639cc
No related branches found
No related tags found
No related merge requests found
......@@ -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',
);
......@@ -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();
}
}
......@@ -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'),
);
}
......@@ -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'),
);
}
......@@ -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 :)';
}
<?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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment