dan nessett wrote:
Sprinkling the computation of $IP all over the place is just looking for trouble. At some point the code used to make this computation may diverge and you will have bugs introduced. My first reaction to this problem was to wonder why these files didn't just require LocalSettings.php. However, since it is a fairly complex file doing so might not be desirable because: 1) there are values in LocalSettings.php that would interfere with values in these files, 2) there is some ordering problem that might occur, or 3) there are performance considerations.
No, the reason is because LocalSettings.php is in the directory pointed to by $IP, so you have to work out what $IP is before you can include it.
Web entry points need to locate WebStart.php, and command line scripts need to locate maintenance/commandLine.inc. Then either of those two entry scripts can locate the rest of MediaWiki.
-- Tim Starling