From 3d299a548ff013817e0772ba96db071b495ce17a Mon Sep 17 00:00:00 2001 From: Fomafix Date: Sun, 11 Feb 2024 13:00:20 +0000 Subject: [PATCH] Replace global variables in Search Change-Id: I1dfbe55be5b93a829a3a9ab98ed703ec2213d008 --- src/Search.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Search.php b/src/Search.php index caa8578b..dfe7d13c 100644 --- a/src/Search.php +++ b/src/Search.php @@ -38,8 +38,6 @@ class Search { public static function doSearchQuery( $search, $namespaces, $category, $prefix, $pageLimit, $use_regex = false ) { - global $wgReplaceTextResultsLimit; - $dbr = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->getReplicaDatabase(); $tables = [ 'page', 'revision', 'text', 'slots', 'content' ]; $vars = [ 'page_id', 'page_namespace', 'page_title', 'old_text', 'slot_role_id' ]; @@ -58,7 +56,7 @@ class Search { $dbr->buildIntegerCast( 'SUBSTR(content_address, 4)' ) . ' = old_id' ]; if ( $pageLimit === null || $pageLimit === '' ) { - $pageLimit = $wgReplaceTextResultsLimit; + $pageLimit = MediaWikiServices::getInstance()->getMainConfig()->get( 'ReplaceTextResultsLimit' ); } self::categoryCondition( $category, $tables, $conds ); self::prefixCondition( $prefix, $conds ); @@ -136,8 +134,6 @@ class Search { $pageLimit, $use_regex = false ) { - global $wgReplaceTextResultsLimit; - $dbr = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->getReplicaDatabase(); $tables = [ 'page' ]; @@ -155,7 +151,7 @@ class Search { 'page_namespace' => $namespaces, ]; if ( $pageLimit === null || $pageLimit === '' ) { - $pageLimit = $wgReplaceTextResultsLimit; + $pageLimit = MediaWikiServices::getInstance()->getMainConfig()->get( 'ReplaceTextResultsLimit' ); } self::categoryCondition( $category, $tables, $conds ); self::prefixCondition( $prefix, $conds );