diff --git a/modules/consentSimpleAdmin/hooks/hook_sanitycheck.php b/modules/consentSimpleAdmin/hooks/hook_sanitycheck.php index 117d6022956cf3b9761e09d8a6334061e4d7ee74..1cd997b38431c379a361db16cb05382641997985 100644 --- a/modules/consentSimpleAdmin/hooks/hook_sanitycheck.php +++ b/modules/consentSimpleAdmin/hooks/hook_sanitycheck.php @@ -13,12 +13,18 @@ function consentSimpleAdmin_hook_sanitycheck(&$hookinfo) { // 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.'; - + 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(); }