From: Russ Nelson Date: Sun, 29 May 2011 01:27:47 +0000 (+0000) Subject: There is no getThumbRel; X-Git-Tag: 1.31.0-rc.0~29878 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=95df17db7a4d0c5f186c8b06e73dfa333c290cf4;p=lhc%2Fweb%2Fwiklou.git 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. --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 5ddbbc0c65..60b896490b 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 diff --git a/includes/filerepo/FSRepo.php b/includes/filerepo/FSRepo.php index 5739fbebf7..9049de1e3e 100644 --- a/includes/filerepo/FSRepo.php +++ b/includes/filerepo/FSRepo.php @@ -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; diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index 15b419120e..dd0e31583c 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -814,7 +814,6 @@ class LocalFile extends File { /** getRel inherited */ /** getUrlRel inherited */ /** getArchiveRel inherited */ - /** getThumbRel inherited */ /** getArchivePath inherited */ /** getThumbPath inherited */ /** getArchiveUrl inherited */