-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update sessions table for accuracy/efficiency
- changed id to case-sensitive ascii (some PHP configurations use letter casing to distinguish different sessions) - added index on modified, for more efficient gc - updated gc to make an index-compatible query
- Loading branch information
1 parent
b51ce67
commit c4c3c32
Showing
4 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
application/migrations/20240713211400_updateSessionsTable.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* Omeka | ||
* | ||
* @copyright Copyright 2007-2020 Roy Rosenzweig Center for History and New Media | ||
* @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3 | ||
*/ | ||
|
||
/** | ||
* Change sessions table to case-sensitive ascii IDs and add index on modified column | ||
* | ||
* @package Omeka\Db\Migration | ||
*/ | ||
class updateSessionsTable extends Omeka_Db_Migration_AbstractMigration | ||
{ | ||
public function up() | ||
{ | ||
$this->db->query("ALTER TABLE {$this->db->Session} MODIFY `id` varchar(128) collate ascii_bin, ADD INDEX `modified` (`modified`)"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
CREATE TABLE IF NOT EXISTS `%PREFIX%sessions` ( | ||
`id` varchar(128), | ||
`id` varchar(128) collate ascii_bin, | ||
`modified` bigint, | ||
`lifetime` int, | ||
`data` blob, | ||
PRIMARY KEY (`id`) | ||
PRIMARY KEY (`id`), | ||
KEY `modified` (`modified`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters