mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2040 from sminnee/session-timeout-fixes
Session timeout fixes
This commit is contained in:
commit
9511d72aa9
@ -152,6 +152,15 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
*/
|
*/
|
||||||
private static $extra_requirements_themedCss = array();
|
private static $extra_requirements_themedCss = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, call a keepalive ping every 5 minutes from the CMS interface,
|
||||||
|
* to ensure that the session never dies.
|
||||||
|
*
|
||||||
|
* @config
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private static $session_keepalive_ping = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PjaxResponseNegotiator
|
* @var PjaxResponseNegotiator
|
||||||
*/
|
*/
|
||||||
@ -327,28 +336,30 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
|
|
||||||
HTMLEditorField::include_js();
|
HTMLEditorField::include_js();
|
||||||
|
|
||||||
Requirements::combine_files(
|
$leftAndMainIncludes = array_unique(array_merge(
|
||||||
'leftandmain.js',
|
array(
|
||||||
array_unique(array_merge(
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Layout.js',
|
||||||
array(
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.js',
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Layout.js',
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.ActionTabSet.js',
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.js',
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Panel.js',
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.ActionTabSet.js',
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Tree.js',
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Panel.js',
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Content.js',
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Tree.js',
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js',
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Ping.js',
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Menu.js',
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Content.js',
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js',
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js',
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js',
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Menu.js',
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldHelp.js',
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js',
|
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.TreeDropdownField.js',
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js',
|
),
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldHelp.js',
|
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', true, true),
|
||||||
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.TreeDropdownField.js',
|
Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', true, true)
|
||||||
),
|
));
|
||||||
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', true, true),
|
|
||||||
Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', true, true)
|
if($this->config()->session_keepalive_ping) {
|
||||||
))
|
$leftAndMainIncludes[] = FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Ping.js';
|
||||||
);
|
}
|
||||||
|
|
||||||
|
Requirements::combine_files('leftandmain.js', $leftAndMainIncludes);
|
||||||
|
|
||||||
// TODO Confuses jQuery.ondemand through document.write()
|
// TODO Confuses jQuery.ondemand through document.write()
|
||||||
if (Director::isDev()) {
|
if (Director::isDev()) {
|
||||||
|
@ -535,6 +535,13 @@ class Session {
|
|||||||
// There's nothing we can do about this, because it's an operating system function!
|
// There's nothing we can do about this, because it's an operating system function!
|
||||||
if($sid) session_id($sid);
|
if($sid) session_id($sid);
|
||||||
@session_start();
|
@session_start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modify the timeout behaviour so it's the *inactive* time before the session expires.
|
||||||
|
// By default it's the total session lifetime
|
||||||
|
if($timeout && !headers_sent()) {
|
||||||
|
setcookie(session_name(), session_id(), time()+$timeout, $path, $domain ? $domain : null, $secure, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user