* (bug 24517) LocalFile::newFromKey() and OldLocalFile::newFromKey() no longer throw...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 25 Jul 2010 11:40:52 +0000 (11:40 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 25 Jul 2010 11:40:52 +0000 (11:40 +0000)
RELEASE-NOTES
includes/filerepo/LocalFile.php
includes/filerepo/OldLocalFile.php

index 996ab9e..eae75a3 100644 (file)
@@ -247,6 +247,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 23293) Do not show change tags when special:recentchanges(linked)
   or special:newpages is transcluded into another page as it messes up the
   page.
+* (bug 24517) LocalFile::newFromKey() and OldLocalFile::newFromKey() no longer
+  throw fatal errors
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent.
index c321d91..b35ba0b 100644 (file)
@@ -79,14 +79,12 @@ class LocalFile extends File {
         * Do not call this except from inside a repo class.
         */
        static function newFromKey( $sha1, $repo, $timestamp = false ) {
-               # Polymorphic function name to distinguish foreign and local fetches
-               $fname = get_class( $this ) . '::' . __FUNCTION__;
-
                $conds = array( 'img_sha1' => $sha1 );
                if( $timestamp ) {
                        $conds['img_timestamp'] = $timestamp;
                }
-               $row = $dbr->selectRow( 'image', $this->getCacheFields( 'img_' ), $conds, $fname );
+               $dbr = $repo->getSlaveDB();
+               $row = $dbr->selectRow( 'image', self::selectFields(), $conds, __METHOD__ );
                if( $row ) {
                        return self::newFromRow( $row, $repo );
                } else {
index d6cc709..7769271 100644 (file)
@@ -30,14 +30,12 @@ class OldLocalFile extends LocalFile {
        }
        
        static function newFromKey( $sha1, $repo, $timestamp = false ) {
-               # Polymorphic function name to distinguish foreign and local fetches
-               $fname = get_class( $this ) . '::' . __FUNCTION__;
-
                $conds = array( 'oi_sha1' => $sha1 );
                if( $timestamp ) {
                        $conds['oi_timestamp'] = $timestamp;
                }
-               $row = $dbr->selectRow( 'oldimage', $this->getCacheFields( 'oi_' ), $conds, $fname );
+               $dbr = $repo->getSlaveDB();
+               $row = $dbr->selectRow( 'oldimage', self::selectFields(), $conds, __METHOD__ );
                if( $row ) {
                        return self::newFromRow( $row, $repo );
                } else {