r89079 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89078‎ | r89079 | r89080 >
Date:01:27, 29 May 2011
Author:nelson
Status:ok
Tags:
Comment:
There is no getThumbRel;
$wgLocalFileRepo needs to self-identify as local;
the documentation and variable names for FileRepo->append() are correct, but they got positionally swapped at implementation time;
and I am checking in a matching fix to Extension:ResumableUpload in a sec.
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/filerepo/FSRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -814,7 +814,6 @@
815815 /** getRel inherited */
816816 /** getUrlRel inherited */
817817 /** getArchiveRel inherited */
818 - /** getThumbRel inherited */
819818 /** getArchivePath inherited */
820819 /** getThumbPath inherited */
821820 /** getArchiveUrl inherited */
Index: trunk/phase3/includes/filerepo/FSRepo.php
@@ -133,7 +133,7 @@
134134 */
135135 function resolveVirtualUrl( $url ) {
136136 if ( substr( $url, 0, 9 ) != 'mwrepo://' ) {
137 - throw new MWException( __METHOD__.': unknown protoocl' );
 137+ throw new MWException( __METHOD__.': unknown protocol' );
138138 }
139139
140140 $bits = explode( '/', substr( $url, 9 ), 3 );
@@ -311,34 +311,34 @@
312312 $status = $this->newGood();
313313
314314 // Resolve the virtual URL
315 - if ( self::isVirtualUrl( $srcPath ) ) {
316 - $srcPath = $this->resolveVirtualUrl( $srcPath );
 315+ if ( self::isVirtualUrl( $toAppendPath ) ) {
 316+ $toAppendPath = $this->resolveVirtualUrl( $toAppendPath );
317317 }
318318 // Make sure the files are there
 319+ if ( !is_file( $toAppendPath ) )
 320+ $status->fatal( 'filenotfound', $toAppendPath );
 321+
319322 if ( !is_file( $srcPath ) )
320323 $status->fatal( 'filenotfound', $srcPath );
321324
322 - if ( !is_file( $toAppendPath ) )
323 - $status->fatal( 'filenotfound', $toAppendPath );
324 -
325325 if ( !$status->isOk() ) return $status;
326326
327327 // Do the append
328 - $chunk = file_get_contents( $toAppendPath );
 328+ $chunk = file_get_contents( $srcPath );
329329 if( $chunk === false ) {
330 - $status->fatal( 'fileappenderrorread', $toAppendPath );
 330+ $status->fatal( 'fileappenderrorread', $srcPath );
331331 }
332332
333333 if( $status->isOk() ) {
334 - if ( file_put_contents( $srcPath, $chunk, FILE_APPEND ) ) {
335 - $status->value = $srcPath;
 334+ if ( file_put_contents( $toAppendPath, $chunk, FILE_APPEND ) ) {
 335+ $status->value = $toAppendPath;
336336 } else {
337 - $status->fatal( 'fileappenderror', $toAppendPath, $srcPath);
 337+ $status->fatal( 'fileappenderror', $srcPath, $toAppendPath);
338338 }
339339 }
340340
341341 if ( $flags & self::DELETE_SOURCE ) {
342 - unlink( $toAppendPath );
 342+ unlink( $srcPath );
343343 }
344344
345345 return $status;
Index: trunk/phase3/includes/DefaultSettings.php
@@ -316,7 +316,7 @@
317317 * - class The class name for the repository. May come from the core or an extension.
318318 * The core repository classes are LocalRepo, ForeignDBRepo, FSRepo.
319319 *
320 - * - name A unique name for the repository.
 320+ * - name A unique name for the repository (but $wgLocalFileRepo should be 'local').
321321 *
322322 * For most core repos:
323323 * - url Base public URL

Status & tagging log