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

Add sanity check to check if database connection is OK.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1281 44740490-163a-0410-bde0-09ae8108e29a
parent c2d7e1d0
No related branches found
No related tags found
No related merge requests found
<?php
/**
*
* @param array &$hookinfo hookinfo
*/
function consentSimpleAdmin_hook_sanitycheck(&$hookinfo) {
assert('is_array($hookinfo)');
assert('array_key_exists("errors", $hookinfo)');
assert('array_key_exists("info", $hookinfo)');
try {
$config = SimpleSAML_Configuration::getInstance();
$consentconfig = $config->copyFromBase('consentSimpleAdminConfig', 'module_consentSimpleAdmin.php');
// Parse consent config
$consent_storage = sspmod_consent_Store::parseStoreConfig($consentconfig->getValue('store'));
// Get all consents for user
$stats = $consent_storage->getStatistics();
$hookinfo['info'][] = '[consentSimpleAdmin] Consent Storage connection OK.';
} catch (Exception $e) {
$hookinfo['errors'][] = '[consentSimpleAdmin] Error connecting to storage: ' . $e->getMessage();
}
}
?>
\ 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