Unhardcode the limit "find no more than 250 results" in doSearchQuery()

Here we add $wgReplaceTextResultsLimit variable (default: 250) to allow
administrator to change this limit.

Change-Id: Iee9d958db8ddd245a98ec6a3d5b5cf8ef1d80370
This commit is contained in:
Edward Chernenko 2018-11-16 00:24:38 +03:00
parent efb62c28a2
commit b7cf9f4b09
2 changed files with 4 additions and 3 deletions

View file

@ -78,6 +78,7 @@
]
},
"config": {
"ReplaceTextResultsLimit": 250,
"ReplaceTextUser": null
},
"manifest_version": 1

View file

@ -34,6 +34,8 @@ class ReplaceTextSearch {
public static function doSearchQuery(
$search, $namespaces, $category, $prefix, $use_regex = false
) {
global $wgReplaceTextResultsLimit;
$dbr = wfGetDB( DB_REPLICA );
$tables = [ 'page', 'revision', 'text', 'slots', 'content' ];
$vars = [ 'page_id', 'page_namespace', 'page_title', 'old_text' ];
@ -56,9 +58,7 @@ class ReplaceTextSearch {
self::prefixCondition( $prefix, $conds );
$options = [
'ORDER BY' => 'page_namespace, page_title',
// 250 seems like a reasonable limit for one screen.
// @TODO - should probably be a setting.
'LIMIT' => 250
'LIMIT' => $wgReplaceTextResultsLimit
];
return $dbr->select( $tables, $vars, $conds, __METHOD__, $options );