Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
memcache-3386779
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
memcache-3386779
Commits
7527e789
Commit
7527e789
authored
16 years ago
by
John VanDyk
Browse files
Options
Downloads
Patches
Plain Diff
Some comments cleanup.
parent
8653fb16
No related branches found
Branches containing commit
Tags
6.x-1.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
memcache-session.inc
+20
-15
20 additions, 15 deletions
memcache-session.inc
memcache_admin/memcache_admin.module
+0
-2
0 additions, 2 deletions
memcache_admin/memcache_admin.module
with
20 additions
and
17 deletions
memcache-session.inc
+
20
−
15
View file @
7527e789
...
...
@@ -4,6 +4,8 @@
/**
* @file
* User session handling functions.
*
* An alternative to includes/session.inc.
*/
function
sess_open
(
$save_path
,
$session_name
)
{
...
...
@@ -38,17 +40,17 @@ function sess_read($key) {
/**
* Write a session to session storage.
*
*
* We have the following cases to handle.
* 1. Anonymous user
* 1a. Without session data.
* 1b. With session data.
* 1c. Session saving has been turned off programatically
* 1c. Session saving has been turned off programatically
* (see session_save_session()).
* 2. Authenticated user.
* 2a. Without session data.
* 2b. With session data.
* 2c. Session saving has been turned off programatically
* 2c. Session saving has been turned off programatically
* (see session_save_session()).
*
* @param $key
...
...
@@ -186,15 +188,16 @@ function sess_user_load($session) {
// We found the client's session record and they are an authenticated user.
if
(
$session
&&
$session
->
uid
!=
0
)
{
$user
=
dmemcache_get
(
$session
->
uid
,
'users'
);
// If the 'users' memcache bin has gone is unavailable, $user will be NULL.
// If the cached user was not found in the 'users' memcache bin, $user will be FALSE.
// If the 'users' memcache bin is unavailable, $user will be NULL.
// If the cached user was not found in the 'users' memcache bin, $user will
// be FALSE.
// In either of these cases, the user must be retrieved from the database.
if
(
!
$user
->
uid
&&
isset
(
$session
->
uid
)
&&
$session
->
uid
!=
0
)
{
$user
=
db_fetch_object
(
db_query
(
'SELECT u.* FROM {users} u WHERE u.uid = %d'
,
$session
->
uid
));
$user
=
drupal_unpack
(
$user
);
// Normally we would join the session and user tables. But we already
have the
// session information. So add that in.
// Normally we would join the session and user tables. But we already
//
have the
session information. So add that in.
$user
->
sid
=
$session
->
sid
;
$user
->
cache
=
$session
->
cache
;
$user
->
hostname
=
$session
->
hostname
;
...
...
@@ -210,25 +213,27 @@ function sess_user_load($session) {
}
}
else
if
(
$user
->
uid
)
{
// Got a user object from 'users' memcache bin. Mark it in case modules
want
// to know
if
this use was created from memcache.
// Got a user object from 'users' memcache bin. Mark it in case modules
//
want
to know
that
this use
r
was created from memcache.
$user
->
from_cache
=
TRUE
;
$user
->
session
=
empty
(
$session
->
session
)
?
''
:
$session
->
session
;
}
else
{
// We will only get here when the session has a nonzero uid, a user object was
// successfully retrieved from the 'users' bin, and that user's object's uid is 0.
// Not sure why this would ever happen. Leaving former comment in:
// We will only get here when the session has a nonzero uid, a user object
// was successfully retrieved from the 'users' bin, and that user
// object's uid is 0. Not sure why this would ever happen. Leaving former
// comment in:
// This is a rare case that we have a session cached, but no session user object cached.
// This usually only happens if you kill memcached and restart it.
$user
=
drupal_anonymous_user
(
$session
->
session
);
}
}
// We didn't find the client's record (session has expired), or they are an anonymous user.
// We didn't find the client's record (session has expired), or they are an
// anonymous user.
else
{
$session
=
isset
(
$session
->
session
)
?
$session
->
session
:
''
;
$user
=
drupal_anonymous_user
(
$session
);
}
return
$user
;
}
This diff is collapsed.
Click to expand it.
memcache_admin/memcache_admin.module
+
0
−
2
View file @
7527e789
...
...
@@ -83,10 +83,8 @@ function memcache_admin_menu() {
);
$sub_count
++
;
}
}
}
return
$items
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment