Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
224
Merge Requests
224
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
bb1817e5
Commit
bb1817e5
authored
Apr 18, 2013
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1969846
by rootatwc: Convert session_write_interval() to settings.
parent
d2e5e7b7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
core/includes/session.inc
core/includes/session.inc
+2
-2
core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php
...es/system/lib/Drupal/system/Tests/Session/SessionTest.php
+7
-1
sites/default/default.settings.php
sites/default/default.settings.php
+8
-0
No files found.
core/includes/session.inc
View file @
bb1817e5
...
...
@@ -169,7 +169,7 @@ function _drupal_session_write($sid, $value) {
// For performance reasons, do not update the sessions table, unless
// $_SESSION has changed or more than 180 has passed since the last update.
if
(
$is_changed
||
!
isset
(
$user
->
timestamp
)
||
REQUEST_TIME
-
$user
->
timestamp
>
variable_
get
(
'session_write_interval'
,
180
))
{
if
(
$is_changed
||
!
isset
(
$user
->
timestamp
)
||
REQUEST_TIME
-
$user
->
timestamp
>
settings
()
->
get
(
'session_write_interval'
,
180
))
{
// Either ssid or sid or both will be added from $key below.
$fields
=
array
(
'uid'
=>
$user
->
uid
,
...
...
@@ -206,7 +206,7 @@ function _drupal_session_write($sid, $value) {
}
// Likewise, do not update access time more than once per 180 seconds.
if
(
$user
->
uid
&&
REQUEST_TIME
-
$user
->
access
>
variable_
get
(
'session_write_interval'
,
180
))
{
if
(
$user
->
uid
&&
REQUEST_TIME
-
$user
->
access
>
settings
()
->
get
(
'session_write_interval'
,
180
))
{
db_update
(
'users'
)
->
fields
(
array
(
'access'
=>
REQUEST_TIME
...
...
core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php
View file @
bb1817e5
...
...
@@ -228,7 +228,13 @@ function testSessionWrite() {
$this
->
assertEqual
(
$times4
->
timestamp
,
$times3
->
timestamp
,
'Sessions table was not updated.'
);
// Force updating of users and sessions table once per second.
variable_set
(
'session_write_interval'
,
0
);
$this
->
settingsSet
(
'session_write_interval'
,
0
);
// Write that value also into the test settings.php file.
$settings
[
'settings'
][
'session_write_interval'
]
=
(
object
)
array
(
'value'
=>
0
,
'required'
=>
TRUE
,
);
$this
->
writeSettings
(
$settings
);
$this
->
drupalGet
(
''
);
$times5
=
db_query
(
$sql
,
array
(
':uid'
=>
$user
->
uid
))
->
fetchObject
();
$this
->
assertNotEqual
(
$times5
->
access
,
$times4
->
access
,
'Users table was updated.'
);
...
...
sites/default/default.settings.php
View file @
bb1817e5
...
...
@@ -451,6 +451,14 @@
*/
# $settings['mixed_mode_sessions'] = TRUE;
/**
* Session write interval:
*
* Set the minimum interval between each session write to database.
* For performance reasons it defaults to 180.
*/
# $settings['session_write_interval'] = 180;
/**
* Base URL (optional).
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment