summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/scripts/createMessageIndex.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/Translate/scripts/createMessageIndex.php')
-rw-r--r--www/wiki/extensions/Translate/scripts/createMessageIndex.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/www/wiki/extensions/Translate/scripts/createMessageIndex.php b/www/wiki/extensions/Translate/scripts/createMessageIndex.php
new file mode 100644
index 00000000..9005fef4
--- /dev/null
+++ b/www/wiki/extensions/Translate/scripts/createMessageIndex.php
@@ -0,0 +1,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;