Last modified: 2008-06-23 23:21:48 UTC
The calculation of $IP in commandLine.inc when running maintenance scripts always goes to the real installation of Mediawiki instead of using the current settings in LocalSettings.php. We have multiple wikis installed with the core MW install symlinked to each with only a few non-symlinked files (LocalSettings.php and images). This works very well except we can't run maintenance scripts on each Wiki -- doing "php maintenance/generateSitemap.php" or "php maintenance/update.php" (on an upgrade) fail when one is in the wiki root directories with:
A copy of your installation's LocalSettings.php
must exist and be readable in the source directory.
And printing out $IP from commandLine.inc makes it clear that IP points to the core install of MW. A work around is to copy each wiki's LocalSettings.php to the core directory, run the maintenance script and then remove the LocalSettings.php. Perhaps there is a better way to avoid this problem (and do multiple wikis) but it seems like a check in commandLine.inc for a LocalSettings.php in the current working directory (and using the $IP value from that file by default) would solve the problem.
For this purpose, the --conf= parameter exists already. If you have a symlink based installation as I do to, just use --conf= to specify the location of the LocalSettings.php file to use and it'll work from there.
Additionally, I already cleaned this up even more as of 1.13.
As per one of tim's suggestions when discussing the issues with extensions using maintenance scripts. I introduced a MW_INSTALL_PATH environment variable.
From 1.13 on you can use that environment variable to make this work perfectly fine. My personal favorite, is to cd to my root directory, run `export MW_INSTALL_PATH=$PWD` and from there, when in a 1.13 wiki the install path will be perfectly fine even though 100% of my wiki run off symlinks. Of course, 99% of my wiki are 1.12, so my scripts have the --conf= specified as well. But nonetheless, symlink installations work perfectly fine.
Thank you! I'm new to the MW code and I completely missed that option existed.