I'm having the following problem on 1.8.3 and 1.10, but not on 1.9.3 (only tried once on the latter two, many times on 1.8.3).
When I use importDump.php to import a page that includes the text [{{SERVER}}], it seems like I initially get http:/localhost instead of http://$wgServerName. But this only occurs on the first load, and it is corrected if I do an edit on the page.
Anyone else seen this? Any ideas about why it's happening and how to fix it?
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jim Hu wrote:
When I use importDump.php to import a page that includes the text [{{SERVER}}], it seems like I initially get http:/localhost instead of http://$wgServerName. But this only occurs on the first load, and it is corrected if I do an edit on the page.
Anyone else seen this? Any ideas about why it's happening and how to fix it?
$wgServer can't be autodetected sensibly from the web server when you're not running via the web server, so it defaults to 'http://localhost'.
If you set it explicitly in LocalSettings.php it should stick on the command-line scripts as well, though.
- -- brion vibber (brion @ wikimedia.org)
I guess I wasn't clear. After running importDump.php (but not rebuildAll.php), I view the imported page via the web server by opening or reloading it in a browser. I know that it's not a browser cache problem because other content on the page changes (or it's the first time that page has ever been viewed).
What is mystifying to me is that the {{SERVER}} is incorporated into the text.old_text field. So I can't see how the it could be failing, since the code must be pulling it from the database and parsing it - other template tags and markup are being converted correctly (I haven't tried other magic words). Hardcoding $wgServer in LocalSettings.php didn't help either.
Do magic words need something different?
Jim On Jul 12, 2007, at 8:35 AM, Brion Vibber wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jim Hu wrote:
When I use importDump.php to import a page that includes the text [{{SERVER}}], it seems like I initially get http:/localhost instead of http://$wgServerName. But this only occurs on the first load, and it is corrected if I do an edit on the page.
Anyone else seen this? Any ideas about why it's happening and how to fix it?
$wgServer can't be autodetected sensibly from the web server when you're not running via the web server, so it defaults to 'http://localhost'.
If you set it explicitly in LocalSettings.php it should stick on the command-line scripts as well, though.
- -- brion vibber (brion @ wikimedia.org)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGli4owRnhpk1wk44RAv+RAKDOqlxvHWcVFMiB/dAib8c4aXxVQQCdEE1r 3JyO4K0nW0z3w8CbsAmKrQ8= =v5IN -----END PGP SIGNATURE-----
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jim Hu wrote:
I guess I wasn't clear. After running importDump.php (but not rebuildAll.php), I view the imported page via the web server by opening or reloading it in a browser. I know that it's not a browser cache problem because other content on the page changes (or it's the first time that page has ever been viewed).
It'd be in the parser cache.
What is mystifying to me is that the {{SERVER}} is incorporated into the text.old_text field.
That should only happen if you did a {{subst:SERVER}} (and only if that actually works for imports, which I'm not sure it does. :)
That's not consistent with what you reported, either:
But this only occurs on the first load, and it is corrected if I do an edit on the page.
which indicates the parser cache, as in my previous diagnosis.
- -- brion vibber (brion @ wikimedia.org)
On Jul 12, 2007, at 11:40 AM, Brion Vibber wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jim Hu wrote:
I guess I wasn't clear. After running importDump.php (but not rebuildAll.php), I view the imported page via the web server by opening or reloading it in a browser. I know that it's not a browser cache problem because other content on the page changes (or it's the first time that page has ever been viewed).
It'd be in the parser cache.
Ah! I'll try to learn more about how the parser cache works. Is there an obvious way to clear it just for the imported pages? I can log which ones need it during generation of the imported pages. Or will one of the rebuild scripts take care of it.
Thanks! <snip>
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}}. I had foolishly thought that there was some kind of separate caching of templates magic words (doh). 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}}.
Is that right? If so, am I correct that: - Temporarily disabling caching during import won't help - 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? - {{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.
Jim
On Jul 12, 2007, at 12:04 PM, Jim Hu wrote:
On Jul 12, 2007, at 11:40 AM, Brion Vibber wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jim Hu wrote:
I guess I wasn't clear. After running importDump.php (but not rebuildAll.php), I view the imported page via the web server by opening or reloading it in a browser. I know that it's not a browser cache problem because other content on the page changes (or it's the first time that page has ever been viewed).
It'd be in the parser cache.
Ah! I'll try to learn more about how the parser cache works. Is there an obvious way to clear it just for the imported pages? I can log which ones need it during generation of the imported pages. Or will one of the rebuild scripts take care of it.
Thanks!
<snip>
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
-----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.
- 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. :)
- 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)
I really should have just tried it before posting.
On Jul 16, 2007, at 11:03 AM, Jim Hu wrote: <snip>
- 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?
This worked! I put $wgServer = 'ecoliwiki.org' in AdminSettings.php, and now the link shows up correctly. I'm thinking perhaps this should be put into the sample file?
- {{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.
As predicted, it shows as .org even if I access the site as .net. Editing in .net changes the link to .org, even if I view from .org. So... off to learn more about mod rewrite!
JH
Jim
On Jul 12, 2007, at 12:04 PM, Jim Hu wrote:
On Jul 12, 2007, at 11:40 AM, Brion Vibber wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jim Hu wrote:
I guess I wasn't clear. After running importDump.php (but not rebuildAll.php), I view the imported page via the web server by opening or reloading it in a browser. I know that it's not a browser cache problem because other content on the page changes (or it's the first time that page has ever been viewed).
It'd be in the parser cache.
Ah! I'll try to learn more about how the parser cache works. Is there an obvious way to clear it just for the imported pages? I can log which ones need it during generation of the imported pages. Or will one of the rebuild scripts take care of it.
Thanks!
<snip>
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jim Hu wrote:
I really should have just tried it before posting.
On Jul 16, 2007, at 11:03 AM, Jim Hu wrote:
<snip> > - 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?
This worked! I put $wgServer = 'ecoliwiki.org' in AdminSettings.php, and now the link shows up correctly.
$wgServer must contain the initial 'http://'.
- -- brion vibber (brion @ wikimedia.org)
mediawiki-l@lists.wikimedia.org