Closed (won't fix)
Project:
MongoDB
Version:
6.x-1.x-dev
Component:
Session
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
27 Dec 2010 at 09:22 UTC
Updated:
15 May 2015 at 21:55 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
te-brian commentedHere is my first stab at a 'backport'.
This is for testing and debugging only. I left in some debugging logic I was using in case someone needs to do some debugging on their own.
Some Notes:
- This was developed and tested in a pressflow install. As such it implements and uses some functions that only pressflow has. However, these functions only live in mongodb_session.inc, so in theory this should work with core drupal as well (please test).
- If you want to test this in a pressflow install you will have to apply the included patch which moves all the drupal_session_* functions from bootstrap.inc to session.inc. This allows mongodb_session.inc to override them, since they contain db_query writes. We will need to petition the guys at four kitchens to apply this patch once we are happy with this module.
Enjoy
Comment #2
crea commentedThe patch is too old
Comment #3
crea commentedAttaching my version of the patch. Depends on #1179402: Define REQUEST_TIME for backports for REQUEST_TIME support. Other than REQUEST_TIME, it follows D6 in every aspect: no lazy sessions, https stuff, etc.
I think for Pressflow its better to create separate .inc file
Comment #4
crea commentedBetter patch
Comment #5
crea commentedComment #6
crea commentedUpdated patch: no REQUEST_TIME dependency, no tests, variable collection name.
Btw, previous version worked for me without issues.
Comment #7
fgmI wonder whether :
- it makes sense to create this version for core instead of Pressflow: can you really imagine a MongoDB deployment on a non-Pressflow instance ?
- we can have a test suite before committing
Comment #8
crea commentedI'm using D6 core myself :P
Comment #9
dob_ commentedGot errors when i had no session.
My workaround:
$user = mongodb_collection(variable_get('mongodb_session', 'session'))->findOne(array('sid' => $sid));
if($user)
$user = (object)$user;
If this is not changed it tries to get the not set variable $user->uid and throws an exception.
Comment #10
crea commented@dob_
You said you are using Pressflow. I wonder how you make this work, because Pressflow has different session functions and stuff (same as D7) and this patch is only for D6
I've encountered "non utf8 string" exceptions with my last patch. So I switched to using MongoBinData
Comment #11
crea commentedThere's a bug in the previous patch: I forgot to unpack binary data for anonymous sessions.
Comment #12
crea commentedComment #13
crea commentedComment #15
phayes commentedThe d.o testbot doesn't have mongodb installed so obviously the test fails. I re-ran the test in my local environment with mongodb installed and all tests passed. Furthurmore, this patch seems to work great. Please commit!
Comment #16
phayes commentedI take it all back. This implementation is broken.
It puts the *entire* user object into mongo, then, when the session is instantiated, it does this:
global $user;
$user = $user_from_mongo;
This is bad because it's impossible to update a user without instantiating a session for that user. Expect many things to mysteriously break.
do not use this patch.
Comment #17
crea commentedAFAIR, the patch doesn't do anything different from the core D6, but I'll double check when I have time.
Comment #18
crea commentedYeah, #16 makes sense. Original code gets user object from the user table.
Comment #19
fgmThree years later and no working version, can we agree to close this and say there will never be a stable 6.x version for sessions ?
Comment #20
slashrsm commentedAgreed. If there is still anyone out there that needs this feel free to reopen and bring patch to RTBC state. Maintainers will be happy to commit it in that case.