Skip to content
Snippets Groups Projects
Commit faf9d93b authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Add some sanity checks to core module, whether config is good and php version is fine

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@998 44740490-163a-0410-bde0-09ae8108e29a
parent b20b8e46
No related branches found
No related tags found
No related merge requests found
<?php
/**
* Hook to do sanitycheck
*
* @param array &$hookinfo hookinfo
*/
function core_hook_sanitycheck(&$hookinfo) {
assert('is_array($hookinfo)');
assert('array_key_exists("errors", $hookinfo)');
assert('array_key_exists("info", $hookinfo)');
$config = SimpleSAML_Configuration::getInstance();
if($config->getValue('auth.adminpassword', '123') === '123') {
$hookinfo['errors'][] = '[core] Password in config.php is not set properly';
} else {
$hookinfo['info'][] = '[core] Password in config.php is set properly';
}
if($config->getValue('technicalcontact_email', 'na@example.org') === 'na@example.org') {
$hookinfo['errors'][] = '[core] In config.php technicalcontact_email is not set properly';
} else {
$hookinfo['info'][] = '[core] In config.php technicalcontact_email is set properly';
}
if (version_compare(phpversion(), '5.2', '>=')) {
$hookinfo['info'][] = '[core] You are running PHP version ' . phpversion() . '. Great.';
} elseif( version_compare(phpversion(), '5.1.2', '>=')) {
$hookinfo['info'][] = '[core] You are running PHP version ' . phpversion() . '. Its reccomended to upgrade to >= 5.2';
} else {
$hookinfo['errors'][] = '[core] You are running PHP version ' . phpversion() . '. SimpleSAMLphp requires version >= 5.1.2, and reccomends version >= 5.2. Please upgrade!';
}
}
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment