Fix GitInfo cache file path computation and storage location
authorBryan Davis <bd808@wikimedia.org>
Thu, 26 Jun 2014 19:05:29 +0000 (13:05 -0600)
committerReedy <reedy@wikimedia.org>
Tue, 8 Jul 2014 16:36:10 +0000 (16:36 +0000)
commitb6d18ab9f70ee8b7dcea0a5347f278faf83ba111
treec0e1ad60657fbc9c9ef21b5917bc92bb62f8d491
parent60b05541cdb08ae9f9512735bbc0f4730fe11ed7
Fix GitInfo cache file path computation and storage location

Depending on the configuration used in LocalSettings.php, $IP can be
changed between the time that configuration is loaded and the wiki
runtime by logic in WebStart.php. Attempt to mitigate the effects of
such changes on the cache file name computation by canonicalizing both
$IP and the path using PHP's realpath() function.

Related but distinct is the possible need to configure the canonical
location for finding cache files on disk separately from
$wgCacheDirectory. This change introduces a new configuration variable
named $wgGitInfoCacheDirectory that can be set to a path that diverges
from the default location of $wgCacheDirectory/gitinfo. This will be
useful in the WMF cluster where $wgCacheDirectory points to a directory
that is not managed by the deployment system.

Finally add wfDebugLog logging to make tracking down issues such as
miscomputed cache paths easier.

Bug: 53972
Change-Id: Iceb9e1ce8d3b4bb08f89fa6ec5d5e7392aaafd46
includes/DefaultSettings.php
includes/GitInfo.php
includes/Setup.php
tests/phpunit/includes/GitInfoTest.php