MediaWiki master
rebuildall.php
Go to the documentation of this file.
1<?php
12
13// @codeCoverageIgnoreStart
14require_once __DIR__ . '/Maintenance.php';
15// @codeCoverageIgnoreEnd
16
22class RebuildAll extends Maintenance {
23 public function __construct() {
24 parent::__construct();
25 $this->addDescription( 'Rebuild links, text index and recent changes' );
26 }
27
29 public function getDbType() {
30 return Maintenance::DB_ADMIN;
31 }
32
33 public function execute() {
34 // Rebuild the text index
35 if ( $this->getReplicaDB()->getType() != 'postgres' ) {
36 $this->output( "** Rebuilding fulltext search index (if you abort "
37 . "this will break searching; run this script again to fix):\n" );
38 $rebuildText = $this->createChild( RebuildTextIndex::class, 'rebuildtextindex.php' );
39 $rebuildText->execute();
40 }
41
42 // Rebuild RC
43 $this->output( "\n\n** Rebuilding recentchanges table:\n" );
44 $rebuildRC = $this->createChild( RebuildRecentchanges::class, 'rebuildrecentchanges.php' );
45 $rebuildRC->execute();
46
47 // Rebuild link tables
48 $this->output( "\n\n** Rebuilding links tables -- this can take a long time. "
49 . "It should be safe to abort via ctrl+C if you get bored.\n" );
50 $rebuildLinks = $this->createChild( RefreshLinks::class, 'refreshLinks.php' );
51 $rebuildLinks->execute();
52
53 $this->output( "Done.\n" );
54 }
55}
56
57// @codeCoverageIgnoreStart
58$maintClass = RebuildAll::class;
59require_once RUN_MAINTENANCE_IF_MAIN;
60// @codeCoverageIgnoreEnd
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
createChild(string $maintClass, ?string $classFile=null)
Returns an instance of the given maintenance script, with all of the current arguments passed to it.
output( $out, $channel=null)
Throw some output to the user.
getReplicaDB(string|false $virtualDomain=false)
addDescription( $text)
Set the description text.
Maintenance script that rebuilds link tracking tables from scratch.
__construct()
Default constructor.
execute()
Do the actual work.
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
$maintClass