35 $search, $namespaces, $category, $prefix, $use_regex =
false
38 $tables = [
'page',
'revision',
'text',
'slots',
'content' ];
39 $vars = [
'page_id',
'page_namespace',
'page_title',
'old_text' ];
43 $any =
$dbr->anyString();
44 $comparisonCond =
'old_text ' .
$dbr->buildLike( $any, $search, $any );
48 'page_namespace' => $namespaces,
49 'rev_id = page_latest',
50 'rev_id = slot_revision_id',
51 'slot_content_id = content_id',
52 'SUBSTRING(content_address, 4) = old_id'
58 'ORDER BY' =>
'page_namespace, page_title',
64 return $dbr->select( $tables, $vars, $conds, __METHOD__, $options );
73 if ( strval( $category ) !==
'' ) {
74 $category = Title::newFromText( $category )->getDbKey();
75 $tables[] =
'categorylinks';
76 $conds[] =
'page_id = cl_from';
77 $conds[
'cl_to'] = $category;
86 if ( strval( $prefix ) ===
'' ) {
91 $title = Title::newFromText( $prefix );
92 if ( !is_null(
$title ) ) {
93 $prefix =
$title->getDbKey();
95 $any =
$dbr->anyString();
96 $conds[] =
'page_title ' .
$dbr->buildLike( $prefix, $any );
106 if (
$dbr->getType() ==
'postgres' ) {
111 return "$column $op " .
$dbr->addQuotes( $regex );
131 $tables = [
'page' ];
132 $vars = [
'page_title',
'page_namespace' ];
134 $str = str_replace(
' ',
'_', $str );
138 $any =
$dbr->anyString();
139 $comparisonCond =
'page_title ' .
$dbr->buildLike( $any, $str, $any );
143 'page_namespace' => $namespaces,
148 $sort = [
'ORDER BY' =>
'page_namespace, page_title' ];
150 return $dbr->select( $tables, $vars, $conds, __METHOD__,
$sort );
163 $escapedSearch = addcslashes( $search,
'/' );
164 return preg_replace(
"/$escapedSearch/Uu", $replacement, $text );
166 return str_replace( $search, $replacement, $text );
179 $oldTitleText =
$title->getText();
181 return Title::makeTitleSafe(
$title->getNamespace(), $newTitleText );
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
static categoryCondition( $category, &$tables, &$conds)
static regexCond( $dbr, $column, $regex)
static doSearchQuery( $search, $namespaces, $category, $prefix, $use_regex=false)
static getReplacedText( $text, $search, $replacement, $regex)
Do a replacement on a string.
static getReplacedTitle(Title $title, $search, $replacement, $regex)
Do a replacement on a title.
static prefixCondition( $prefix, &$conds)
static getMatchingTitles( $str, $namespaces, $category, $prefix, $use_regex=false)
Represents a title within MediaWiki.