EBernhardson has uploaded a new change for review.

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


Change subject: New hook accomidates non-revision rc querys
......................................................................

New hook accomidates non-revision rc querys

Within Special:RecentChanges the default non-extended query contains

    ( rc_this_oldid=page_latest OR rc_type=3 )

Wikidata has previously used the SpecialWatchlistQuery hook to look for
this exact string and change rc_type=3 to rc_type IN (3,5).  Flow is another
type of change that doesn't have a matching row in revisions to match
page_latest for and needs to be added to this query.

This patch adds a new hook, SpecialWatchlistGetNonRevisionTypes, which allows
different extensions to add to a list of values for rc_type (or rc_source once
85787 is merged).  This will allow multiple extensions to affect the resulting
query without them breaking eachother.

Change-Id: Id6916fe999c0faa38de878b7b5687e7ea00901bd
---
M includes/specials/SpecialWatchlist.php
1 file changed, 15 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/51/90051/1

diff --git a/includes/specials/SpecialWatchlist.php 
b/includes/specials/SpecialWatchlist.php
index 59f0dfe..db47f05 100644
--- a/includes/specials/SpecialWatchlist.php
+++ b/includes/specials/SpecialWatchlist.php
@@ -228,7 +228,21 @@
                        $usePage = false;
                } else {
                        # Top log Ids for a page are not stored
-                       $conds[] = 'rc_this_oldid=page_latest OR rc_type=' . 
RC_LOG;
+                       $nonRevisionTypes = array( RC_LOG );
+                       wfRunHooks( 'SpecialWatchlistGetNonRevisionTypes', 
array( &$nonRevisionTypes ) );
+                       if ( $nonRevisionTypes ) {
+                               if ( count( $nonRevisionTypes ) === 1 ) {
+                                       // if only one use an equality instead 
of IN condition
+                                       $nonRevisionTypes = reset( 
$nonRevisionTypes );
+                               }
+                               $conds[] = $dbr->makeList(
+                                       array(
+                                               'rc_this_oldid=page_latest',
+                                               'rc_type' => $nonRevisionTypes,
+                                       ),
+                                       LIST_OR
+                               );
+                       }
                        $limitWatchlist = 0;
                        $usePage = true;
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6916fe999c0faa38de878b7b5687e7ea00901bd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>

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

Reply via email to