Page MenuHomePhabricator

$wgReadOnlyFile appears to default to non-existent directory
Closed, ResolvedPublic

Description

Author: nickpj

Description:
$wgReadOnlyFile appears to default to non-existent directory.

Here's the problem I think:

root@bling:/var/www/hosts/mediawiki/wiki# grep -in wguploaddir
includes/DefaultSettings.php LocalSettings.php
includes/DefaultSettings.php:119:$wgUploadDirectory = "{$IP}/upload";
includes/DefaultSettings.php:124:$wgMathDirectory = "{$wgUploadDirectory}/math";
includes/DefaultSettings.php:125:$wgTmpDirectory = "{$wgUploadDirectory}/tmp";
includes/DefaultSettings.php:312: * $wgUploadDirectory.
includes/DefaultSettings.php:734:$wgReadOnlyFile =
"{$wgUploadDirectory}/lock_yBgMBwiR";
includes/DefaultSettings.php:1013:$wgFileCacheDirectory =
"{$wgUploadDirectory}/cache";
LocalSettings.php:56:$wgUploadDirectory = "$IP/images";
LocalSettings.php:104:$wgMathDirectory = "{$wgUploadDirectory}/math";
LocalSettings.php:105:$wgTmpDirectory = "{$wgUploadDirectory}/tmp";

root@bling:/var/www/hosts/mediawiki/wiki#

So, basically initially the default for $wgUploadDirectory is "{$IP}/upload"
(which doesn't exist in a default install, I think).

Then it gets overridden to be "$IP/images" in LocalSettings (which I don't
recall changing - I may have, but off the top of the head I don't think I did).

The problem is that this leaves the defaults for both $wgReadOnlyFile and
$wgFileCacheDirectory both using names in an "upload" directory that doesn't exist.

Or to put it a different way, this code:

<?
$wgUploadDirectory = "{$IP}/upload";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";
$wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
$wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
$wgUploadDirectory = "$IP/images";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";

print "wgTmpDirectory: $wgTmpDirectory\n"

. "wgMathDirectory: $wgMathDirectory\n"
. "wgUploadDirectory: $wgUploadDirectory\n"
. "wgFileCacheDirectory: $wgFileCacheDirectory\n"
. "wgReadOnlyFile: $wgReadOnlyFile\n";

...produces this result:

wgTmpDirectory: /images/tmp
wgMathDirectory: /images/math
wgUploadDirectory: /images
wgFileCacheDirectory: /upload/cache

wgReadOnlyFile: /upload/lock_yBgMBwiR

There are at least two ways of hopefully resolving this relatively painlessly:

  • Either in the MediaWiki tarball that gets extracted, include an

empty/README-only "upload" directory (so that the path is valid by default, and
presumably no php code has to written or changed); Or:

  • Change the value in DefaultSettings.php :
  • includes/DefaultSettings.php:119:$wgUploadDirectory = "{$IP}/upload";

+ includes/DefaultSettings.php:119:$wgUploadDirectory = "{$IP}/images";

There's also the option of specifying $wgReadOnlyFile and $wgFileCacheDirectory
in LocalSettings, but that seems to defeat the purpose of defaultsettings
supplying default settings.


Version: 1.8.x
Severity: minor

Details

Reference
bz6639

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:17 PM
bzimport set Reference to bz6639.

robchur wrote:

Changed to use more consistent values in SVN trunk, r15559.