X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Ffilerepo%2Ffile%2FLocalFile.php;h=a623c542618d961b5f7f1756d09b8636e793ecca;hp=6d003d64bf9516dc7c0bcc95390b4b8875166aa6;hb=41690888a2919b3fb89c715c364d21d8965c8b26;hpb=6c10c72d83e5414add9c0f95deed1f6682bba1d6 diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 6d003d64bf..a623c54261 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -43,7 +43,7 @@ use Wikimedia\Rdbms\IDatabase; * @ingroup FileAbstraction */ class LocalFile extends File { - const VERSION = 10; // cache version + const VERSION = 11; // cache version const CACHE_FIELD_MAX_LEN = 1000; @@ -351,9 +351,8 @@ class LocalFile extends File { static $results = []; if ( $prefix == '' ) { - return $fields; + return array_merge( $fields, [ 'description' ] ); } - if ( !isset( $results[$prefix] ) ) { $prefixedFields = []; foreach ( $fields as $field ) { @@ -538,7 +537,8 @@ class LocalFile extends File { $this->extraDataLoaded = true; $this->description = CommentStore::newKey( "{$prefix}description" ) - ->getComment( $row )->text; + // $row is probably using getFields() from self::getCacheFields() + ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row )->text; $array = $this->decodeRow( $row, $prefix ); @@ -1128,11 +1128,9 @@ class LocalFile extends File { if ( $this->historyLine == 0 ) { // called for the first time, return line from cur $this->historyRes = $dbr->select( 'image', - [ - '*', - "'' AS oi_archive_name", - '0 as oi_deleted', - 'img_sha1' + self::selectFields() + [ + 'oi_archive_name' => $dbr->addQuotes( '' ), + 'oi_deleted' => 0, ], [ 'img_name' => $this->title->getDBkey() ], $fname @@ -1144,7 +1142,9 @@ class LocalFile extends File { return false; } } elseif ( $this->historyLine == 1 ) { - $this->historyRes = $dbr->select( 'oldimage', '*', + $this->historyRes = $dbr->select( + 'oldimage', + OldLocalFile::selectFields(), [ 'oi_name' => $this->title->getDBkey() ], $fname, [ 'ORDER BY' => 'oi_timestamp DESC' ]