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.
Patch attached.
Seems to work ok in my limited testing.
Comment | File | Size | Author |
---|---|---|---|
#13 | 1098268_mongodb_cache_7.patch | 8.48 KB | makara |
#12 | 1098268_mongodb_cache_6.patch | 8.41 KB | makara |
#5 | mongodb_cache_1098268_5.patch | 7.87 KB | crea |
#3 | mongodb_cache_1098268.patch | 1.99 KB | crea |
#2 | mongodb_cache_1098268.patch | 1.99 KB | crea |
Comments
Comment #1
crea CreditAttribution: crea commentedI suggest to remove REQUEST_TIME definition in favor of #1179402: Define REQUEST_TIME for backports. Its also used in many other places.
Comment #2
crea CreditAttribution: crea commentedAttached patch depends on #1179402: Define REQUEST_TIME for backports
Comment #3
crea CreditAttribution: crea commentedCleaner patch
Comment #4
crea CreditAttribution: crea commentedComment #5
crea CreditAttribution: crea commentedUpdated patch: no REQUEST_TIME dependency
Comment #6
dob_ CreditAttribution: dob_ commentedPatch seems not to work for me.
I tried it with a pressflow 6.20 installation.
cd sites/all/modules/mongodb
patch -p1 < patchfile.patch
Created the directory automatically.
Then i was able to activate the module.
Added these to my settings:
$conf['mongodb_connections'] = array(
'mongohost' => array('host' => 'localhost', 'db' => 'mydb'),
);
$conf['mongodb_collections'] = array(
'watchdog' => 'mongohost',
'session' => 'mongohost',
'cache' => 'mongohost',
);
Watchdog messages are written to mydb. Sessions and Cache not.
Any ideas?
Comment #7
crea CreditAttribution: crea commentedIn this issue only cache is discussed. Sessions are discussed in different issue.
To use this you need something like this:
Comment #8
dob_ CreditAttribution: dob_ commentedAlright, that was the point.
Now i get this error:
MongoException: non-utf8 string: � in /media/psf/Home/Sites/infinite.local/sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc on line 152 Call Stack
That's my entry:
Array ( [_id] => http://infinite.local/ [cid] => http://infinite.local/ [created] => 1314532614 [expire] => -1 [headers] => [serialized] => [data] => ��W�o�6~�_qe��Y/��$��,.�Y���"Z:KthI%);ُ�}GJr��(�,z����}��G�<�Z\^�����CCR�lӘ�l�(,6�����7{_;~�������UӒ�HQ�Դ�R(�GѴ�� ���p�rp���SjO���&?O?����.���������;�|2��o��?��x� >Z-����Xnmu��z���F�����r(c֚��1�Ԧ,���j� ����7q�u:P��"��+�:b�jBݠ v�V���s-W;vu,l0���5U-l�\m��?�$ڠ�j;�0౯�� �J��QE�䥶ImAR(�\�;;�M��8�]�`���Eо�b��ge����O��q*l�������p����&?�VZ��Q��1�b!1���pZ�M�+�k�l]d!o���"o��d��� Q��!t��EiUf��,��CX� ��J�S(�Lq&4��}��H7~SX�|�@��:� ��R=��FCs)�B���������0�H ��(�,B.|��\���EJ5���D?Ser9l�������D�����Jw;n :��*d�� �>2������UWDcH(JnZʌ 9�ڐ.���J���t# ��~'��4f�X�t�;/�?���U�����]B?�^_*��i3��sTU�D�k^I$�2�n�A$V���﨓K �'���MВv�m%�������+|[���&�`+��m�x�.pw]XkQU4�[؟��F��@Ԗ�<�� ������\��F[�"�RUg���,iο0���~�!w����]���?��<� )
Comment #9
dob_ CreditAttribution: dob_ commentedChanged code after line 149 and checked if the data string is valid UTF-8.
if(mb_detect_encoding($entry['data'], 'UTF-8', true)) {
$collection = mongodb_collection($this->bin);
$collection->save($entry);
}
Comment #10
crea CreditAttribution: crea commentedThere's an issue here about using mongo binary type for cache.
Comment #11
dob_ CreditAttribution: dob_ commentedThanks.
My changes to use binary storage.....
131,132c131,136
< if ($cache->serialized) {
< $cache->data = unserialize($cache->data);
---
> if($cache->binary && $cache->serialized) {
> $cache->data = unserialize($cache->data->bin);
> } else if(!$cache->binary && $cache->serialized){
> $cache->data = unserialize($cache->data);
> } else {
> $cache->data = $cache->data->bin;
134c138
<
---
>
145a150
> 'binary' => true,
147c152
< 'data' => $scalar ? $data : serialize($data),
---
> 'data' => $scalar ? $data : serialize($data),
149c154
<
---
> $entry['data'] = new MongoBinData($entry['data']);
151d155
<
Comment #12
makara CreditAttribution: makara commentedUpdated the patch:
_cache_get_object()
tomongodb_cache_get_object()
Comment #13
makara CreditAttribution: makara commentedFixed patch:
Comment #14
crea CreditAttribution: crea commentedThere's no need to validate if the cache data is valid utf. Just use binary type everywhere
Comment #15
fgmFour years later and no committed version, can we agree to close this and say there will never be a stable 6.x version for cache ?
Comment #16
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.