Index: trunk/phase3/maintenance/rebuildLocalisationCache.php |
— | — | @@ -67,11 +67,11 @@ |
68 | 68 | |
69 | 69 | if ( $pid === 0 ) { |
70 | 70 | // Child |
71 | | - doRebuild( $codes, $numRebuilt, $lc, $force ); |
| 71 | + $this->doRebuild( $codes, $numRebuilt, $lc, $force ); |
72 | 72 | exit(); |
73 | 73 | } elseif ($pid === -1) { |
74 | 74 | // Fork failed or one thread, do it serialized |
75 | | - doRebuild( $codes, $numRebuilt, $lc, $force ); |
| 75 | + $this->doRebuild( $codes, $numRebuilt, $lc, $force ); |
76 | 76 | } else { |
77 | 77 | // Main thread |
78 | 78 | $pids[] = $pid; |
— | — | @@ -85,6 +85,20 @@ |
86 | 86 | $this->output( "Use --force to rebuild the caches which are still fresh.\n" ); |
87 | 87 | } |
88 | 88 | } |
| 89 | + |
| 90 | + /** |
| 91 | + * Rebuild language cache |
| 92 | + * @todo Document |
| 93 | + */ |
| 94 | + private function doRebuild( $codes, &$numRebuilt, $lc, $force ) { |
| 95 | + foreach ( $codes as $code ) { |
| 96 | + if ( $force || $lc->isExpired( $code ) ) { |
| 97 | + $this->output( "Rebuilding $code...\n" ); |
| 98 | + $lc->recache( $code ); |
| 99 | + $numRebuilt++; |
| 100 | + } |
| 101 | + } |
| 102 | + } |
89 | 103 | } |
90 | 104 | |
91 | 105 | $maintClass = "RebuildLocalisationCache"; |