Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
RebuildAll | |
0.00% |
0 / 16 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getDbType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
execute | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | /** |
3 | * Rebuild link tracking tables from scratch. This takes several |
4 | * hours, depending on the database size and server configuration. |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. |
10 | * |
11 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU General Public License along |
17 | * with this program; if not, write to the Free Software Foundation, Inc., |
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | * http://www.gnu.org/copyleft/gpl.html |
20 | * |
21 | * @file |
22 | * @ingroup Maintenance |
23 | */ |
24 | |
25 | use MediaWiki\Maintenance\Maintenance; |
26 | |
27 | // @codeCoverageIgnoreStart |
28 | require_once __DIR__ . '/Maintenance.php'; |
29 | // @codeCoverageIgnoreEnd |
30 | |
31 | /** |
32 | * Maintenance script that rebuilds link tracking tables from scratch. |
33 | * |
34 | * @ingroup Maintenance |
35 | */ |
36 | class RebuildAll extends Maintenance { |
37 | public function __construct() { |
38 | parent::__construct(); |
39 | $this->addDescription( 'Rebuild links, text index and recent changes' ); |
40 | } |
41 | |
42 | public function getDbType() { |
43 | return Maintenance::DB_ADMIN; |
44 | } |
45 | |
46 | public function execute() { |
47 | // Rebuild the text index |
48 | if ( $this->getReplicaDB()->getType() != 'postgres' ) { |
49 | $this->output( "** Rebuilding fulltext search index (if you abort " |
50 | . "this will break searching; run this script again to fix):\n" ); |
51 | $rebuildText = $this->runChild( RebuildTextIndex::class, 'rebuildtextindex.php' ); |
52 | $rebuildText->execute(); |
53 | } |
54 | |
55 | // Rebuild RC |
56 | $this->output( "\n\n** Rebuilding recentchanges table:\n" ); |
57 | $rebuildRC = $this->runChild( RebuildRecentchanges::class, 'rebuildrecentchanges.php' ); |
58 | $rebuildRC->execute(); |
59 | |
60 | // Rebuild link tables |
61 | $this->output( "\n\n** Rebuilding links tables -- this can take a long time. " |
62 | . "It should be safe to abort via ctrl+C if you get bored.\n" ); |
63 | $rebuildLinks = $this->runChild( RefreshLinks::class, 'refreshLinks.php' ); |
64 | $rebuildLinks->execute(); |
65 | |
66 | $this->output( "Done.\n" ); |
67 | } |
68 | } |
69 | |
70 | // @codeCoverageIgnoreStart |
71 | $maintClass = RebuildAll::class; |
72 | require_once RUN_MAINTENANCE_IF_MAIN; |
73 | // @codeCoverageIgnoreEnd |