From 14c74d6a58a1fffa67966b6ac2375c576cc78abb Mon Sep 17 00:00:00 2001 From: Ike Hecht Date: Sat, 22 Aug 2026 23:48:44 -0400 Subject: [PATCH] SLOP-393: replace removed MWNamespace class; drop dead page_counter column - MWNamespace::getCanonicalNamespaces() was removed in MW 1.39 and fatals the Special:WatchAnalytics pages list (default view); use NamespaceInfo::getCanonicalNamespaces() instead. - The #watchers_needed query selected p.page_counter, a page-table column removed in MW 1.25, making the parser function fatal with an SQL error on every use. Drop the view_watch_ratio computation (the data source no longer exists) and rank by fewest watches instead, which preserves the function's purpose. --- includes/WatchAnalyticsPageTablePager.php | 2 +- includes/WatchAnalyticsParserFunctions.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/includes/WatchAnalyticsPageTablePager.php b/includes/WatchAnalyticsPageTablePager.php index a06b355..a0f2d95 100644 --- a/includes/WatchAnalyticsPageTablePager.php +++ b/includes/WatchAnalyticsPageTablePager.php @@ -30,7 +30,7 @@ public function __construct( $page, $conds, $filters = [] ) { } public function getQueryInfo() { - $namespaces = MWNamespace::getCanonicalNamespaces(); + $namespaces = MediaWikiServices::getInstance()->getNamespaceInfo()->getCanonicalNamespaces(); if ( $this->mQueryNamespace !== null && $this->mQueryNamespace >= 0 diff --git a/includes/WatchAnalyticsParserFunctions.php b/includes/WatchAnalyticsParserFunctions.php index 881267c..b073dcf 100644 --- a/includes/WatchAnalyticsParserFunctions.php +++ b/includes/WatchAnalyticsParserFunctions.php @@ -162,8 +162,7 @@ public static function renderWatchersNeeded( &$parser, $frame, $args ) { p.page_title AS page_title, p.page_namespace AS page_namespace, SUM( IF(w.wl_title IS NOT NULL, 1, 0) ) AS num_watches, - SUM( IF(w.wl_user = $wgUserId, 1, 0) ) AS wg_user_watches, - p.page_counter / SUM( IF(w.wl_title IS NOT NULL, 1, 0) ) AS view_watch_ratio + SUM( IF(w.wl_user = $wgUserId, 1, 0) ) AS wg_user_watches FROM watchlist AS w LEFT JOIN page AS p ON @@ -178,7 +177,7 @@ public static function renderWatchersNeeded( &$parser, $frame, $args ) { GROUP BY p.page_title, p.page_namespace ORDER BY - view_watch_ratio DESC + num_watches ASC ) AS tmp WHERE num_watches <= $maxWatchers