[Mediawiki-l] importDump.php and {{SERVER}}

Brion Vibber brion at wikimedia.org
Mon Jul 16 17:40:51 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jim Hu wrote:
> After intermittently thinking about this for a few days, let me see  
> if I understand what's going on.
> 
> 1) When I import any new page via importDump, it gets parsed and  
> saved in the parser cache.
> 2) During this parsing, the magic word {{SERVER}} looks for $_SERVER  
> and finds 'localhost' instead of my base url.
> 3) When I click on the page without editing, it calls that cached  
> version, which includes localhost instead of mywiki.org or whatever.   
> All the other new content is already there because it was generated  
> at the same time as the incorrect value of {{SERVER}}.

Yep.

>  I had  
> foolishly thought that there was some kind of separate caching of  
> templates magic words (doh).

Nope. :)

> 4) When I do any kind of edit from the web interface, it reparses the  
> page and saves the new version in the cache, but now it correctly  
> interprets {{SERVER}}.

Yep.

> Is that right?  If so, am I correct that:
> - Temporarily disabling caching during import won't help

Well, you could disable the parser cache I guess...

> - setting $wgServer will work, but only if I set it somewhere where  
> it won't be reset to localhost by importDump. i.e. I should set it in  
> AdminSettings.php?

LocalSettings.php would be an appropriate place.

> - {{SERVER}} will get confused either way if I have different URLs  
> pointing to the same wiki?  In my case, I have ecoliwiki.org,  
> ecoliwiki.net, and ecoliwiki.com.  To fix this, I should do some  
> rewrite rules.

The system generally expects that you'll only deal with one canonical
URL and isn't currently really set up to handle multiple access points
that aren't done by redirects.

You could do some tweaking with the parser cache user config hash key if
you're careful; see extensions/RenderHash.php for an example; you'd set
something based on the alternate access route being used.

- -- brion vibber (brion @ wikimedia.org)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGm62jwRnhpk1wk44RAlh7AJ0XwL9sufRULdz5bTs9foIbZ7N2FQCfX2Ck
PYkXuikmk4ej2xtiIEm4MiY=
=9RWB
-----END PGP SIGNATURE-----



More information about the MediaWiki-l mailing list