Merge "It should not be possible for a RequestContext's WikiPage and Title to be...
[lhc/web/wiklou.git] / includes / installer / DatabaseUpdater.php
1 <?php
2 /**
3 * DBMS-specific updater helper.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup Deployment
22 */
23
24 require_once( __DIR__ . '/../../maintenance/Maintenance.php' );
25
26 /**
27 * Class for handling database updates. Roughly based off of updaters.inc, with
28 * a few improvements :)
29 *
30 * @ingroup Deployment
31 * @since 1.17
32 */
33 abstract class DatabaseUpdater {
34
35 /**
36 * Array of updates to perform on the database
37 *
38 * @var array
39 */
40 protected $updates = array();
41
42 /**
43 * List of extension-provided database updates
44 * @var array
45 */
46 protected $extensionUpdates = array();
47
48 /**
49 * Handle to the database subclass
50 *
51 * @var DatabaseBase
52 */
53 protected $db;
54
55 protected $shared = false;
56
57 /**
58 * Scripts to run after database update
59 * Should be a subclass of LoggedUpdateMaintenance
60 */
61 protected $postDatabaseUpdateMaintenance = array(
62 'DeleteDefaultMessages',
63 'PopulateRevisionLength',
64 'PopulateRevisionSha1',
65 'PopulateImageSha1',
66 'FixExtLinksProtocolRelative',
67 'PopulateFilearchiveSha1',
68 );
69
70 /**
71 * Constructor
72 *
73 * @param $db DatabaseBase object to perform updates on
74 * @param $shared bool Whether to perform updates on shared tables
75 * @param $maintenance Maintenance Maintenance object which created us
76 */
77 protected function __construct( DatabaseBase &$db, $shared, Maintenance $maintenance = null ) {
78 $this->db = $db;
79 $this->db->setFlag( DBO_DDLMODE ); // For Oracle's handling of schema files
80 $this->shared = $shared;
81 if ( $maintenance ) {
82 $this->maintenance = $maintenance;
83 } else {
84 $this->maintenance = new FakeMaintenance;
85 }
86 $this->maintenance->setDB( $db );
87 $this->initOldGlobals();
88 $this->loadExtensions();
89 wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) );
90 }
91
92 /**
93 * Initialize all of the old globals. One day this should all become
94 * something much nicer
95 */
96 private function initOldGlobals() {
97 global $wgExtNewTables, $wgExtNewFields, $wgExtPGNewFields,
98 $wgExtPGAlteredFields, $wgExtNewIndexes, $wgExtModifiedFields;
99
100 # For extensions only, should be populated via hooks
101 # $wgDBtype should be checked to specifiy the proper file
102 $wgExtNewTables = array(); // table, dir
103 $wgExtNewFields = array(); // table, column, dir
104 $wgExtPGNewFields = array(); // table, column, column attributes; for PostgreSQL
105 $wgExtPGAlteredFields = array(); // table, column, new type, conversion method; for PostgreSQL
106 $wgExtNewIndexes = array(); // table, index, dir
107 $wgExtModifiedFields = array(); // table, index, dir
108 }
109
110 /**
111 * Loads LocalSettings.php, if needed, and initialises everything needed for LoadExtensionSchemaUpdates hook
112 */
113 private function loadExtensions() {
114 if ( !defined( 'MEDIAWIKI_INSTALL' ) ) {
115 return; // already loaded
116 }
117 $vars = Installer::getExistingLocalSettings();
118 if ( !$vars ) {
119 return; // no LocalSettings found
120 }
121 if ( !isset( $vars['wgHooks'] ) || !isset( $vars['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
122 return;
123 }
124 global $wgHooks, $wgAutoloadClasses;
125 $wgHooks['LoadExtensionSchemaUpdates'] = $vars['wgHooks']['LoadExtensionSchemaUpdates'];
126 $wgAutoloadClasses = $wgAutoloadClasses + $vars['wgAutoloadClasses'];
127 }
128
129 /**
130 * @throws MWException
131 * @param DatabaseBase $db
132 * @param bool $shared
133 * @param null $maintenance
134 * @return DatabaseUpdater
135 */
136 public static function newForDB( &$db, $shared = false, $maintenance = null ) {
137 $type = $db->getType();
138 if( in_array( $type, Installer::getDBTypes() ) ) {
139 $class = ucfirst( $type ) . 'Updater';
140 return new $class( $db, $shared, $maintenance );
141 } else {
142 throw new MWException( __METHOD__ . ' called for unsupported $wgDBtype' );
143 }
144 }
145
146 /**
147 * Get a database connection to run updates
148 *
149 * @return DatabaseBase
150 */
151 public function getDB() {
152 return $this->db;
153 }
154
155 /**
156 * Output some text. If we're running from web, escape the text first.
157 *
158 * @param $str String: Text to output
159 */
160 public function output( $str ) {
161 if ( $this->maintenance->isQuiet() ) {
162 return;
163 }
164 global $wgCommandLineMode;
165 if( !$wgCommandLineMode ) {
166 $str = htmlspecialchars( $str );
167 }
168 echo $str;
169 flush();
170 }
171
172 /**
173 * Add a new update coming from an extension. This should be called by
174 * extensions while executing the LoadExtensionSchemaUpdates hook.
175 *
176 * @since 1.17
177 *
178 * @param $update Array: the update to run. Format is the following:
179 * first item is the callback function, it also can be a
180 * simple string with the name of a function in this class,
181 * following elements are parameters to the function.
182 * Note that callback functions will receive this object as
183 * first parameter.
184 */
185 public function addExtensionUpdate( array $update ) {
186 $this->extensionUpdates[] = $update;
187 }
188
189 /**
190 * Convenience wrapper for addExtensionUpdate() when adding a new table (which
191 * is the most common usage of updaters in an extension)
192 *
193 * @since 1.18
194 *
195 * @param $tableName String Name of table to create
196 * @param $sqlPath String Full path to the schema file
197 */
198 public function addExtensionTable( $tableName, $sqlPath ) {
199 $this->extensionUpdates[] = array( 'addTable', $tableName, $sqlPath, true );
200 }
201
202 /**
203 * @since 1.19
204 *
205 * @param $tableName string
206 * @param $indexName string
207 * @param $sqlPath string
208 */
209 public function addExtensionIndex( $tableName, $indexName, $sqlPath ) {
210 $this->extensionUpdates[] = array( 'addIndex', $tableName, $indexName, $sqlPath, true );
211 }
212
213 /**
214 *
215 * @since 1.19
216 *
217 * @param $tableName string
218 * @param $columnName string
219 * @param $sqlPath string
220 */
221 public function addExtensionField( $tableName, $columnName, $sqlPath ) {
222 $this->extensionUpdates[] = array( 'addField', $tableName, $columnName, $sqlPath, true );
223 }
224
225 /**
226 *
227 * @since 1.20
228 *
229 * @param $tableName string
230 * @param $columnName string
231 * @param $sqlPath string
232 */
233 public function dropExtensionField( $tableName, $columnName, $sqlPath ) {
234 $this->extensionUpdates[] = array( 'dropField', $tableName, $columnName, $sqlPath, true );
235 }
236
237 /**
238 *
239 * @since 1.20
240 *
241 * @param $tableName string
242 * @param $sqlPath string
243 */
244 public function dropExtensionTable( $tableName, $sqlPath ) {
245 $this->extensionUpdates[] = array( 'dropTable', $tableName, $sqlPath, true );
246 }
247
248 /**
249 *
250 * @since 1.20
251 *
252 * @param $tableName string
253 * @return bool
254 */
255 public function tableExists( $tableName ) {
256 return ( $this->db->tableExists( $tableName, __METHOD__ ) );
257 }
258
259 /**
260 * Add a maintenance script to be run after the database updates are complete.
261 *
262 * Script should subclass LoggedUpdateMaintenance
263 *
264 * @since 1.19
265 *
266 * @param $class string Name of a Maintenance subclass
267 */
268 public function addPostDatabaseUpdateMaintenance( $class ) {
269 $this->postDatabaseUpdateMaintenance[] = $class;
270 }
271
272 /**
273 * Get the list of extension-defined updates
274 *
275 * @return Array
276 */
277 protected function getExtensionUpdates() {
278 return $this->extensionUpdates;
279 }
280
281 /**
282 * @since 1.17
283 *
284 * @return array
285 */
286 public function getPostDatabaseUpdateMaintenance() {
287 return $this->postDatabaseUpdateMaintenance;
288 }
289
290 /**
291 * Do all the updates
292 *
293 * @param $what Array: what updates to perform
294 */
295 public function doUpdates( $what = array( 'core', 'extensions', 'stats' ) ) {
296 global $wgVersion;
297
298 $this->db->begin( __METHOD__ );
299 $what = array_flip( $what );
300 if ( isset( $what['core'] ) ) {
301 $this->runUpdates( $this->getCoreUpdateList(), false );
302 }
303 if ( isset( $what['extensions'] ) ) {
304 $this->runUpdates( $this->getOldGlobalUpdates(), false );
305 $this->runUpdates( $this->getExtensionUpdates(), true );
306 }
307
308 $this->setAppliedUpdates( $wgVersion, $this->updates );
309
310 if ( isset( $what['stats'] ) ) {
311 $this->checkStats();
312 }
313 $this->db->commit( __METHOD__ );
314 }
315
316 /**
317 * Helper function for doUpdates()
318 *
319 * @param $updates Array of updates to run
320 * @param $passSelf Boolean: whether to pass this object we calling external
321 * functions
322 */
323 private function runUpdates( array $updates, $passSelf ) {
324 foreach ( $updates as $params ) {
325 $func = array_shift( $params );
326 if( !is_array( $func ) && method_exists( $this, $func ) ) {
327 $func = array( $this, $func );
328 } elseif ( $passSelf ) {
329 array_unshift( $params, $this );
330 }
331 call_user_func_array( $func, $params );
332 flush();
333 }
334 $this->updates = array_merge( $this->updates, $updates );
335 }
336
337 /**
338 * @param $version
339 * @param $updates array
340 */
341 protected function setAppliedUpdates( $version, $updates = array() ) {
342 $this->db->clearFlag( DBO_DDLMODE );
343 if( !$this->canUseNewUpdatelog() ) {
344 return;
345 }
346 $key = "updatelist-$version-" . time();
347 $this->db->insert( 'updatelog',
348 array( 'ul_key' => $key, 'ul_value' => serialize( $updates ) ),
349 __METHOD__ );
350 $this->db->setFlag( DBO_DDLMODE );
351 }
352
353 /**
354 * Helper function: check if the given key is present in the updatelog table.
355 * Obviously, only use this for updates that occur after the updatelog table was
356 * created!
357 * @param $key String Name of the key to check for
358 *
359 * @return bool
360 */
361 public function updateRowExists( $key ) {
362 $row = $this->db->selectRow(
363 'updatelog',
364 '1',
365 array( 'ul_key' => $key ),
366 __METHOD__
367 );
368 return (bool)$row;
369 }
370
371 /**
372 * Helper function: Add a key to the updatelog table
373 * Obviously, only use this for updates that occur after the updatelog table was
374 * created!
375 * @param $key String Name of key to insert
376 * @param $val String [optional] value to insert along with the key
377 */
378 public function insertUpdateRow( $key, $val = null ) {
379 $this->db->clearFlag( DBO_DDLMODE );
380 $values = array( 'ul_key' => $key );
381 if( $val && $this->canUseNewUpdatelog() ) {
382 $values['ul_value'] = $val;
383 }
384 $this->db->insert( 'updatelog', $values, __METHOD__, 'IGNORE' );
385 $this->db->setFlag( DBO_DDLMODE );
386 }
387
388 /**
389 * Updatelog was changed in 1.17 to have a ul_value column so we can record
390 * more information about what kind of updates we've done (that's what this
391 * class does). Pre-1.17 wikis won't have this column, and really old wikis
392 * might not even have updatelog at all
393 *
394 * @return boolean
395 */
396 protected function canUseNewUpdatelog() {
397 return $this->db->tableExists( 'updatelog', __METHOD__ ) &&
398 $this->db->fieldExists( 'updatelog', 'ul_value', __METHOD__ );
399 }
400
401 /**
402 * Before 1.17, we used to handle updates via stuff like
403 * $wgExtNewTables/Fields/Indexes. This is nasty :) We refactored a lot
404 * of this in 1.17 but we want to remain back-compatible for a while. So
405 * load up these old global-based things into our update list.
406 *
407 * @return array
408 */
409 protected function getOldGlobalUpdates() {
410 global $wgExtNewFields, $wgExtNewTables, $wgExtModifiedFields,
411 $wgExtNewIndexes, $wgSharedDB, $wgSharedTables;
412
413 $doUser = $this->shared ?
414 $wgSharedDB && in_array( 'user', $wgSharedTables ) :
415 !$wgSharedDB || !in_array( 'user', $wgSharedTables );
416
417 $updates = array();
418
419 foreach ( $wgExtNewTables as $tableRecord ) {
420 $updates[] = array(
421 'addTable', $tableRecord[0], $tableRecord[1], true
422 );
423 }
424
425 foreach ( $wgExtNewFields as $fieldRecord ) {
426 if ( $fieldRecord[0] != 'user' || $doUser ) {
427 $updates[] = array(
428 'addField', $fieldRecord[0], $fieldRecord[1],
429 $fieldRecord[2], true
430 );
431 }
432 }
433
434 foreach ( $wgExtNewIndexes as $fieldRecord ) {
435 $updates[] = array(
436 'addIndex', $fieldRecord[0], $fieldRecord[1],
437 $fieldRecord[2], true
438 );
439 }
440
441 foreach ( $wgExtModifiedFields as $fieldRecord ) {
442 $updates[] = array(
443 'modifyField', $fieldRecord[0], $fieldRecord[1],
444 $fieldRecord[2], true
445 );
446 }
447
448 return $updates;
449 }
450
451 /**
452 * Get an array of updates to perform on the database. Should return a
453 * multi-dimensional array. The main key is the MediaWiki version (1.12,
454 * 1.13...) with the values being arrays of updates, identical to how
455 * updaters.inc did it (for now)
456 *
457 * @return Array
458 */
459 protected abstract function getCoreUpdateList();
460
461 /**
462 * Applies a SQL patch
463 * @param $path String Path to the patch file
464 * @param $isFullPath Boolean Whether to treat $path as a relative or not
465 * @param $msg String Description of the patch
466 */
467 protected function applyPatch( $path, $isFullPath = false, $msg = null ) {
468 if ( $msg === null ) {
469 $msg = "Applying $path patch";
470 }
471
472 if ( !$isFullPath ) {
473 $path = $this->db->patchPath( $path );
474 }
475
476 $this->output( "$msg ..." );
477 $this->db->sourceFile( $path );
478 $this->output( "done.\n" );
479 }
480
481 /**
482 * Add a new table to the database
483 * @param $name String Name of the new table
484 * @param $patch String Path to the patch file
485 * @param $fullpath Boolean Whether to treat $patch path as a relative or not
486 */
487 protected function addTable( $name, $patch, $fullpath = false ) {
488 if ( $this->db->tableExists( $name, __METHOD__ ) ) {
489 $this->output( "...$name table already exists.\n" );
490 } else {
491 $this->applyPatch( $patch, $fullpath, "Creating $name table" );
492 }
493 }
494
495 /**
496 * Add a new field to an existing table
497 * @param $table String Name of the table to modify
498 * @param $field String Name of the new field
499 * @param $patch String Path to the patch file
500 * @param $fullpath Boolean Whether to treat $patch path as a relative or not
501 */
502 protected function addField( $table, $field, $patch, $fullpath = false ) {
503 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
504 $this->output( "...$table table does not exist, skipping new field patch.\n" );
505 } elseif ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
506 $this->output( "...have $field field in $table table.\n" );
507 } else {
508 $this->applyPatch( $patch, $fullpath, "Adding $field field to table $table" );
509 }
510 }
511
512 /**
513 * Add a new index to an existing table
514 * @param $table String Name of the table to modify
515 * @param $index String Name of the new index
516 * @param $patch String Path to the patch file
517 * @param $fullpath Boolean Whether to treat $patch path as a relative or not
518 */
519 protected function addIndex( $table, $index, $patch, $fullpath = false ) {
520 if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
521 $this->output( "...index $index already set on $table table.\n" );
522 } else {
523 $this->applyPatch( $patch, $fullpath, "Adding index $index to table $table" );
524 }
525 }
526
527 /**
528 * Drop a field from an existing table
529 *
530 * @param $table String Name of the table to modify
531 * @param $field String Name of the old field
532 * @param $patch String Path to the patch file
533 * @param $fullpath Boolean Whether to treat $patch path as a relative or not
534 */
535 protected function dropField( $table, $field, $patch, $fullpath = false ) {
536 if ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
537 $this->applyPatch( $patch, $fullpath, "Table $table contains $field field. Dropping" );
538 } else {
539 $this->output( "...$table table does not contain $field field.\n" );
540 }
541 }
542
543 /**
544 * Drop an index from an existing table
545 *
546 * @param $table String: Name of the table to modify
547 * @param $index String: Name of the old index
548 * @param $patch String: Path to the patch file
549 * @param $fullpath Boolean: Whether to treat $patch path as a relative or not
550 */
551 protected function dropIndex( $table, $index, $patch, $fullpath = false ) {
552 if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
553 $this->applyPatch( $patch, $fullpath, "Dropping $index index from table $table" );
554 } else {
555 $this->output( "...$index key doesn't exist.\n" );
556 }
557 }
558
559 /**
560 * If the specified table exists, drop it, or execute the
561 * patch if one is provided.
562 *
563 * Public @since 1.20
564 *
565 * @param $table string
566 * @param $patch string|false
567 * @param $fullpath bool
568 */
569 public function dropTable( $table, $patch = false, $fullpath = false ) {
570 if ( $this->db->tableExists( $table, __METHOD__ ) ) {
571 $msg = "Dropping table $table";
572
573 if ( $patch === false ) {
574 $this->output( "$msg ..." );
575 $this->db->dropTable( $table, __METHOD__ );
576 $this->output( "done.\n" );
577 }
578 else {
579 $this->applyPatch( $patch, $fullpath, $msg );
580 }
581
582 } else {
583 $this->output( "...$table doesn't exist.\n" );
584 }
585 }
586
587 /**
588 * Modify an existing field
589 *
590 * @param $table String: name of the table to which the field belongs
591 * @param $field String: name of the field to modify
592 * @param $patch String: path to the patch file
593 * @param $fullpath Boolean: whether to treat $patch path as a relative or not
594 */
595 public function modifyField( $table, $field, $patch, $fullpath = false ) {
596 $updateKey = "$table-$field-$patch";
597 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
598 $this->output( "...$table table does not exist, skipping modify field patch.\n" );
599 } elseif ( !$this->db->fieldExists( $table, $field, __METHOD__ ) ) {
600 $this->output( "...$field field does not exist in $table table, skipping modify field patch.\n" );
601 } elseif( $this->updateRowExists( $updateKey ) ) {
602 $this->output( "...$field in table $table already modified by patch $patch.\n" );
603 } else {
604 $this->applyPatch( $patch, $fullpath, "Modifying $field field of table $table" );
605 $this->insertUpdateRow( $updateKey );
606 }
607 }
608
609 /**
610 * Purge the objectcache table
611 */
612 public function purgeCache() {
613 global $wgLocalisationCacheConf;
614 # We can't guarantee that the user will be able to use TRUNCATE,
615 # but we know that DELETE is available to us
616 $this->output( "Purging caches..." );
617 $this->db->delete( 'objectcache', '*', __METHOD__ );
618 if ( $wgLocalisationCacheConf['manualRecache'] ) {
619 $this->rebuildLocalisationCache();
620 }
621 $this->output( "done.\n" );
622 }
623
624 /**
625 * Check the site_stats table is not properly populated.
626 */
627 protected function checkStats() {
628 $this->output( "...site_stats is populated..." );
629 $row = $this->db->selectRow( 'site_stats', '*', array( 'ss_row_id' => 1 ), __METHOD__ );
630 if ( $row === false ) {
631 $this->output( "data is missing! rebuilding...\n" );
632 } elseif ( isset( $row->site_stats ) && $row->ss_total_pages == -1 ) {
633 $this->output( "missing ss_total_pages, rebuilding...\n" );
634 } else {
635 $this->output( "done.\n" );
636 return;
637 }
638 SiteStatsInit::doAllAndCommit( $this->db );
639 }
640
641 # Common updater functions
642
643 /**
644 * Sets the number of active users in the site_stats table
645 */
646 protected function doActiveUsersInit() {
647 $activeUsers = $this->db->selectField( 'site_stats', 'ss_active_users', false, __METHOD__ );
648 if ( $activeUsers == -1 ) {
649 $activeUsers = $this->db->selectField( 'recentchanges',
650 'COUNT( DISTINCT rc_user_text )',
651 array( 'rc_user != 0', 'rc_bot' => 0, "rc_log_type != 'newusers'" ), __METHOD__
652 );
653 $this->db->update( 'site_stats',
654 array( 'ss_active_users' => intval( $activeUsers ) ),
655 array( 'ss_row_id' => 1 ), __METHOD__, array( 'LIMIT' => 1 )
656 );
657 }
658 $this->output( "...ss_active_users user count set...\n" );
659 }
660
661 /**
662 * Populates the log_user_text field in the logging table
663 */
664 protected function doLogUsertextPopulation() {
665 if ( !$this->updateRowExists( 'populate log_usertext' ) ) {
666 $this->output(
667 "Populating log_user_text field, printing progress markers. For large\n" .
668 "databases, you may want to hit Ctrl-C and do this manually with\n" .
669 "maintenance/populateLogUsertext.php.\n" );
670
671 $task = $this->maintenance->runChild( 'PopulateLogUsertext' );
672 $task->execute();
673 $this->output( "done.\n" );
674 }
675 }
676
677 /**
678 * Migrate log params to new table and index for searching
679 */
680 protected function doLogSearchPopulation() {
681 if ( !$this->updateRowExists( 'populate log_search' ) ) {
682 $this->output(
683 "Populating log_search table, printing progress markers. For large\n" .
684 "databases, you may want to hit Ctrl-C and do this manually with\n" .
685 "maintenance/populateLogSearch.php.\n" );
686
687 $task = $this->maintenance->runChild( 'PopulateLogSearch' );
688 $task->execute();
689 $this->output( "done.\n" );
690 }
691 }
692
693 /**
694 * Updates the timestamps in the transcache table
695 */
696 protected function doUpdateTranscacheField() {
697 if ( $this->updateRowExists( 'convert transcache field' ) ) {
698 $this->output( "...transcache tc_time already converted.\n" );
699 return;
700 }
701
702 $this->applyPatch( 'patch-tc-timestamp.sql', false, "Converting tc_time from UNIX epoch to MediaWiki timestamp" );
703 }
704
705 /**
706 * Update CategoryLinks collation
707 */
708 protected function doCollationUpdate() {
709 global $wgCategoryCollation;
710 if ( $this->db->selectField(
711 'categorylinks',
712 'COUNT(*)',
713 'cl_collation != ' . $this->db->addQuotes( $wgCategoryCollation ),
714 __METHOD__
715 ) == 0 ) {
716 $this->output( "...collations up-to-date.\n" );
717 return;
718 }
719
720 $this->output( "Updating category collations..." );
721 $task = $this->maintenance->runChild( 'UpdateCollation' );
722 $task->execute();
723 $this->output( "...done.\n" );
724 }
725
726 /**
727 * Migrates user options from the user table blob to user_properties
728 */
729 protected function doMigrateUserOptions() {
730 $cl = $this->maintenance->runChild( 'ConvertUserOptions', 'convertUserOptions.php' );
731 $cl->execute();
732 $this->output( "done.\n" );
733 }
734
735 /**
736 * Rebuilds the localisation cache
737 */
738 protected function rebuildLocalisationCache() {
739 /**
740 * @var $cl RebuildLocalisationCache
741 */
742 $cl = $this->maintenance->runChild( 'RebuildLocalisationCache', 'rebuildLocalisationCache.php' );
743 $this->output( "Rebuilding localisation cache...\n" );
744 $cl->setForce();
745 $cl->execute();
746 $this->output( "done.\n" );
747 }
748 }