Skip to content
Snippets Groups Projects
Commit dd2109fc authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Pach #44947 by Moshe: fixed bug with session handling.

parent 62b610d8
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -53,8 +53,12 @@ function sess_write($key, $value) { ...@@ -53,8 +53,12 @@ function sess_write($key, $value) {
$result = db_query("SELECT sid FROM {sessions} WHERE sid = '%s'", $key); $result = db_query("SELECT sid FROM {sessions} WHERE sid = '%s'", $key);
if (!db_num_rows($result)) { if (!db_num_rows($result)) {
// Only save session data when there is session data available. // Only save session data when when the browser sends a cookie. This keeps
if ($user->uid || $value) { // crawlers out of session table. This improves speed up queries, reduces
// memory, and gives more useful statistics. We can't eliminate anonymous
// session table rows without breaking throttle modulee and "Who's Online"
// block.
if ($user->uid || $value || count($_COOKIE)) {
db_query("INSERT INTO {sessions} (sid, uid, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $user->uid, $user->cache, $_SERVER["REMOTE_ADDR"], $value, time()); db_query("INSERT INTO {sessions} (sid, uid, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $user->uid, $user->cache, $_SERVER["REMOTE_ADDR"], $value, time());
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment