There is no getThumbRel;
authorRuss Nelson <nelson@users.mediawiki.org>
Sun, 29 May 2011 01:27:47 +0000 (01:27 +0000)
committerRuss Nelson <nelson@users.mediawiki.org>
Sun, 29 May 2011 01:27:47 +0000 (01:27 +0000)
$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.

includes/DefaultSettings.php
includes/filerepo/FSRepo.php
includes/filerepo/LocalFile.php

index 5ddbbc0..60b8964 100644 (file)
@@ -316,7 +316,7 @@ $wgImgAuthPublicTest = true;
  *   - class            The class name for the repository. May come from the core or an extension.
  *                      The core repository classes are LocalRepo, ForeignDBRepo, FSRepo.
  *
- *   - name                A unique name for the repository.
+ *   - name                A unique name for the repository (but $wgLocalFileRepo should be 'local').
  *
  * For most core repos:
  *   - url              Base public URL
index 5739fbe..9049de1 100644 (file)
@@ -133,7 +133,7 @@ class FSRepo extends FileRepo {
         */
        function resolveVirtualUrl( $url ) {
                if ( substr( $url, 0, 9 ) != 'mwrepo://' ) {
-                       throw new MWException( __METHOD__.': unknown protoocl' );
+                       throw new MWException( __METHOD__.': unknown protocol' );
                }
 
                $bits = explode( '/', substr( $url, 9 ), 3 );
@@ -311,34 +311,34 @@ class FSRepo extends FileRepo {
                $status = $this->newGood();
 
                // Resolve the virtual URL
-               if ( self::isVirtualUrl( $srcPath ) ) {
-                       $srcPath = $this->resolveVirtualUrl( $srcPath );
+               if ( self::isVirtualUrl( $toAppendPath ) ) {
+                       $toAppendPath = $this->resolveVirtualUrl( $toAppendPath );
                }
                // Make sure the files are there
-               if ( !is_file( $srcPath ) )
-                       $status->fatal( 'filenotfound', $srcPath );
-
                if ( !is_file( $toAppendPath ) )
                        $status->fatal( 'filenotfound', $toAppendPath );
 
+               if ( !is_file( $srcPath ) )
+                       $status->fatal( 'filenotfound', $srcPath );
+
                if ( !$status->isOk() ) return $status;
 
                // Do the append
-               $chunk = file_get_contents( $toAppendPath );
+               $chunk = file_get_contents( $srcPath );
                if( $chunk === false ) {
-                       $status->fatal( 'fileappenderrorread', $toAppendPath );
+                       $status->fatal( 'fileappenderrorread', $srcPath );
                }
 
                if( $status->isOk() ) {
-                       if ( file_put_contents( $srcPath, $chunk, FILE_APPEND ) ) {
-                               $status->value = $srcPath;
+                       if ( file_put_contents( $toAppendPath, $chunk, FILE_APPEND ) ) {
+                               $status->value = $toAppendPath;
                        } else {
-                               $status->fatal( 'fileappenderror', $toAppendPath,  $srcPath);
+                               $status->fatal( 'fileappenderror', $srcPath,  $toAppendPath);
                        }
                }
 
                if ( $flags & self::DELETE_SOURCE ) {
-                       unlink( $toAppendPath );
+                       unlink( $srcPath );
                }
 
                return $status;
index 15b4191..dd0e315 100644 (file)
@@ -814,7 +814,6 @@ class LocalFile extends File {
        /** getRel inherited */
        /** getUrlRel inherited */
        /** getArchiveRel inherited */
-       /** getThumbRel inherited */
        /** getArchivePath inherited */
        /** getThumbPath inherited */
        /** getArchiveUrl inherited */