Forgot to bring doRebuild() along :)
[lhc/web/wiklou.git] / maintenance / rebuildLocalisationCache.php
index 632b9ea..1e7a747 100644 (file)
@@ -67,11 +67,11 @@ class RebuildLocalisationCache extends Maintenance {
 
                        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;
@@ -85,6 +85,20 @@ class RebuildLocalisationCache extends Maintenance {
                        $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";