Last modified: 2006-07-12 05:23:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T8639, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 6639 - $wgReadOnlyFile appears to default to non-existent directory
$wgReadOnlyFile appears to default to non-existent directory
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.8.x
All All
: Normal minor (vote)
: ---
Assigned To: Rob Church
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-12 02:02 UTC by Nick Jenkins
Modified: 2006-07-12 05:23 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Nick Jenkins 2006-07-12 02:02:29 UTC
$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.
Comment 1 Rob Church 2006-07-12 03:19:52 UTC
Changed to use more consistent values in SVN trunk, r15559.
Comment 2 Nick Jenkins 2006-07-12 05:23:06 UTC
Thank you!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links