From 7ed9160ea99d4ad2c0de7b985f287f0c9f0feb31 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 12 Oct 2017 15:44:48 -0400 Subject: [PATCH] Update for deprecation of selectFields() methods Various selectFields() methods were deprecated in MediaWiki core change Idcfd1556, replaced with getQueryInfo() methods. Change-Id: If75d2e76c2f166bc40a544dd502da43171ce1e7b Depends-On: Idcfd15568489d9f03a7ba4460e96610d33bc4089 --- includes/AbuseFilter.class.php | 15 +++------------ includes/Views/AbuseFilterViewExamine.php | 15 ++++++++++----- includes/Views/AbuseFilterViewTestBatch.php | 8 +++++--- includes/api/ApiAbuseFilterCheckMatch.php | 9 ++++++--- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/includes/AbuseFilter.class.php b/includes/AbuseFilter.class.php index 552a3516d..3543007cf 100644 --- a/includes/AbuseFilter.class.php +++ b/includes/AbuseFilter.class.php @@ -2151,10 +2151,7 @@ class AbuseFilter { $vars->setVar( 'ACTION', 'delete' ); if ( class_exists( CommentStore::class ) ) { - $vars->setVar( 'SUMMARY', CommentStore::newKey( 'rc_comment' ) - // $row comes from RecentChange::selectFields() - ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row )->text - ); + $vars->setVar( 'SUMMARY', CommentStore::newKey( 'rc_comment' )->getComment( $row )->text ); } else { $vars->setVar( 'SUMMARY', $row->rc_comment ); } @@ -2184,10 +2181,7 @@ class AbuseFilter { $vars->setVar( 'ACTION', 'edit' ); if ( class_exists( CommentStore::class ) ) { - $vars->setVar( 'SUMMARY', CommentStore::newKey( 'rc_comment' ) - // $row comes from RecentChange::selectFields() - ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row )->text - ); + $vars->setVar( 'SUMMARY', CommentStore::newKey( 'rc_comment' )->getComment( $row )->text ); } else { $vars->setVar( 'SUMMARY', $row->rc_comment ); } @@ -2231,10 +2225,7 @@ class AbuseFilter { ); if ( class_exists( CommentStore::class ) ) { - $vars->setVar( 'SUMMARY', CommentStore::newKey( 'rc_comment' ) - // $row comes from RecentChange::selectFields() - ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row )->text - ); + $vars->setVar( 'SUMMARY', CommentStore::newKey( 'rc_comment' )->getComment( $row )->text ); } else { $vars->setVar( 'SUMMARY', $row->rc_comment ); } diff --git a/includes/Views/AbuseFilterViewExamine.php b/includes/Views/AbuseFilterViewExamine.php index 22be4135d..8787ce28e 100644 --- a/includes/Views/AbuseFilterViewExamine.php +++ b/includes/Views/AbuseFilterViewExamine.php @@ -77,11 +77,14 @@ class AbuseFilterViewExamine extends AbuseFilterView { function showExaminerForRC( $rcid ) { // Get data $dbr = wfGetDB( DB_REPLICA ); + $rcQuery = RecentChange::getQueryInfo(); $row = $dbr->selectRow( - 'recentchanges', - RecentChange::selectFields(), + $rcQuery['tables'], + $rcQuery['fields'], [ 'rc_id' => $rcid ], - __METHOD__ + __METHOD__, + [], + $rcQuery['joins'] ); $out = $this->getOutput(); if ( !$row ) { @@ -247,11 +250,13 @@ class AbuseFilterExaminePager extends ReverseChronologicalPager { $conds[] = $this->mPage->buildTestConditions( $dbr ); + $rcQuery = RecentChange::getQueryInfo(); $info = [ - 'tables' => 'recentchanges', - 'fields' => RecentChange::selectFields(), + 'tables' => $rcQuery['tables'], + 'fields' => $rcQuery['fields'], 'conds' => array_filter( $conds ), 'options' => [ 'ORDER BY' => 'rc_timestamp DESC' ], + 'join_conds' => $rcQuery['joins'], ]; return $info; diff --git a/includes/Views/AbuseFilterViewTestBatch.php b/includes/Views/AbuseFilterViewTestBatch.php index abc33fc60..484979be8 100644 --- a/includes/Views/AbuseFilterViewTestBatch.php +++ b/includes/Views/AbuseFilterViewTestBatch.php @@ -119,12 +119,14 @@ class AbuseFilterViewTestBatch extends AbuseFilterView { $changesList = new AbuseFilterChangesList( $this->getSkin() ); $output = $changesList->beginRecentChangesList(); + $rcQuery = RecentChange::getQueryInfo(); $res = $dbr->select( - 'recentchanges', - RecentChange::selectFields(), + $rcQuery['tables'], + $rcQuery['fields'], array_filter( $conds ), __METHOD__, - [ 'LIMIT' => self::$mChangeLimit, 'ORDER BY' => 'rc_timestamp desc' ] + [ 'LIMIT' => self::$mChangeLimit, 'ORDER BY' => 'rc_timestamp desc' ], + $rcQuery['joins'] ); $counter = 1; diff --git a/includes/api/ApiAbuseFilterCheckMatch.php b/includes/api/ApiAbuseFilterCheckMatch.php index 46870e43b..58f657ace 100644 --- a/includes/api/ApiAbuseFilterCheckMatch.php +++ b/includes/api/ApiAbuseFilterCheckMatch.php @@ -19,11 +19,14 @@ class ApiAbuseFilterCheckMatch extends ApiBase { } } elseif ( $params['rcid'] ) { $dbr = wfGetDB( DB_REPLICA ); + $rcQuery = RecentChange::getQueryInfo(); $row = $dbr->selectRow( - 'recentchanges', - RecentChange::selectFields(), + $rcQuery['tables'], + $rcQuery['fields'], [ 'rc_id' => $params['rcid'] ], - __METHOD__ + __METHOD__, + [], + $rcQuery['joins'] ); if ( !$row ) {