Sbisson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403479 )

Change subject: Tentatively re-enable ORES filters on RecentChangesLinked
......................................................................

Tentatively re-enable ORES filters on RecentChangesLinked

Enabled behind a flag (experimental_ores_on_rcl=1) so we
can try it in production without exposing users to it
just yet.

Bug: T179718
Change-Id: I5f8a16cb55c85532e123896111b492babb9982cc
---
M includes/Hooks/ChangesListHooksHandler.php
1 file changed, 30 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES 
refs/changes/79/403479/1

diff --git a/includes/Hooks/ChangesListHooksHandler.php 
b/includes/Hooks/ChangesListHooksHandler.php
index c8ff331..8814119 100644
--- a/includes/Hooks/ChangesListHooksHandler.php
+++ b/includes/Hooks/ChangesListHooksHandler.php
@@ -37,9 +37,11 @@
        public static function onChangesListSpecialPageStructuredFilters(
                ChangesListSpecialPage $clsp
        ) {
-               // ORES is disabled on Recentchangeslinked: T163063
-               if ( !Hooks::oresUiEnabled( $clsp->getUser() ) || 
$clsp->getName() === 'Recentchangeslinked'
-               ) {
+               if ( !Hooks::oresUiEnabled( $clsp->getUser() ) ) {
+                       return;
+               }
+
+               if ( self::oresDisabledOnRcl( $clsp->getName(), 
$clsp->getContext()->getRequest() ) ) {
                        return;
                }
 
@@ -88,8 +90,7 @@
                                                        // Make the joins INNER 
JOINs instead of LEFT JOINs
                                                        
$join_conds['ores_damaging_mdl'][0] = 'INNER JOIN';
                                                        
$join_conds['ores_damaging_cls'][0] = 'INNER JOIN';
-                                                       // Performance hack: 
add STRAIGHT_JOIN (T146111) but not for Watchlist (T176456 / T164796)
-                                                       if ( $specialClassName 
!== 'SpecialWatchlist' ) {
+                                                       if ( 
self::shouldStraightJoin( $specialClassName ) ) {
                                                                
$query_options[] = 'STRAIGHT_JOIN';
                                                        }
                                                }
@@ -175,8 +176,7 @@
                                                        // Make the joins INNER 
JOINs instead of LEFT JOINs
                                                        
$join_conds['ores_damaging_mdl'][0] = 'INNER JOIN';
                                                        
$join_conds['ores_damaging_cls'][0] = 'INNER JOIN';
-                                                       // Performance hack: 
add STRAIGHT_JOIN (T146111) but not for Watchlist (T176456 / T164796)
-                                                       if ( $specialClassName 
!== 'SpecialWatchlist' ) {
+                                                       if ( 
self::shouldStraightJoin( $specialClassName ) ) {
                                                                
$query_options[] = 'STRAIGHT_JOIN';
                                                        }
                                                },
@@ -216,8 +216,7 @@
                                                        // Make the joins INNER 
JOINs instead of LEFT JOINs
                                                        
$join_conds['ores_goodfaith_mdl'][0] = 'INNER JOIN';
                                                        
$join_conds['ores_goodfaith_cls'][0] = 'INNER JOIN';
-                                                       // Performance hack: 
add STRAIGHT_JOIN (T146111) but not for Watchlist (T176456 / T164796)
-                                                       if ( $specialClassName 
!== 'SpecialWatchlist' ) {
+                                                       if ( 
self::shouldStraightJoin( $specialClassName ) ) {
                                                                
$query_options[] = 'STRAIGHT_JOIN';
                                                        }
                                                }
@@ -252,6 +251,13 @@
                                $clsp->registerFilterGroup( $goodfaithGroup );
                        }
                }
+       }
+
+       private static function shouldStraightJoin( $specialClassName ) {
+               // Performance hack: add STRAIGHT_JOIN (T146111) but not for 
Watchlist (T176456 / T164796)
+               // New theory is that STRAIGHT JOIN should be used for 
unfiltered queries (RecentChanges)
+               // but not for filtered queries (Watchlist and 
RecentChangesLinked) (T179718)
+               return $specialClassName === 'SpecialRecentChanges';
        }
 
        private static function getDamagingStructuredFiltersOnChangesList( 
array $damagingLevels ) {
@@ -371,10 +377,13 @@
                $name, array &$tables, array &$fields, array &$conds,
                array &$query_options, array &$join_conds, FormOptions $opts
        ) {
-               global $wgUser;
+               global $wgUser, $wgRequest;
 
-               // ORES is disabled on Recentchangeslinked: T163063
-               if ( !Hooks::oresUiEnabled( $wgUser ) || $name === 
'Recentchangeslinked' ) {
+               if ( !Hooks::oresUiEnabled( $wgUser ) ) {
+                       return;
+               }
+
+               if ( self::oresDisabledOnRcl( $name, $wgRequest ) ) {
                        return;
                }
 
@@ -597,4 +606,13 @@
                }
        }
 
+       private static function oresDisabledOnRcl( $name, $request ) {
+               return (
+                       // ORES is disabled on Recentchangeslinked: T163063
+                       $name === 'Recentchangeslinked' &&
+                       // Tentatively re-enabled behind a request param for 
testing: T179718
+                       !$request->getBool( 'experimental_ores_on_rcl' )
+               );
+       }
+
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f8a16cb55c85532e123896111b492babb9982cc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Sbisson <sbis...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to