Hi,
I have a portion of a site which uses external data (legacy application). I use drupal_bootstrap to load drupal and add the headers and other regions around the legacy content. Drupal regions work fine and are being loaded as they should.
I should be able to use boost on these pages right? However, I could not make it work for the Drupal 6 version of boost - ( in Drupal 5, I was able to make it work )
In Drupal 5 - I was able to make it work by using the following command when user is anonymous:
...
if (user is anonymous) {
ob_start("_boost_ob_handler");
}
...
However in Drupal 6 - I see that the implementation is different already and tried using the following:
...
if (user is anonymous) {
register_shutdown_function('_boost_ob_handler');
ob_start();
}
...
I have also added the following in the apache rewrite directives:
...
# NORMAL
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml [L,T=text/xml]
# LEGACY PAGES BOOST
RewriteCond %{DOCUMENT_ROOT}/legacy_directory/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* legacy_directory/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]
### BOOST END ###
...
I see some html files being generated under the "legacy_directory/cache" directory so it seems that boost is generating the static files as it should - however whenever I visit the pages as an anonymous user I don't see the line at the end of the source file that indicates that the page was generated by boost.
Does anyone know how can this be done? What am I missing?
Thanks for any information on this.
Comments
Comment #1
h3000 commentedHi,
I looked deeper into the boost module code and saw some code about the boost_pre_process_function.
Is this a function that I can use for my problem?
Does anyone know of any documentation on how this can be used in my situation?
Thanks
Comment #2
mikeytown2 commentedSet boost verbose to 9 and check out the watchdog for info
Comment #3
h3000 commentedHi mikeytown2,
thanks for the response.
ok - I tried setting the $GLOBALS['_boost_cache_this'] variable to true and set the boost verbose to 9.
What should I be looking for?
Comment #4
mikeytown2 commentedGenerally with the verbose level set at 9, something should be written to the watchdog once inside the _boost_ob_handler() function... actually after looking at this, you might have to set the $GLOBALS['_boost_router_item'] array. I use this to keep track of the complex relationships between the pages that Drupal generates.
Example structure:
['_boost_router_item']['page_callback'] - Taxonomy
['_boost_router_item']['page_type'] - Vocabulary
['_boost_router_item']['page_id'] - Term
So whatever your generating make sure to make the page_id unique if possible to each unique page.
Comment #5
mikeytown2 commentedComment #6
h3000 commentedok
I see some entries related to the legacy portion of the site.
This is the output in watchdog:
this is how boost is being called:
I also checked the cache directory under the legacy folder and I see a file cache/normal/www.my_site.com/_catid=63.html - so the file was generated properly. Is it a problem with the htaccess redirect rules?
Comment #7
mikeytown2 commentedUnderscores could be screwing it up (my_site.com)... I use that as a replacement for the ? character since using ? in a filename isn't smart. You can change the replacement character; just be sure to grab the new rules from the boost-rules admin page. Also I recommend setting the callback, leaving it blank is not recommended.
Is the url for that page
www.my_site.com/?catid=63.htmlAs for why the page is not being served by apache... does Boost work for pages that come from Drupal?
Comment #8
h3000 commentedthe url for the legacy portion of the site is:
http://www.shenzhenparty.com/classifieds
for that example, the url is:
http://www.shenzhenparty.com/classifieds/index.php?catid=3
the generated cache file is in
http://www.shenzhenparty.com/classifieds/cache/normal/www.shenzhenparty....
boost is working for the pages that come from drupal - which is at http://www.shenzhenparty.com
what should the value of the callback be?
Comment #9
mikeytown2 commentedset callback to something like 'old' it doesn't really matter; as long as its not blank.
OK I think I figured it out. The classifieds directory is not getting picked up.
2 more variables to set
$GLOBALS['_boost_path']
$GLOBALS['_boost_query']
So in this case
www.shenzhenparty.com/classifieds/index.php?catid=3do this:Comment #10
h3000 commentedAfter adding the two lines, this is what happened:
- a new directory under the classifieds cache directory was created named "classifieds"
- there were files inside this directory which corresponds to a certain page and arguments
- however, the page that was served was not the boosted page
- I tried copying the files into the main cache directory and when I checked the page, I got the boosted page
- it was now working but the cache could not be refreshed because it was looking for the boosted files in the main cache directory
- so the cached files are being created in the legacy directory but the file that was being served was from the main cache directory
Comment #11
bgm commentedClosing old issue with no activity in a long time.