Skip to content

Commit

Permalink
Enable session GC on servers that disable it
Browse files Browse the repository at this point in the history
These usually use a cron or something similar to clean out sessions
outside of PHP's system, but they won't be able to clean Omeka's
DB-based sessions.
  • Loading branch information
zerocrates committed Aug 20, 2024
1 parent ad243cc commit 8b4406d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions application/libraries/Omeka/Application/Resource/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ private function _getSessionConfig()
unset($sessionConfig['saveHandler']);
}

// Override servers that disable GC, unless allowNoGc is set in config
if (empty($sessionConfig['allowNoGc']) && ini_get('session.gc_probability') == 0) {
$sessionConfig['gc_probability'] = 1;
$sessionConfig['gc_divisor'] = 1000;
}
unset($sessionConfig['allowNoGc']);

return $sessionConfig;
}

Expand Down

0 comments on commit 8b4406d

Please sign in to comment.