Skip to content
Snippets Groups Projects
Commit 59808793 authored by Olav Morken's avatar Olav Morken
Browse files

consent: Add selftest()-function to database backend.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3308 44740490-163a-0410-bde0-09ae8108e29a
parent be612641
No related branches found
No related tags found
No related merge requests found
...@@ -511,4 +511,24 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store ...@@ -511,4 +511,24 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store
return $error[0] . ' - ' . $error[2] . ' (' . $error[1] . ')'; return $error[0] . ' - ' . $error[2] . ' (' . $error[1] . ')';
} }
/**
* A quick selftest of the consent database.
*
* @return boolen TRUE if OK, FALSE if not. Will throw an exception on connection errors.
*/
public function selftest()
{
$st = $this->_execute(
'SELECT * FROM ' . $this->_table . ' WHERE hashed_user_id = ? AND service_id = ? AND attribute = ?',
array('test', 'test', 'test')
);
if ($st === FALSE) {
/* Normally, the test will fail by an exception, so we won't reach this code. */
return FALSE;
}
return TRUE;
}
} }
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