Hello Daniel Kinzler, Tim Starling, Legoktm,

I'd like you to do a code review.  Please visit

    https://gerrit.wikimedia.org/r/383920

to review the following change.


Change subject: Update for deprecation of selectFields() methods
......................................................................

Update for deprecation of selectFields() methods

Various selectFields() methods were deprecated in MediaWiki core change
Idcfd1556. This change adapts the extension to use the replacement
getQueryInfo() methods when available.

Change-Id: Ia81bf6a655af800ce8ac19940d851e65746e1f77
---
M BaseBlacklist.php
1 file changed, 20 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SpamBlacklist 
refs/changes/20/383920/1

diff --git a/BaseBlacklist.php b/BaseBlacklist.php
index 1a25297..4063859 100644
--- a/BaseBlacklist.php
+++ b/BaseBlacklist.php
@@ -372,20 +372,31 @@
                // Load all the relevant tables from the correct DB.
                // This assumes that old_text is the actual text or
                // that the external store system is at least unified.
+               if ( is_callable( Revision::class, 'getQueryInfo' ) ) {
+                       $revQuery = Revision::getQueryInfo( [ 'page', 'text' ] 
);
+               } else {
+                       $revQuery = [
+                               'tables' => [ 'revision', 'page', 'text' ],
+                               'fields' => array_merge(
+                                       Revision::selectFields(),
+                                       Revision::selectPageFields(),
+                                       Revision::selectTextFields()
+                               ),
+                               'joins' => [
+                                       'text' => [ 'JOIN', 
'old_id=rev_text_id' ]
+                               ],
+                       ];
+               }
                $row = wfGetDB( DB_REPLICA, [], $wiki )->selectRow(
-                       [ 'page', 'revision', 'text' ],
-                       array_merge(
-                               Revision::selectFields(),
-                               Revision::selectPageFields(),
-                               Revision::selectTextFields()
-                       ),
+                       $revQuery['tables'],
+                       $revQuery['fields'],
                        [
                                'page_namespace' => $title->getNamespace(), // 
assume NS IDs match
                                'page_title' => $title->getDBkey(), // assume 
same case rules
-                               'rev_id=page_latest',
-                               'old_id=rev_text_id'
                        ],
-                       __METHOD__
+                       __METHOD__,
+                       [],
+                       [ 'page' => [ 'JOIN', 'rev_id=page_latest' ] ] + 
$revQuery['joins']
                );
 
                return $row

-- 
To view, visit https://gerrit.wikimedia.org/r/383920
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia81bf6a655af800ce8ac19940d851e65746e1f77
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SpamBlacklist
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to