r106764 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106763‎ | r106764 | r106765 >
Date:07:53, 20 December 2011
Author:aaron
Status:ok (Comments)
Tags:lamecommitsummary 
Comment:
FU r106752: Fixed directory b/c for ForeignAPIRepo, which was moved to Setup.php
Modified paths:
  • /trunk/phase3/includes/Setup.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignAPIRepo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Setup.php
@@ -192,7 +192,6 @@
193193 $wgForeignFileRepos[] = array(
194194 'class' => 'ForeignAPIRepo',
195195 'name' => 'wikimediacommons',
196 - 'directory' => $wgUploadDirectory,
197196 'apibase' => 'http://commons.wikimedia.org/w/api.php',
198197 'hashLevels' => 2,
199198 'fetchDescription' => true,
@@ -218,7 +217,11 @@
219218 * Also updates the repo config to use the backend.
220219 */
221220 function wfBackendForLegacyRepoConf( &$info ) {
 221+ global $wgUploadDirectory;
222222 // Local vars that used to be FSRepo members...
 223+ if ( !isset( $info['directory'] ) && $info['class'] === 'ForeignAPIRepo' ) {
 224+ $info['directory'] = $wgUploadDirectory; // b/c
 225+ }
223226 $directory = $info['directory'];
224227 $deletedDir = isset( $info['deletedDir'] )
225228 ? $info['deletedDir']
Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php
@@ -37,10 +37,7 @@
3838 protected $mFileExists = array();
3939
4040 function __construct( $info ) {
41 - global $wgLocalFileRepo, $wgUploadDirectory;
42 - if ( !isset( $info['directory'] ) ) { // b/c
43 - $info['directory'] = $wgUploadDirectory; // Local image directory
44 - }
 41+ global $wgLocalFileRepo;
4542 parent::__construct( $info );
4643
4744 // http://commons.wikimedia.org/w/api.php

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106752Merged FileBackend branch. Manually avoiding merging the many prop-only chang...aaron03:52, 20 December 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   20:02, 20 December 2011

What was wrong with the previous code instantiating the setting at constructor time?

#Comment by Aaron Schulz (talk | contribs)   20:31, 20 December 2011

It actually had no affect since FileRepo doesn't check those things anymore (the b/c is in Setup.php).

#Comment by Brion VIBBER (talk | contribs)   21:06, 20 December 2011

Not sure I understand. Both bits of code appear to do the same thing at different times. Does something other than ForeignFileRepo/FileRepo use the 'directory' entry of the $info parameter, you mean?

#Comment by Tim Starling (talk | contribs)   05:56, 21 December 2011

Yes, the only thing that uses $info['directory'] is line 225 of Setup.php:

 	$directory = $info['directory'];

Status & tagging log