vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=34)
-   -   Cache the datastore in the filesystem (https://vborg.vbsupport.ru/showthread.php?t=75032)

Erwin 01-25-2005 05:33 PM

I look forward to future versions.

Interesting that the vB developers had already coded this into vB by default. You just needed to activate it in config.php really. :)

Stadler 01-25-2005 06:14 PM

Quote:

Originally Posted by Erwin
I look forward to future versions.

Interesting that the vB developers had already coded this into vB by default. You just needed to activate it in config.php really. :)

Not really. They just started adding this, but it won't work without any changes.

Stadler 01-25-2005 07:45 PM

OK, I'm finished with the new version so far:

0.8.1 Alpha:
  • removed a relic of an old hack from dscache.txt
  • Added config_dscache.php
  • backups can be turned off now
  • you can change the directory, where the datastore_cache.php is stored now
  • Fixed a bug, that may cause unserialize-errors in the CP out of the blue
  • rebuild_dscache.php is verbosive now
Be aware, that this hack is still an Alpha and needs testing.

Erwin 01-25-2005 08:16 PM

I installed 0.8.1 - works 100%. The backups were an annoyance and I'm glad you coded it so that they disappear. :) Thanks.

kall 01-26-2005 06:07 PM

Parse error: parse error, unexpected T_STRING, expecting ')' in /home3/nzboards/public_html/forums/includes/datastore_cache.php on line 2833

Line 2833: 'description' => 'Kall\\'s private forum',

Stadler 01-26-2005 07:57 PM

In your functions.php (the hacked version) find the following:
PHP Code:

            $data_code preg_replace('/### (start|end) /''\' . "\\x23\\x23\\x23 \1 " . \''$data_code);
            
$datastore_cache file_get_contents(DATASTORE_FILE_DIR 'datastore_cache.php');

            
$datastore_cache preg_replace(
                
"/### start $title ###".
                
"(?:[^#]*(?:#(?!## end $title ###)[^#]*)*)".
                
"### end $title ###/",
                
"### start $title ###\n\$$varname = $data_code;\n### end $title ###",
                
$datastore_cache
            
); 

and replace it with the following:
PHP Code:

            $data_code str_replace(
                array(
                    
'### start ',
                    
'### end ',
                    
'{DATA_CODE}'
                
),
                array(
                    
'\' . "\\x23\\x23\\x23 start " . \'',
                    
'\' . "\\x23\\x23\\x23 end " . \'',
                    
'\' . "\\x7bDATA_CODE\\x7d" . \''
                
), $data_code);

            
$datastore_cache file_get_contents(DATASTORE_FILE_DIR 'datastore_cache.php');

            
$datastore_cache preg_replace(
                
"/### start $title ###".
                
"(?:[^#]*(?:#(?!## end $title ###)[^#]*)*)".
                
"### end $title ###/",
                
"### start $title ###\n\$$varname = {DATA_CODE};\n### end $title ###",
                
$datastore_cache
            
);
            
$datastore_cache str_replace('{DATA_CODE}'$data_code$datastore_cache); 

That should do the trick.

Andreas 01-26-2005 08:53 PM

Hmm ... why don't you just write the variables without comments?
I think this could make it easier :)

kall 01-26-2005 09:46 PM

Quote:

Originally Posted by Stadler
In your functions.php (the hacked version) find the following:
PHP Code:

            $data_code preg_replace('/### (start|end) /''\' . "\\x23\\x23\\x23 \1 " . \''$data_code);
            
$datastore_cache file_get_contents(DATASTORE_FILE_DIR 'datastore_cache.php');

            
$datastore_cache preg_replace(
                
"/### start $title ###".
                
"(?:[^#]*(?:#(?!## end $title ###)[^#]*)*)".
                
"### end $title ###/",
                
"### start $title ###\n\$$varname = $data_code;\n### end $title ###",
                
$datastore_cache
            
); 

and replace it with the following:
PHP Code:

            $data_code str_replace(
                array(
                    
'### start ',
                    
'### end ',
                    
'{DATA_CODE}'
                
),
                array(
                    
'\' . "\\x23\\x23\\x23 start " . \'',
                    
'\' . "\\x23\\x23\\x23 end " . \'',
                    
'\' . "\\x7bDATA_CODE\\x7d" . \''
                
), $data_code);

            
$datastore_cache file_get_contents(DATASTORE_FILE_DIR 'datastore_cache.php');

            
$datastore_cache preg_replace(
                
"/### start $title ###".
                
"(?:[^#]*(?:#(?!## end $title ###)[^#]*)*)".
                
"### end $title ###/",
                
"### start $title ###\n\$$varname = {DATA_CODE};\n### end $title ###",
                
$datastore_cache
            
);
            
$datastore_cache str_replace('{DATA_CODE}'$data_code$datastore_cache); 

That should do the trick.

I think I will wait until the serialise bug is fixed...I have destroyed my forums twice now trying to implement this...it also doesn't seem to play nicely with Ushop.

Good idea though, and thanks for the help. :)

Erwin 01-27-2005 08:40 PM

This hack works but I've uninstalled it :). It was really annoying to have to keep manually updating the datastore on each of my separate web servers. The crunch came when I put my forums offline to do a backup, but as I did not update the datastore manually, members could still access the forums, causing my 15 Gb database to become corrupted. :) Took me 28 hours to fix it manually as I didn't want to lose even 1 day of data. There is a slight page loading improvement, but I'd rather have the convenience.

Stadler 01-27-2005 08:54 PM

Well yeah, if you're running this on a multi server setup, you need to synchronize everything on the fly and I suppose, that setting up such a system can be a lot of work, I guess.


All times are GMT. The time now is 06:54 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01426 seconds
  • Memory Usage 1,785KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete