Go to the documentation of this file.
28 require_once __DIR__ .
'/Maintenance.php';
44 parent::__construct();
45 $this->mDescription =
"Rebuild search index table from scratch";
55 if ( $this->db->getType() ==
'postgres' ) {
56 $this->
error(
"This script is not needed when using Postgres.\n",
true );
60 if ( $this->db->getType() ==
'sqlite' ) {
62 $this->
error(
"Your version of SQLite module for PHP doesn't support full-text search (FTS3).\n",
true );
64 if ( !$this->db->checkForEnabledSearch() ) {
65 $this->
error(
"Your database schema is not configured for full-text search support. Run update.php.\n",
true );
69 if ( $this->db->getType() ==
'mysql' ) {
78 $this->
output(
"Done.\n" );
85 $res = $this->db->select(
'page',
'MAX(page_id) AS count' );
86 $s = $this->db->fetchObject(
$res );
88 $this->
output(
"Rebuilding index fields for {$count} pages...\n" );
91 $fields = array_merge(
101 $end =
$n + self::RTI_CHUNK_SIZE - 1;
103 $res = $this->db->select(
array(
'page',
'revision',
'text' ), $fields,
104 array(
"page_id BETWEEN $n AND $end",
'page_latest = rev_id',
'rev_text_id = old_id' ),
113 $content =
$rev->getContent();
115 $u =
new SearchUpdate(
$s->page_id,
$title, $content );
118 $this->
output(
"Failed to deserialize content of revision {$s->rev_id} of page "
119 .
"`" .
$title->getPrefixedDBkey() .
"`!\n" );
130 $searchindex = $this->db->tableName(
'searchindex' );
131 if ( $this->db->indexExists(
'searchindex',
'si_title', __METHOD__ ) ) {
132 $this->
output(
"Dropping index...\n" );
133 $sql =
"ALTER TABLE $searchindex DROP INDEX si_title, DROP INDEX si_text";
134 $this->db->query( $sql, __METHOD__ );
142 $searchindex = $this->db->tableName(
'searchindex' );
143 $this->
output(
"\nRebuild the index...\n" );
144 $sql =
"ALTER TABLE $searchindex ADD FULLTEXT si_title (si_title), " .
145 "ADD FULLTEXT si_text (si_text)";
146 $this->db->query( $sql, __METHOD__ );
153 $this->
output(
'Clearing searchindex table...' );
154 $this->db->delete(
'searchindex',
'*', __METHOD__ );
155 $this->
output(
"Done\n" );
__construct()
Default constructor.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
dropMysqlTextIndex()
(MySQL only) Drops fulltext index before populating the table.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
require_once RUN_MAINTENANCE_IF_MAIN
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
static selectTextFields()
Return the list of text fields that should be selected to read the revision text.
Maintenance script that rebuilds search index table from scratch.
execute()
Do the actual work.
createMysqlTextIndex()
(MySQL only) Adds back fulltext index after populating the table.
Exception representing a failure to serialize or unserialize a content object.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
static selectPageFields()
Return the list of page fields that should be selected from page table.
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
presenting them properly to the user as errors is done by the caller $title
Database abstraction object.
clearSearchIndex()
Deletes everything from search index.
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
populateSearchIndex()
Populates the search index with content from all pages.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
static getFulltextSearchModule()
Returns version of currently supported SQLite fulltext search module or false if none present.