Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
122149b8
Commit
122149b8
authored
5 years ago
by
Tim van Dijen
Browse files
Options
Downloads
Patches
Plain Diff
Rewrite table upgrade for SQLite
parent
89f2aae4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/saml/lib/SP/LogoutStore.php
+28
-5
28 additions, 5 deletions
modules/saml/lib/SP/LogoutStore.php
with
28 additions
and
5 deletions
modules/saml/lib/SP/LogoutStore.php
+
28
−
5
View file @
122149b8
...
...
@@ -50,17 +50,40 @@ class LogoutStore
switch
(
$store
->
driver
)
{
case
'pgsql'
:
// This does not affect the NOT NULL constraint
$query
=
'ALTER TABLE '
.
$store
->
prefix
.
'_saml_LogoutStore ALTER COLUMN _authSource TYPE VARCHAR(255)'
;
$update
=
[
'ALTER TABLE '
.
$store
->
prefix
.
'_saml_LogoutStore ALTER COLUMN _authSource TYPE VARCHAR(255)'
];
break
;
case
'sqlite'
:
/**
* TableVersion 2 increased the column size to 255 which is the maximum length of a FQDN
* Because SQLite does not support field alterations, the approach is to:
* Create a new table without the proper column size
* Copy the current data to the new table
* Drop the old table
* Rename the new table correctly
* Read the index
*/
$update
=
[
'CREATE TABLE '
.
$store
->
prefix
.
'_saml_LogoutStore_new (_authSource VARCHAR(255) NOT NULL,'
.
'_nameId VARCHAR(40) NOT NULL, _sessionIndex VARCHAR(50) NOT NULL, _expire TIMESTAMP NOT NULL,'
.
'_sessionId VARCHAR(50) NOT NULL, UNIQUE (_authSource, _nameID, _sessionIndex))'
,
'INSERT INTO '
.
$store
->
prefix
.
'_saml_LogoutStore_new SELECT * FROM '
.
$store
->
prefix
.
'_saml_LogoutStore'
,
'DROP TABLE '
.
$store
->
prefix
.
'_saml_LogoutStore'
,
'ALTER TABLE '
.
$store
->
prefix
.
'_saml_LogoutStore_new RENAME TO '
.
$store
->
prefix
.
'_saml_LogoutStore'
,
'CREATE INDEX '
.
$store
->
prefix
.
'_saml_LogoutStore_expire ON '
.
$store
->
prefix
.
'_saml_LogoutStore (_expire)'
,
'CREATE INDEX '
.
$store
->
prefix
.
'_saml_LogoutStore_nameId ON '
.
$store
->
prefix
.
'_saml_LogoutStore (_authSource, _nameId)'
];
break
;
default
:
$
query
=
'ALTER TABLE '
.
$store
->
prefix
.
'_saml_LogoutStore MODIFY _authSource VARCHAR(255) NOT NULL'
;
$
update
=
[
'ALTER TABLE '
.
$store
->
prefix
.
'_saml_LogoutStore MODIFY _authSource VARCHAR(255) NOT NULL'
]
;
break
;
}
try
{
$store
->
pdo
->
exec
(
$query
);
foreach
(
$update
as
$query
)
{
$store
->
pdo
->
exec
(
$query
);
}
}
catch
(
\Exception
$e
)
{
Logger
::
warning
(
'Database error: '
.
var_export
(
$store
->
pdo
->
errorInfo
(),
true
));
return
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment