Siebrand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/88957
Change subject: Update createMessageIndex.php to use Maintenance class
......................................................................
Update createMessageIndex.php to use Maintenance class
Also removed 2 STDOUT calls from MessageIndex.php.
Change-Id: Ic366f29ef1a8444ad952e6f82b3f8d1c308f4351
---
M scripts/createMessageIndex.php
M utils/MessageIndex.php
2 files changed, 24 insertions(+), 22 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate
refs/changes/57/88957/1
diff --git a/scripts/createMessageIndex.php b/scripts/createMessageIndex.php
index c3fdf4d..e813085 100644
--- a/scripts/createMessageIndex.php
+++ b/scripts/createMessageIndex.php
@@ -11,26 +11,32 @@
* @file
*/
-require __DIR__ . '/cli.inc';
+// 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";
-function showUsage() {
- STDERR( <<<EOT
-Message index creation command line script
+class CreateMessageIndex extends Maintenance {
+ public function __construct() {
+ parent::__construct();
+ $this->mDescription = 'Creates or updates a message index.';
+ }
-Usage: php createMessageIndex.php [options...]
+ public function execute() {
+ $this->output( "Clear cache...\n" );
+ MessageGroups::clearCache();
+ $this->output( "Cleared cache.\n" );
-Options:
- --help Show this help text
- --quiet Only output errors
-
-EOT
- );
- exit( 1 );
+ $this->output( "Rebuild message index...\n" );
+ MessageIndex::singleton()->rebuild();
+ $this->output( "Rebuilt message index...\n" );
+ $this->output( "Done." );
+ }
}
-if ( isset( $options['help'] ) ) {
- showUsage();
-}
-
-MessageGroups::clearCache();
-MessageIndex::singleton()->rebuild();
+$maintClass = 'CreateMessageIndex';
+require_once DO_MAINTENANCE;
diff --git a/utils/MessageIndex.php b/utils/MessageIndex.php
index 708da2c..3796e3b 100644
--- a/utils/MessageIndex.php
+++ b/utils/MessageIndex.php
@@ -103,8 +103,6 @@
$old = $this->retrieve();
$postponed = array();
- STDOUT( "Working with ", 'main' );
-
/**
* @var MessageGroup $g
*/
@@ -198,8 +196,6 @@
}
$id = $g->getId();
-
- STDOUT( "$id ", 'main' );
$namespace = $g->getNamespace();
--
To view, visit https://gerrit.wikimedia.org/r/88957
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic366f29ef1a8444ad952e6f82b3f8d1c308f4351
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits