Merge "(bug 40154) On action=info show where this page redirects to and whether it...
[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', 'purge', 'stats' ) ) {
296 global $wgLocalisationCacheConf, $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
314 if ( isset( $what['purge'] ) ) {
315 $this->purgeCache();
316
317 if ( $wgLocalisationCacheConf['manualRecache'] ) {
318 $this->rebuildLocalisationCache();
319 }
320 }
321 $this->db->commit( __METHOD__ );
322 }
323
324 /**
325 * Helper function for doUpdates()
326 *
327 * @param $updates Array of updates to run
328 * @param $passSelf Boolean: whether to pass this object we calling external
329 * functions
330 */
331 private function runUpdates( array $updates, $passSelf ) {
332 foreach ( $updates as $params ) {
333 $func = array_shift( $params );
334 if( !is_array( $func ) && method_exists( $this, $func ) ) {
335 $func = array( $this, $func );
336 } elseif ( $passSelf ) {
337 array_unshift( $params, $this );
338 }
339 call_user_func_array( $func, $params );
340 flush();
341 }
342 $this->updates = array_merge( $this->updates, $updates );
343 }
344
345 /**
346 * @param $version
347 * @param $updates array
348 */
349 protected function setAppliedUpdates( $version, $updates = array() ) {
350 $this->db->clearFlag( DBO_DDLMODE );
351 if( !$this->canUseNewUpdatelog() ) {
352 return;
353 }
354 $key = "updatelist-$version-" . time();
355 $this->db->insert( 'updatelog',
356 array( 'ul_key' => $key, 'ul_value' => serialize( $updates ) ),
357 __METHOD__ );
358 $this->db->setFlag( DBO_DDLMODE );
359 }
360
361 /**
362 * Helper function: check if the given key is present in the updatelog table.
363 * Obviously, only use this for updates that occur after the updatelog table was
364 * created!
365 * @param $key String Name of the key to check for
366 *
367 * @return bool
368 */
369 public function updateRowExists( $key ) {
370 $row = $this->db->selectRow(
371 'updatelog',
372 '1',
373 array( 'ul_key' => $key ),
374 __METHOD__
375 );
376 return (bool)$row;
377 }
378
379 /**
380 * Helper function: Add a key to the updatelog table
381 * Obviously, only use this for updates that occur after the updatelog table was
382 * created!
383 * @param $key String Name of key to insert
384 * @param $val String [optional] value to insert along with the key
385 */
386 public function insertUpdateRow( $key, $val = null ) {
387 $this->db->clearFlag( DBO_DDLMODE );
388 $values = array( 'ul_key' => $key );
389 if( $val && $this->canUseNewUpdatelog() ) {
390 $values['ul_value'] = $val;
391 }
392 $this->db->insert( 'updatelog', $values, __METHOD__, 'IGNORE' );
393 $this->db->setFlag( DBO_DDLMODE );
394 }
395
396 /**
397 * Updatelog was changed in 1.17 to have a ul_value column so we can record
398 * more information about what kind of updates we've done (that's what this
399 * class does). Pre-1.17 wikis won't have this column, and really old wikis
400 * might not even have updatelog at all
401 *
402 * @return boolean
403 */
404 protected function canUseNewUpdatelog() {
405 return $this->db->tableExists( 'updatelog', __METHOD__ ) &&
406 $this->db->fieldExists( 'updatelog', 'ul_value', __METHOD__ );
407 }
408
409 /**
410 * Before 1.17, we used to handle updates via stuff like
411 * $wgExtNewTables/Fields/Indexes. This is nasty :) We refactored a lot
412 * of this in 1.17 but we want to remain back-compatible for a while. So
413 * load up these old global-based things into our update list.
414 *
415 * @return array
416 */
417 protected function getOldGlobalUpdates() {
418 global $wgExtNewFields, $wgExtNewTables, $wgExtModifiedFields,
419 $wgExtNewIndexes, $wgSharedDB, $wgSharedTables;
420
421 $doUser = $this->shared ?
422 $wgSharedDB && in_array( 'user', $wgSharedTables ) :
423 !$wgSharedDB || !in_array( 'user', $wgSharedTables );
424
425 $updates = array();
426
427 foreach ( $wgExtNewTables as $tableRecord ) {
428 $updates[] = array(
429 'addTable', $tableRecord[0], $tableRecord[1], true
430 );
431 }
432
433 foreach ( $wgExtNewFields as $fieldRecord ) {
434 if ( $fieldRecord[0] != 'user' || $doUser ) {
435 $updates[] = array(
436 'addField', $fieldRecord[0], $fieldRecord[1],
437 $fieldRecord[2], true
438 );
439 }
440 }
441
442 foreach ( $wgExtNewIndexes as $fieldRecord ) {
443 $updates[] = array(
444 'addIndex', $fieldRecord[0], $fieldRecord[1],
445 $fieldRecord[2], true
446 );
447 }
448
449 foreach ( $wgExtModifiedFields as $fieldRecord ) {
450 $updates[] = array(
451 'modifyField', $fieldRecord[0], $fieldRecord[1],
452 $fieldRecord[2], true
453 );
454 }
455
456 return $updates;
457 }
458
459 /**
460 * Get an array of updates to perform on the database. Should return a
461 * multi-dimensional array. The main key is the MediaWiki version (1.12,
462 * 1.13...) with the values being arrays of updates, identical to how
463 * updaters.inc did it (for now)
464 *
465 * @return Array
466 */
467 protected abstract function getCoreUpdateList();
468
469 /**
470 * Applies a SQL patch
471 * @param $path String Path to the patch file
472 * @param $isFullPath Boolean Whether to treat $path as a relative or not
473 * @param $msg String Description of the patch
474 */
475 protected function applyPatch( $path, $isFullPath = false, $msg = null ) {
476 if ( $msg === null ) {
477 $msg = "Applying $path patch";
478 }
479
480 if ( !$isFullPath ) {
481 $path = $this->db->patchPath( $path );
482 }
483
484 $this->output( "$msg ..." );
485 $this->db->sourceFile( $path );
486 $this->output( "done.\n" );
487 }
488
489 /**
490 * Add a new table to the database
491 * @param $name String Name of the new table
492 * @param $patch String Path to the patch file
493 * @param $fullpath Boolean Whether to treat $patch path as a relative or not
494 */
495 protected function addTable( $name, $patch, $fullpath = false ) {
496 if ( $this->db->tableExists( $name, __METHOD__ ) ) {
497 $this->output( "...$name table already exists.\n" );
498 } else {
499 $this->applyPatch( $patch, $fullpath, "Creating $name table" );
500 }
501 }
502
503 /**
504 * Add a new field to an existing table
505 * @param $table String Name of the table to modify
506 * @param $field String Name of the new field
507 * @param $patch String Path to the patch file
508 * @param $fullpath Boolean Whether to treat $patch path as a relative or not
509 */
510 protected function addField( $table, $field, $patch, $fullpath = false ) {
511 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
512 $this->output( "...$table table does not exist, skipping new field patch.\n" );
513 } elseif ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
514 $this->output( "...have $field field in $table table.\n" );
515 } else {
516 $this->applyPatch( $patch, $fullpath, "Adding $field field to table $table" );
517 }
518 }
519
520 /**
521 * Add a new index to an existing table
522 * @param $table String Name of the table to modify
523 * @param $index String Name of the new index
524 * @param $patch String Path to the patch file
525 * @param $fullpath Boolean Whether to treat $patch path as a relative or not
526 */
527 protected function addIndex( $table, $index, $patch, $fullpath = false ) {
528 if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
529 $this->output( "...index $index already set on $table table.\n" );
530 } else {
531 $this->applyPatch( $patch, $fullpath, "Adding index $index to table $table" );
532 }
533 }
534
535 /**
536 * Drop a field from an existing table
537 *
538 * @param $table String Name of the table to modify
539 * @param $field String Name of the old field
540 * @param $patch String Path to the patch file
541 * @param $fullpath Boolean Whether to treat $patch path as a relative or not
542 */
543 protected function dropField( $table, $field, $patch, $fullpath = false ) {
544 if ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
545 $this->applyPatch( $patch, $fullpath, "Table $table contains $field field. Dropping" );
546 } else {
547 $this->output( "...$table table does not contain $field field.\n" );
548 }
549 }
550
551 /**
552 * Drop an index from an existing table
553 *
554 * @param $table String: Name of the table to modify
555 * @param $index String: Name of the old index
556 * @param $patch String: Path to the patch file
557 * @param $fullpath Boolean: Whether to treat $patch path as a relative or not
558 */
559 protected function dropIndex( $table, $index, $patch, $fullpath = false ) {
560 if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
561 $this->applyPatch( $patch, $fullpath, "Dropping $index index from table $table" );
562 } else {
563 $this->output( "...$index key doesn't exist.\n" );
564 }
565 }
566
567 /**
568 * If the specified table exists, drop it, or execute the
569 * patch if one is provided.
570 *
571 * Public @since 1.20
572 *
573 * @param $table string
574 * @param $patch string|false
575 * @param $fullpath bool
576 */
577 public function dropTable( $table, $patch = false, $fullpath = false ) {
578 if ( $this->db->tableExists( $table, __METHOD__ ) ) {
579 $msg = "Dropping table $table";
580
581 if ( $patch === false ) {
582 $this->output( "$msg ..." );
583 $this->db->dropTable( $table, __METHOD__ );
584 $this->output( "done.\n" );
585 }
586 else {
587 $this->applyPatch( $patch, $fullpath, $msg );
588 }
589
590 } else {
591 $this->output( "...$table doesn't exist.\n" );
592 }
593 }
594
595 /**
596 * Modify an existing field
597 *
598 * @param $table String: name of the table to which the field belongs
599 * @param $field String: name of the field to modify
600 * @param $patch String: path to the patch file
601 * @param $fullpath Boolean: whether to treat $patch path as a relative or not
602 */
603 public function modifyField( $table, $field, $patch, $fullpath = false ) {
604 $updateKey = "$table-$field-$patch";
605 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
606 $this->output( "...$table table does not exist, skipping modify field patch.\n" );
607 } elseif ( !$this->db->fieldExists( $table, $field, __METHOD__ ) ) {
608 $this->output( "...$field field does not exist in $table table, skipping modify field patch.\n" );
609 } elseif( $this->updateRowExists( $updateKey ) ) {
610 $this->output( "...$field in table $table already modified by patch $patch.\n" );
611 } else {
612 $this->applyPatch( $patch, $fullpath, "Modifying $field field of table $table" );
613 $this->insertUpdateRow( $updateKey );
614 }
615 }
616
617 /**
618 * Purge the objectcache table
619 */
620 protected function purgeCache() {
621 # We can't guarantee that the user will be able to use TRUNCATE,
622 # but we know that DELETE is available to us
623 $this->output( "Purging caches..." );
624 $this->db->delete( 'objectcache', '*', __METHOD__ );
625 $this->output( "done.\n" );
626 }
627
628 /**
629 * Check the site_stats table is not properly populated.
630 */
631 protected function checkStats() {
632 $this->output( "...site_stats is populated..." );
633 $row = $this->db->selectRow( 'site_stats', '*', array( 'ss_row_id' => 1 ), __METHOD__ );
634 if ( $row === false ) {
635 $this->output( "data is missing! rebuilding...\n" );
636 } elseif ( isset( $row->site_stats ) && $row->ss_total_pages == -1 ) {
637 $this->output( "missing ss_total_pages, rebuilding...\n" );
638 } else {
639 $this->output( "done.\n" );
640 return;
641 }
642 SiteStatsInit::doAllAndCommit( $this->db );
643 }
644
645 # Common updater functions
646
647 /**
648 * Sets the number of active users in the site_stats table
649 */
650 protected function doActiveUsersInit() {
651 $activeUsers = $this->db->selectField( 'site_stats', 'ss_active_users', false, __METHOD__ );
652 if ( $activeUsers == -1 ) {
653 $activeUsers = $this->db->selectField( 'recentchanges',
654 'COUNT( DISTINCT rc_user_text )',
655 array( 'rc_user != 0', 'rc_bot' => 0, "rc_log_type != 'newusers'" ), __METHOD__
656 );
657 $this->db->update( 'site_stats',
658 array( 'ss_active_users' => intval( $activeUsers ) ),
659 array( 'ss_row_id' => 1 ), __METHOD__, array( 'LIMIT' => 1 )
660 );
661 }
662 $this->output( "...ss_active_users user count set...\n" );
663 }
664
665 /**
666 * Populates the log_user_text field in the logging table
667 */
668 protected function doLogUsertextPopulation() {
669 if ( !$this->updateRowExists( 'populate log_usertext' ) ) {
670 $this->output(
671 "Populating log_user_text field, printing progress markers. For large\n" .
672 "databases, you may want to hit Ctrl-C and do this manually with\n" .
673 "maintenance/populateLogUsertext.php.\n" );
674
675 $task = $this->maintenance->runChild( 'PopulateLogUsertext' );
676 $task->execute();
677 $this->output( "done.\n" );
678 }
679 }
680
681 /**
682 * Migrate log params to new table and index for searching
683 */
684 protected function doLogSearchPopulation() {
685 if ( !$this->updateRowExists( 'populate log_search' ) ) {
686 $this->output(
687 "Populating log_search table, printing progress markers. For large\n" .
688 "databases, you may want to hit Ctrl-C and do this manually with\n" .
689 "maintenance/populateLogSearch.php.\n" );
690
691 $task = $this->maintenance->runChild( 'PopulateLogSearch' );
692 $task->execute();
693 $this->output( "done.\n" );
694 }
695 }
696
697 /**
698 * Updates the timestamps in the transcache table
699 */
700 protected function doUpdateTranscacheField() {
701 if ( $this->updateRowExists( 'convert transcache field' ) ) {
702 $this->output( "...transcache tc_time already converted.\n" );
703 return;
704 }
705
706 $this->applyPatch( 'patch-tc-timestamp.sql', false, "Converting tc_time from UNIX epoch to MediaWiki timestamp" );
707 }
708
709 /**
710 * Update CategoryLinks collation
711 */
712 protected function doCollationUpdate() {
713 global $wgCategoryCollation;
714 if ( $this->db->selectField(
715 'categorylinks',
716 'COUNT(*)',
717 'cl_collation != ' . $this->db->addQuotes( $wgCategoryCollation ),
718 __METHOD__
719 ) == 0 ) {
720 $this->output( "...collations up-to-date.\n" );
721 return;
722 }
723
724 $this->output( "Updating category collations..." );
725 $task = $this->maintenance->runChild( 'UpdateCollation' );
726 $task->execute();
727 $this->output( "...done.\n" );
728 }
729
730 /**
731 * Migrates user options from the user table blob to user_properties
732 */
733 protected function doMigrateUserOptions() {
734 $cl = $this->maintenance->runChild( 'ConvertUserOptions', 'convertUserOptions.php' );
735 $cl->execute();
736 $this->output( "done.\n" );
737 }
738
739 /**
740 * Rebuilds the localisation cache
741 */
742 protected function rebuildLocalisationCache() {
743 /**
744 * @var $cl RebuildLocalisationCache
745 */
746 $cl = $this->maintenance->runChild( 'RebuildLocalisationCache', 'rebuildLocalisationCache.php' );
747 $this->output( "Rebuilding localisation cache...\n" );
748 $cl->setForce();
749 $cl->execute();
750 $this->output( "done.\n" );
751 }
752 }