Skip to content
Snippets Groups Projects
Unverified Commit 86aa37ba authored by Tim van Dijen's avatar Tim van Dijen Committed by GitHub
Browse files

consent: remove unused method

parent da70f973
No related branches found
No related tags found
No related merge requests found
...@@ -45,9 +45,9 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store ...@@ -45,9 +45,9 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store
/** /**
* The timeout of the database connection. * The timeout of the database connection.
* *
* @var int|NULL * @var int|null
*/ */
private $_timeout = NULL; private $_timeout = null;
/** /**
* Database handle. * Database handle.
...@@ -70,7 +70,6 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store ...@@ -70,7 +70,6 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store
{ {
parent::__construct($config); parent::__construct($config);
if (!array_key_exists('dsn', $config)) { if (!array_key_exists('dsn', $config)) {
throw new Exception('consent:Database - Missing required option \'dsn\'.'); throw new Exception('consent:Database - Missing required option \'dsn\'.');
} }
...@@ -374,14 +373,13 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store ...@@ -374,14 +373,13 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store
* ' services: Total number of services that has been given consent to * ' services: Total number of services that has been given consent to
* *
* @return array Array containing the statistics * @return array Array containing the statistics
* @TODO Change fixed table name to config option
*/ */
public function getStatistics() public function getStatistics()
{ {
$ret = array(); $ret = array();
// Get total number of consents // Get total number of consents
$st = $this->_execute('SELECT COUNT(*) AS no FROM consent', array()); $st = $this->_execute('SELECT COUNT(*) AS no FROM '.$this->_table, array());
if ($st === false) { if ($st === false) {
return array(); return array();
...@@ -394,7 +392,7 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store ...@@ -394,7 +392,7 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store
// Get total number of users that has given consent // Get total number of users that has given consent
$st = $this->_execute( $st = $this->_execute(
'SELECT COUNT(*) AS no ' . 'SELECT COUNT(*) AS no ' .
'FROM (SELECT DISTINCT hashed_user_id FROM consent ) AS foo', 'FROM (SELECT DISTINCT hashed_user_id FROM '.$this->_table.' ) AS foo',
array() array()
); );
...@@ -408,7 +406,7 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store ...@@ -408,7 +406,7 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store
// Get total number of services that has been given consent to // Get total number of services that has been given consent to
$st = $this->_execute( $st = $this->_execute(
'SELECT COUNT(*) AS no FROM (SELECT DISTINCT service_id FROM consent) AS foo', 'SELECT COUNT(*) AS no FROM (SELECT DISTINCT service_id FROM '.$this->_table.') AS foo',
array() array()
); );
...@@ -424,36 +422,6 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store ...@@ -424,36 +422,6 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store
} }
/**
* Create consent table.
*
* This function creates the table with consent data.
*
* @return True if successful, false if not.
*
* @TODO Remove this function since it is not used
*/
private function _createTable()
{
$db = $this->_getDB();
if ($db === false) {
return false;
}
$res = $this->db->exec(
'CREATE TABLE ' . $this->_table . ' (consent_date TIMESTAMP NOT null, usage_date TIMESTAMP NOT null,' .
'hashed_user_id VARCHAR(80) NOT null, service_id VARCHAR(255) NOT null, attribute VARCHAR(80) NOT null,' .
'UNIQUE (hashed_user_id, service_id)'
);
if ($res === false) {
SimpleSAML\Logger::error('consent:Database - Failed to create table \'' . $this->_table . '\'.');
return false;
}
return true;
}
/** /**
* Get database handle. * Get database handle.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment