r69869 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69868‎ | r69869 | r69870 >
Date:11:40, 25 July 2010
Author:ialex
Status:ok
Tags:
Comment:
* (bug 24517) LocalFile::newFromKey() and OldLocalFile::newFromKey() no longer throw fatal errors
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/OldLocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/OldLocalFile.php
@@ -30,14 +30,12 @@
3131 }
3232
3333 static function newFromKey( $sha1, $repo, $timestamp = false ) {
34 - # Polymorphic function name to distinguish foreign and local fetches
35 - $fname = get_class( $this ) . '::' . __FUNCTION__;
36 -
3734 $conds = array( 'oi_sha1' => $sha1 );
3835 if( $timestamp ) {
3936 $conds['oi_timestamp'] = $timestamp;
4037 }
41 - $row = $dbr->selectRow( 'oldimage', $this->getCacheFields( 'oi_' ), $conds, $fname );
 38+ $dbr = $repo->getSlaveDB();
 39+ $row = $dbr->selectRow( 'oldimage', self::selectFields(), $conds, __METHOD__ );
4240 if( $row ) {
4341 return self::newFromRow( $row, $repo );
4442 } else {
Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -79,14 +79,12 @@
8080 * Do not call this except from inside a repo class.
8181 */
8282 static function newFromKey( $sha1, $repo, $timestamp = false ) {
83 - # Polymorphic function name to distinguish foreign and local fetches
84 - $fname = get_class( $this ) . '::' . __FUNCTION__;
85 -
8683 $conds = array( 'img_sha1' => $sha1 );
8784 if( $timestamp ) {
8885 $conds['img_timestamp'] = $timestamp;
8986 }
90 - $row = $dbr->selectRow( 'image', $this->getCacheFields( 'img_' ), $conds, $fname );
 87+ $dbr = $repo->getSlaveDB();
 88+ $row = $dbr->selectRow( 'image', self::selectFields(), $conds, __METHOD__ );
9189 if( $row ) {
9290 return self::newFromRow( $row, $repo );
9391 } else {
Index: trunk/phase3/RELEASE-NOTES
@@ -247,6 +247,8 @@
248248 * (bug 23293) Do not show change tags when special:recentchanges(linked)
249249 or special:newpages is transcluded into another page as it messes up the
250250 page.
 251+* (bug 24517) LocalFile::newFromKey() and OldLocalFile::newFromKey() no longer
 252+ throw fatal errors
251253
252254 === API changes in 1.17 ===
253255 * (bug 22738) Allow filtering by action type on query=logevent.

Status & tagging log