Replace global variables in Search

Change-Id: I1dfbe55be5b93a829a3a9ab98ed703ec2213d008
This commit is contained in:
Fomafix 2024-02-11 13:00:20 +00:00 committed by DannyS712
parent 082686abe4
commit 3d299a548f

View file

@ -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 );