Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Writing to sessions unfortunately takes forever in mysql.
I think it would be awesome if this was ported back to D6.
Comment | File | Size | Author |
---|---|---|---|
#13 | mongodb_session_1007974_13.patch | 9.77 KB | crea |
#10 | mongdob_session_1007974_10.patch | 9.75 KB | crea |
#6 | mongodb_session_1007974_6.patch | 9.66 KB | crea |
#3 | mongodb_session_1007974.patch | 15.34 KB | crea |
#4 | mongodb_session_1007974.patch | 15.26 KB | crea |
Comments
Comment #1
te-brian CreditAttribution: 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 CreditAttribution: crea commentedThe patch is too old
Comment #3
crea CreditAttribution: 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 CreditAttribution: crea commentedBetter patch
Comment #5
crea CreditAttribution: crea commentedComment #6
crea CreditAttribution: 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 CreditAttribution: crea commentedI'm using D6 core myself :P
Comment #9
dob_ CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: crea commentedThere's a bug in the previous patch: I forgot to unpack binary data for anonymous sessions.
Comment #12
crea CreditAttribution: crea commentedComment #13
crea CreditAttribution: crea commentedComment #15
phayes CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: slashrsm as a volunteer 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.