From 8e87dd16b8be8cb8f1d8e28267ee9a413c9a6d70 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sat, 9 Sep 2017 02:10:41 -0700 Subject: [PATCH] LocalFile: Fix setting $this->description after CommentStore changes Bug: T175444 Bug: T175443 Change-Id: I3447a4129300c2c7dc0d585404e7747b6a5e2b77 --- includes/filerepo/file/LocalFile.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 810f788dfe..6d003d64bf 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -347,7 +347,7 @@ class LocalFile extends File { function getCacheFields( $prefix = 'img_' ) { static $fields = [ 'size', 'width', 'height', 'bits', 'media_type', 'major_mime', 'minor_mime', 'metadata', 'timestamp', 'sha1', 'user', - 'user_text', 'description' ]; + 'user_text' ]; static $results = []; if ( $prefix == '' ) { @@ -359,6 +359,7 @@ class LocalFile extends File { foreach ( $fields as $field ) { $prefixedFields[] = $prefix . $field; } + $prefixedFields += CommentStore::newKey( "{$prefix}description" )->getFields(); $results[$prefix] = $prefixedFields; } @@ -536,6 +537,9 @@ class LocalFile extends File { $this->dataLoaded = true; $this->extraDataLoaded = true; + $this->description = CommentStore::newKey( "{$prefix}description" ) + ->getComment( $row )->text; + $array = $this->decodeRow( $row, $prefix ); foreach ( $array as $name => $value ) { -- 2.20.1