PHP Classes

File: web/SSO/modules/consentSimpleAdmin/hooks/hook_sanitycheck.php

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/SSO/modules/consentSimpleAdmin/hooks/hook_sanitycheck.php   Download  
File: web/SSO/modules/consentSimpleAdmin/hooks/hook_sanitycheck.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Raptor 2
Framework that takes routes from annotations
Author: By
Last change:
Date: 8 years ago
Size: 950 bytes
 

Contents

Class file image Download
<?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 {
       
$consentconfig = SimpleSAML_Configuration::getConfig('module_consentSimpleAdmin.php');
   
       
// Parse consent config
       
$consent_storage = sspmod_consent_Store::parseStoreConfig($consentconfig->getValue('store'));

        if (!
is_callable(array($consent_storage, 'selftest'))) {
           
/* Doesn't support a selftest. */
           
return;
        }
       
$testres = $consent_storage->selftest();
        if (
$testres) {
           
$hookinfo['info'][] = '[consentSimpleAdmin] Consent Storage selftest OK.';
        } else {
           
$hookinfo['errors'][] = '[consentSimpleAdmin] Consent Storage selftest failed.';
        }

    } catch (
Exception $e) {
       
$hookinfo['errors'][] = '[consentSimpleAdmin] Error connecting to storage: ' . $e->getMessage();
    }
   
}
?>