Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
IndexNamespaces
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 execute
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace CirrusSearch\Maintenance;
4
5use MediaWiki\MediaWikiServices;
6
7/**
8 * Index all namespaces for quick lookup.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * http://www.gnu.org/copyleft/gpl.html
24 */
25
26$IP = getenv( 'MW_INSTALL_PATH' );
27if ( $IP === false ) {
28    $IP = __DIR__ . '/../../..';
29}
30require_once "$IP/maintenance/Maintenance.php";
31require_once __DIR__ . '/../includes/Maintenance/Maintenance.php';
32
33class IndexNamespaces extends Maintenance {
34
35    public function execute() {
36        // We allow automatic creation, rather than requiring pre-existance like
37        // other scripts, to make initial setup simple and straight forward. In
38        // most fresh installations the metastore is first created here when invoked
39        // by UpdateSearchIndexConfig.
40        $store = $this->maybeCreateMetastore()->namespaceStore();
41        $this->outputIndented( "Indexing namespaces..." );
42        $store->reindex( MediaWikiServices::getInstance()->getContentLanguage() );
43        $this->output( "done\n" );
44
45        return true;
46    }
47}
48
49$maintClass = IndexNamespaces::class;
50require_once RUN_MAINTENANCE_IF_MAIN;