Page MenuHomePhabricator

Document $IP is internal (not to change in LocalSettings)
Open, MediumPublic

Description

The $IP variable is used in DefaultSettings.php, which means if you change it in LocalSettings.php, you must also override any DefaultSettings.php variable that depends on it.

It seems we we should either:

  1. Remove all references to $IP in DefaultSettings.php, and use Setup.php (e.g. how $wgStyleDirectory works).
  2. Document that $IP is now an internal variable and should not be set in LocalSettings.php.

Version: 1.22.0
Severity: normal

Details

Reference
bz54483

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:12 AM
bzimport set Reference to bz54483.
bzimport added a subscriber: Unknown Object (MLST).

$IP has already been used to load a bunch of code in WebStart.php long before LocalSettings.php is loaded -- it's WAY too late to change $IP there.

The only semi-correct way I can see to change it is to set the MW_INSTALL_PATH environment variable which can override the dirname(FILE) path, and I'm not 100% convinced that's actually useful for anything in the first place.

Comments in the code seem to indicate it can be used to override expansion of symlinks, but that seems like a wonky idea -- you've already hit at least index.php and includes/WebStart.php from the base directory, so you can't really flip to another version or something.

Krinkle renamed this task from $IP used in DefaultSettings to Document $IP is internal (not to change in LocalSettings).Dec 26 2018, 6:18 AM
Krinkle removed a subscriber: wikibugs-l-list.

Given that we don't actually support changing $IP, should we move it to a constant instead like we recently did for MW_VERSION / $wgVersion?

Yes, though beware of mocking in tests. Code that isn't yet injecting its (in)direct use of $IP should likely continue to use the global.

Also, it'd be neat perhaps if we can align this with the ENV variable MW_INSTALL_PATH for consistency.