From: Alexandre Emsenhuber Date: Sun, 25 Jul 2010 11:40:52 +0000 (+0000) Subject: * (bug 24517) LocalFile::newFromKey() and OldLocalFile::newFromKey() no longer throw... X-Git-Tag: 1.31.0-rc.0~35959 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=529950a08099ea58a108f607768bcf189d40efd4;p=lhc%2Fweb%2Fwiklou.git * (bug 24517) LocalFile::newFromKey() and OldLocalFile::newFromKey() no longer throw fatal errors --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 996ab9e3eb..eae75a348d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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. diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index c321d9124d..b35ba0b6a1 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -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 { diff --git a/includes/filerepo/OldLocalFile.php b/includes/filerepo/OldLocalFile.php index d6cc709d45..7769271891 100644 --- a/includes/filerepo/OldLocalFile.php +++ b/includes/filerepo/OldLocalFile.php @@ -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 {