* Introduced a new system for localisation caching. The system is based around fast...
[lhc/web/wiklou.git] / maintenance / rebuildLocalisationCache.php
1 <?php
2
3 /**
4 * Rebuild the localisation cache. Useful if you disabled automatic updates
5 * using $wgLocalisationCacheConf['manualRecache'] = true;
6 *
7 * Usage:
8 * php rebuildLocalisationCache.php [--force]
9 *
10 * Use --force to rebuild all files, even the ones that are not out of date.
11 */
12
13 require( dirname(__FILE__).'/commandLine.inc' );
14 ini_set( 'memory_limit', '200M' );
15
16 $force = isset( $options['force'] );
17
18 $conf = $wgLocalisationCacheConf;
19 $conf['manualRecache'] = false; // Allow fallbacks to create CDB files
20 if ( $force ) {
21 $conf['forceRecache'] = true;
22 }
23 $lc = new LocalisationCache_BulkLoad( $conf );
24
25 $codes = array_keys( Language::getLanguageNames( true ) );
26 sort( $codes );
27 $numRebuilt = 0;
28 foreach ( $codes as $code ) {
29 if ( $force || $lc->isExpired( $code ) ) {
30 echo "Rebuilding $code...\n";
31 $lc->recache( $code );
32 $numRebuilt++;
33 }
34 }
35 echo "$numRebuilt languages rebuilt out of " . count( $codes ) . ".\n";
36 if ( $numRebuilt == 0 ) {
37 echo "Use --force to rebuild the caches which are still fresh.\n";
38 }
39
40
41