if ( $pid === 0 ) {
// Child
- doRebuild( $codes, $numRebuilt, $lc, $force );
+ $this->doRebuild( $codes, $numRebuilt, $lc, $force );
exit();
} elseif ($pid === -1) {
// Fork failed or one thread, do it serialized
- doRebuild( $codes, $numRebuilt, $lc, $force );
+ $this->doRebuild( $codes, $numRebuilt, $lc, $force );
} else {
// Main thread
$pids[] = $pid;
$this->output( "Use --force to rebuild the caches which are still fresh.\n" );
}
}
+
+ /**
+ * Rebuild language cache
+ * @todo Document
+ */
+ private function doRebuild( $codes, &$numRebuilt, $lc, $force ) {
+ foreach ( $codes as $code ) {
+ if ( $force || $lc->isExpired( $code ) ) {
+ $this->output( "Rebuilding $code...\n" );
+ $lc->recache( $code );
+ $numRebuilt++;
+ }
+ }
+ }
}
$maintClass = "RebuildLocalisationCache";