Merge "mw.Feedback: If the message is posted remotely, link the title correctly"
[lhc/web/wiklou.git] / maintenance / rebuildLocalisationCache.php
index f89877e..4213d5f 100644 (file)
@@ -39,7 +39,7 @@ require_once __DIR__ . '/Maintenance.php';
 class RebuildLocalisationCache extends Maintenance {
        public function __construct() {
                parent::__construct();
-               $this->mDescription = "Rebuild the localisation cache";
+               $this->addDescription( 'Rebuild the localisation cache' );
                $this->addOption( 'force', 'Rebuild all files, even ones not out of date' );
                $this->addOption( 'threads', 'Fork more than one thread', false, true );
                $this->addOption( 'outdir', 'Override the output directory (normally $wgCacheDirectory)',
@@ -92,7 +92,7 @@ class RebuildLocalisationCache extends Maintenance {
                                explode( ',', $this->getOption( 'lang' ) ) );
                        # Bailed out if nothing is left
                        if ( count( $codes ) == 0 ) {
-                               $this->error( 'None of the languages specified exists.', 1 );
+                               $this->fatalError( 'None of the languages specified exists.' );
                        }
                } else {
                        # By default get all languages
@@ -104,7 +104,7 @@ class RebuildLocalisationCache extends Maintenance {
                $numRebuilt = 0;
                $total = count( $codes );
                $chunks = array_chunk( $codes, ceil( count( $codes ) / $threads ) );
-               $pids = array();
+               $pids = [];
                $parentStatus = 0;
                foreach ( $chunks as $codes ) {
                        // Do not fork for only one thread
@@ -112,8 +112,9 @@ class RebuildLocalisationCache extends Maintenance {
 
                        if ( $pid === 0 ) {
                                // Child, reseed because there is no bug in PHP:
-                               // http://bugs.php.net/bug.php?id=42465
+                               // https://bugs.php.net/bug.php?id=42465
                                mt_srand( getmypid() );
+
                                $this->doRebuild( $codes, $lc, $force );
                                exit( 0 );
                        } elseif ( $pid === -1 ) {
@@ -176,5 +177,5 @@ class RebuildLocalisationCache extends Maintenance {
        }
 }
 
-$maintClass = "RebuildLocalisationCache";
+$maintClass = RebuildLocalisationCache::class;
 require_once RUN_MAINTENANCE_IF_MAIN;