Hi, How do you activate Smart caching? and how do you specify the directory where you want the HTML-page cache?
Cheers, Jaime
University of Porto, Portugal
Jaime E. Villate wrote:
How do you activate Smart caching? and how do you specify the directory where you want the HTML-page cache?
MediaWiki includes a limited to-disk page caching option; only non-logged-in hits are stored, and only for pages that aren't redirects, special pages, etc.
To enable it, add lines like these to LocalSettings.php: $wgUseFileCache = true; $wgFileCacheDirectory = "/some/directory/cache";
The directory must exist and must be writable by the user that PHP runs as (the web server user or sometimes your user account). It should be safe to put it under the image upload directory, or you can put it somewhere else. It doesn't have to be directly accessible via the web, but if it is it doesn't hurt.
For really fancy caching you can use a squid reverse proxy in front of your web server and enable the squid modes, but this is rather trickier and requires additional servers running.
-- brion vibber (brion @ pobox.com)
On Tue, Jul 06, 2004 at 07:21:39PM -0700, Brion Vibber wrote:
Jaime E. Villate wrote:
How do you activate Smart caching? and how do you specify the directory where you want the HTML-page cache?
MediaWiki includes a limited to-disk page caching option; only non-logged-in hits are stored, and only for pages that aren't redirects, special pages, etc.
That's OK. It is exactly what I need. I want the public to see static html pages and use the wiki only for the administrators of the site. Those special pages and redirects only interest to those using the wiki.
Thanks a lot for the information.
Jaime
Brion Vibber wrote:
MediaWiki includes a limited to-disk page caching option; only non-logged-in hits are stored, and only for pages that aren't redirects, special pages, etc.
I just tried to use this, and it seems the file cache is totally broken in current mediawiki 1.3.0beta4. It looks like the code is not maintained, probably because it is not used by wikipedia.
Basically, the file cache is never used, except when oldid is defined, i.e. when viewing a diff.
Also, the file cache is not useable when you have either the IP shown in the page header (for anonymous users), or when it is a logged in user. Either of this is the case on wikipedia, so it's not useable there.
Might be best to remove the code entirely then...
Mark Bergsma wrote:
Brion Vibber wrote:
MediaWiki includes a limited to-disk page caching option; only non-logged-in hits are stored, and only for pages that aren't redirects, special pages, etc.
I just tried to use this, and it seems the file cache is totally broken in current mediawiki 1.3.0beta4. It looks like the code is not maintained, probably because it is not used by wikipedia.
Basically, the file cache is never used, except when oldid is defined, i.e. when viewing a diff.
That doesn't make sense; those are circumstances where the file cache would *never* be used. Can you confirm?
Also, the file cache is not useable when you have either the IP shown in the page header (for anonymous users), or when it is a logged in user. Either of this is the case on wikipedia, so it's not useable there.
The file cache is meant for read-only viewers, not editors, so this is known and intentional behavior.
Try also setting: $wgShowIPinHeader = false;
-- brion vibber (brion @ pobox.com)
Brion Vibber wrote:
That doesn't make sense; those are circumstances where the file cache would *never* be used. Can you confirm?
Well the only place I found a call to Article::tryFileCache, was within an if ( !is_null( $oldid )...
The file cache is meant for read-only viewers, not editors, so this is known and intentional behavior.
Try also setting: $wgShowIPinHeader = false;
I did that. I eventually got it to work by editing the code, and adding a block
if ( $this->tryFileCache() ) { # tell wgOut that output is taken care of $wgOut->disable(); $this->viewUpdates(); return; }
(after the if block I just mentioned)
but I'm not sure whether that is correct in all cases.
Mark Bergsma wrote:
Brion Vibber wrote:
That doesn't make sense; those are circumstances where the file cache would *never* be used. Can you confirm?
Well the only place I found a call to Article::tryFileCache, was within an if ( !is_null( $oldid )...
This looks like a typo. It used to be:
if ( !isset( $oldid ) and $this->checkTouched() ) {
Change it to:
if ( empty( $oldid ) and $this->checkTouched() ) {
and let me know how it works.
-- brion vibber (brion @ pobox.com)
Brion Vibber wrote:
This looks like a typo. It used to be:
if ( !isset( $oldid ) and $this->checkTouched() ) {
Change it to:
if ( empty( $oldid ) and $this->checkTouched() ) {
and let me know how it works.
It didn't, isFileCacheable always returned false. That appeared to be because $action was always empty. If I requested an article with '&action=view', it did work.
I now changed isFileCacheable() to read:
... and ($action == 'view' or empty( $action )) ...
and that seemed to do the trick.
Mark Bergsma wrote:
It didn't, isFileCacheable always returned false. That appeared to be because $action was always empty. If I requested an article with '&action=view', it did work.
[snip]
As requested, the corresponding diff, against beta4.
mediawiki-l@lists.wikimedia.org