From 33ba36c88a081bf1f1c4e321e01db3b6b78b5d22 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Wed, 13 Sep 2017 08:13:02 -0400 Subject: [PATCH] Replace more problematic uses of "SELECT *" With the introduction of CommentStore, selects from various table require certain joins or column aliases for proper operation. Change-Id: I2ecb6030bf253664c3227d69b5ed2277596a83f0 --- includes/diff/DifferenceEngine.php | 3 ++- includes/filerepo/file/LocalFile.php | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 34f285235a..ed8cbb4ca3 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -181,7 +181,8 @@ class DifferenceEngine extends ContextSource { public function deletedLink( $id ) { if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) { $dbr = wfGetDB( DB_REPLICA ); - $row = $dbr->selectRow( 'archive', '*', + $row = $dbr->selectRow( 'archive', + Revision::selectArchiveFields(), [ 'ar_rev_id' => $id ], __METHOD__ ); if ( $row ) { diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 8aea7abade..96e7a7e7f9 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1129,11 +1129,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 +1143,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' ] -- 2.20.1