Return description fields for unprefixed image cache rows
[lhc/web/wiklou.git] / includes / filerepo / file / LocalFile.php
index 8aea7ab..4c0dea2 100644 (file)
@@ -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 ) {
@@ -1129,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
@@ -1145,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' ]