ICT:Timeout issues
Administrator Procedures: Extending Session Timeouts
As a Sysop, you can adjust the server configuration to better support long-term historical research. These changes must be made in the LocalSettings.php file on the server.
1. Increasing the Idle Session Window
By default, MediaWiki ends a session after 1 hour of inactivity. For researchers who spend hours drafting, this should be increased to 24 hours.
Add or update this line:
$wgObjectCacheSessionExpiry = 86400; // Time in seconds (24 hours)
2. Ensuring Persistent Logins
To prevent users from being logged out when they close their browser, ensure the cookie expiration is set to a long duration (default is 30 days).
$wgCookieExpiration = 2592000; // 30 days
3. Forcing "Keep Me Logged In" by Default
To protect users who forget to check the "Keep me logged in" box, you can force it to be checked by default using this hook:
$wgHooks['AuthChangeFormFields'][] = function ( $requests, $fieldInfo, &$formDescriptor, $action ) {
if ( isset( $formDescriptor['rememberMe'] ) ) {
$formDescriptor['rememberMe']['default'] = true;
}
return true;
};
4. PHP-Level Configuration (Server Admin)
If users are still being logged out prematurely, the underlying PHP configuration may be cleaning up sessions too early. Ensure your php.ini or LocalSettings matches the MediaWiki timeout:
ini_set( 'session.gc_maxlifetime', 86400 );
5. Verifying Edit Recovery
Ensure the built-in auto-save feature is active. In MediaWiki 1.43, this is on by default, but it can be explicitly set:
$wgEnableEditRecovery = true;
Note: After changing LocalSettings.php, no restart is usually required, but users may need to log out and log back in for new session lengths to take effect.