28require_once __DIR__ .
'/Maintenance.php';
44 parent::__construct();
45 $this->
addDescription(
'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 );
59 if ( $this->db->getType() ==
'sqlite' ) {
61 $this->
error(
"Your version of SQLite module for PHP doesn't "
62 .
"support full-text search (FTS3).\n",
true );
64 if ( !$this->db->checkForEnabledSearch() ) {
65 $this->
error(
"Your database schema is not configured for "
66 .
"full-text search support. Run update.php.\n",
true );
70 if ( $this->db->getType() ==
'mysql' ) {
80 $this->
output(
"Done.\n" );
87 $res = $this->db->select(
'page',
'MAX(page_id) AS count' );
88 $s = $this->db->fetchObject(
$res );
90 $this->
output(
"Rebuilding index fields for {$count} pages...\n" );
93 $fields = array_merge(
101 $this->
output( $n .
"\n" );
103 $end = $n + self::RTI_CHUNK_SIZE - 1;
105 $res = $this->db->select( [
'page',
'revision',
'text' ], $fields,
106 [
"page_id BETWEEN $n AND $end",
'page_latest = rev_id',
'rev_text_id = old_id' ],
120 $this->
output(
"Failed to deserialize content of revision {$s->rev_id} of page "
121 .
"`" .
$title->getPrefixedDBkey() .
"`!\n" );
132 $searchindex = $this->db->tableName(
'searchindex' );
133 if ( $this->db->indexExists(
'searchindex',
'si_title', __METHOD__ ) ) {
134 $this->
output(
"Dropping index...\n" );
135 $sql =
"ALTER TABLE $searchindex DROP INDEX si_title, DROP INDEX si_text";
136 $this->db->query( $sql, __METHOD__ );
144 $searchindex = $this->db->tableName(
'searchindex' );
145 $this->
output(
"\nRebuild the index...\n" );
146 $sql =
"ALTER TABLE $searchindex ADD FULLTEXT si_title (si_title), " .
147 "ADD FULLTEXT si_text (si_text)";
148 $this->db->query( $sql, __METHOD__ );
155 $this->
output(
'Clearing searchindex table...' );
156 $this->db->delete(
'searchindex',
'*', __METHOD__ );
157 $this->
output(
"Done\n" );
Database abstraction object.
static getFulltextSearchModule()
Returns version of currently supported SQLite fulltext search module or false if none present.
Exception representing a failure to serialize or unserialize a content object.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
error( $err, $die=0)
Throw an error to the user.
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
addDescription( $text)
Set the description text.
Maintenance script that rebuilds search index table from scratch.
execute()
Do the actual work.
dropMysqlTextIndex()
(MySQL only) Drops fulltext index before populating the table.
createMysqlTextIndex()
(MySQL only) Adds back fulltext index after populating the table.
clearSearchIndex()
Deletes everything from search index.
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
__construct()
Default constructor.
populateSearchIndex()
Populates the search index with content from all pages.
static selectTextFields()
Return the list of text fields that should be selected to read the revision text.
static selectPageFields()
Return the list of page fields that should be selected from page table.
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
Database independant search index updater.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
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
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
namespace and then decline to actually register it file or subcat img or subcat $title
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
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
require_once RUN_MAINTENANCE_IF_MAIN