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

Update LogoutStore.php (#1120)

parent 3e708687
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,24 @@ class LogoutStore ...@@ -26,7 +26,24 @@ class LogoutStore
private static function createLogoutTable(Store\SQL $store) private static function createLogoutTable(Store\SQL $store)
{ {
$tableVer = $store->getTableVersion('saml_LogoutStore'); $tableVer = $store->getTableVersion('saml_LogoutStore');
if ($tableVer === 2) { if ($tableVer === 3) {
return;
} elseif ($tableVer === 2) {
// Drop old indexes
$query = 'ALTER TABLE '.$store->prefix.'_saml_LogoutStore DROP INDEX '.$store->prefix.'_saml_LogoutStore_nameId';
$store->pdo->exec($query);
$query = 'ALTER TABLE '.$store->prefix.'_saml_LogoutStore DROP INDEX _authSource';
$store->pdo->exec($query);
// Create new indexes
$query = 'CREATE INDEX '.$store->prefix.'_saml_LogoutStore_nameId ON ';
$query .= $store->prefix.'_saml_LogoutStore (_authSource(191), _nameId)';
$store->pdo->exec($query);
$query = 'ALTER TABLE '.$store->prefix.'_saml_LogoutStore ADD UNIQUE KEY (_authSource(191), _nameID, _sessionIndex)';
$store->pdo->exec($query);
$store->setTableVersion('saml_LogoutStore', 3);
return; return;
} elseif ($tableVer === 1) { } elseif ($tableVer === 1) {
// TableVersion 2 increased the column size to 255 which is the maximum length of a FQDN // TableVersion 2 increased the column size to 255 which is the maximum length of a FQDN
...@@ -58,7 +75,7 @@ class LogoutStore ...@@ -58,7 +75,7 @@ class LogoutStore
_sessionIndex VARCHAR(50) NOT NULL, _sessionIndex VARCHAR(50) NOT NULL,
_expire TIMESTAMP NOT NULL, _expire TIMESTAMP NOT NULL,
_sessionId VARCHAR(50) NOT NULL, _sessionId VARCHAR(50) NOT NULL,
UNIQUE (_authSource, _nameID, _sessionIndex) UNIQUE (_authSource(191), _nameID, _sessionIndex)
)'; )';
$store->pdo->exec($query); $store->pdo->exec($query);
...@@ -67,7 +84,7 @@ class LogoutStore ...@@ -67,7 +84,7 @@ class LogoutStore
$store->pdo->exec($query); $store->pdo->exec($query);
$query = 'CREATE INDEX '.$store->prefix.'_saml_LogoutStore_nameId ON '; $query = 'CREATE INDEX '.$store->prefix.'_saml_LogoutStore_nameId ON ';
$query .= $store->prefix.'_saml_LogoutStore (_authSource, _nameId)'; $query .= $store->prefix.'_saml_LogoutStore (_authSource(191), _nameId)';
$store->pdo->exec($query); $store->pdo->exec($query);
$store->setTableVersion('saml_LogoutStore', 2); $store->setTableVersion('saml_LogoutStore', 2);
......
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