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