summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/scripts/createMessageIndex.php
blob: 9005fef48eedf6e82a57a3cd9e46a0771351573d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
 * Creates a database of keys in all groups, so that namespace and key can be
 * used to get the group they belong to. This is used as a fallback when there
 * is no other way to know which message group a message belongs to.
 *
 * @author Niklas Laxström
 * @license GPL-2.0-or-later
 * @file
 */

// Standard boilerplate to define $IP
if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
	$IP = getenv( 'MW_INSTALL_PATH' );
} else {
	$dir = __DIR__;
	$IP = "$dir/../../..";
}
require_once "$IP/maintenance/Maintenance.php";

class CreateMessageIndex extends Maintenance {
	public function __construct() {
		parent::__construct();
		$this->mDescription = 'Creates or updates a message index.';
	}

	public function execute() {
		MessageGroups::singleton()->recache();
		MessageIndex::singleton()->rebuild();
	}
}

$maintClass = CreateMessageIndex::class;
require_once RUN_MAINTENANCE_IF_MAIN;