27require_once __DIR__ .
'/../../maintenance/Maintenance.php';
78 DeleteDefaultMessages::class,
79 PopulateRevisionLength::class,
80 PopulateRevisionSha1::class,
81 PopulateImageSha1::class,
82 FixExtLinksProtocolRelative::class,
83 PopulateFilearchiveSha1::class,
84 PopulateBacklinkNamespace::class,
85 FixDefaultJsonContentPages::class,
86 CleanupEmptyCategories::class,
87 AddRFCandPMIDInterwiki::class,
88 PopulatePPSortKey::class,
89 PopulateIpChanges::class,
90 RefreshExternallinksIndex::class,
134 Hooks::run(
'LoadExtensionSchemaUpdates', [ $this ] );
142 global $wgExtNewTables, $wgExtNewFields, $wgExtPGNewFields,
143 $wgExtPGAlteredFields, $wgExtNewIndexes, $wgExtModifiedFields;
145 # For extensions only, should be populated via hooks
146 # $wgDBtype should be checked to specify the proper file
147 $wgExtNewTables = [];
148 $wgExtNewFields = [];
149 $wgExtPGNewFields = [];
150 $wgExtPGAlteredFields = [];
151 $wgExtNewIndexes = [];
152 $wgExtModifiedFields = [];
160 if ( !defined(
'MEDIAWIKI_INSTALL' ) || defined(
'MW_EXTENSIONS_LOADED' ) ) {
165 $registry = ExtensionRegistry::getInstance();
166 $queue = $registry->getQueue();
168 $registry->clearQueue();
171 $data = $registry->readFromQueue(
$queue );
172 $hooks = $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates'] ?? [];
173 if ( $vars && isset( $vars[
'wgHooks'][
'LoadExtensionSchemaUpdates'] ) ) {
174 $hooks = array_merge_recursive( $hooks, $vars[
'wgHooks'][
'LoadExtensionSchemaUpdates'] );
177 $wgHooks[
'LoadExtensionSchemaUpdates'] = $hooks;
178 if ( $vars && isset( $vars[
'wgAutoloadClasses'] ) ) {
198 $class = ucfirst(
$type ) .
'Updater';
202 throw new MWException( __METHOD__ .
' called for unsupported $wgDBtype' );
222 if ( $this->maintenance->isQuiet() ) {
227 $str = htmlspecialchars( $str );
246 $this->extensionUpdates[] = $update;
259 $this->extensionUpdates[] = [
'addTable', $tableName, $sqlPath,
true ];
270 $this->extensionUpdates[] = [
'addIndex', $tableName, $indexName, $sqlPath,
true ];
282 $this->extensionUpdates[] = [
'addField', $tableName, $columnName, $sqlPath,
true ];
294 $this->extensionUpdates[] = [
'dropField', $tableName, $columnName, $sqlPath,
true ];
307 $this->extensionUpdates[] = [
'dropIndex', $tableName, $indexName, $sqlPath,
true ];
318 $this->extensionUpdates[] = [
'dropTable', $tableName, $sqlPath,
true ];
334 $sqlPath, $skipBothIndexExistWarning =
false
336 $this->extensionUpdates[] = [
341 $skipBothIndexExistWarning,
355 $this->extensionUpdates[] = [
'modifyField', $tableName, $fieldName, $sqlPath,
true ];
365 $this->extensionUpdates[] = [
'modifyTable', $tableName, $sqlPath,
true ];
376 return ( $this->db->tableExists( $tableName, __METHOD__ ) );
389 $this->postDatabaseUpdateMaintenance[] = $class;
418 $this->updatesSkipped = [];
421 list( $func,
$args, $origParams ) = $funcList;
425 $this->updatesSkipped[] = $origParams;
448 public function doUpdates( array $what = [
'core',
'extensions',
'stats' ] ) {
451 $what = array_flip( $what );
452 $this->skipSchema = isset( $what[
'noschema'] ) || $this->fileHandle !==
null;
453 if ( isset( $what[
'core'] ) ) {
456 if ( isset( $what[
'extensions'] ) ) {
461 if ( isset( $what[
'stats'] ) ) {
465 if ( $this->fileHandle ) {
466 $this->skipSchema =
false;
478 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
483 $origParams = $params;
484 $func = array_shift( $params );
485 if ( !is_array( $func ) && method_exists( $this, $func ) ) {
486 $func = [ $this, $func ];
487 } elseif ( $passSelf ) {
488 array_unshift( $params, $this );
490 $ret = $func( ...$params );
492 if ( $ret !==
false ) {
493 $updatesDone[] = $origParams;
494 $lbFactory->waitForReplication( [
'timeout' => self::REPLICATION_WAIT_TIMEOUT ] );
499 $this->updatesSkipped = array_merge( $this->updatesSkipped,
$updatesSkipped );
500 $this->updates = array_merge( $this->updates, $updatesDone );
511 $row = $this->db->selectRow(
515 [
'ul_key' => $key ],
531 $values = [
'ul_key' => $key ];
533 $values[
'ul_value'] = $val;
535 $this->db->insert(
'updatelog', $values, __METHOD__, [
'IGNORE' ] );
548 return $this->db->tableExists(
'updatelog', __METHOD__ ) &&
549 $this->db->fieldExists(
'updatelog',
'ul_value', __METHOD__ );
570 $this->
output(
"...skipping update to shared table $name.\n" );
586 global $wgExtNewFields, $wgExtNewTables, $wgExtModifiedFields,
591 foreach ( $wgExtNewTables as $tableRecord ) {
593 'addTable', $tableRecord[0], $tableRecord[1],
true
597 foreach ( $wgExtNewFields as $fieldRecord ) {
599 'addField', $fieldRecord[0], $fieldRecord[1],
600 $fieldRecord[2],
true
604 foreach ( $wgExtNewIndexes as $fieldRecord ) {
606 'addIndex', $fieldRecord[0], $fieldRecord[1],
607 $fieldRecord[2],
true
611 foreach ( $wgExtModifiedFields as $fieldRecord ) {
613 'modifyField', $fieldRecord[0], $fieldRecord[1],
614 $fieldRecord[2],
true
637 $this->db->sourceFile(
642 [ $this,
'appendLine' ]
658 if ( fwrite( $this->fileHandle,
$line ) ===
false ) {
674 if ( $msg ===
null ) {
675 $msg =
"Applying $path patch";
677 if ( $this->skipSchema ) {
678 $this->
output(
"...skipping schema change ($msg).\n" );
683 $this->
output(
"$msg ..." );
685 if ( !$isFullPath ) {
688 if ( $this->fileHandle !==
null ) {
691 $this->db->sourceFile(
$path );
693 $this->
output(
"done.\n" );
711 if ( file_exists(
"$IP/maintenance/$dbType/archives/$patch" ) ) {
712 return "$IP/maintenance/$dbType/archives/$patch";
714 return "$IP/maintenance/archives/$patch";
726 protected function addTable( $name, $patch, $fullpath =
false ) {
727 if ( !$this->
doTable( $name ) ) {
731 if ( $this->db->tableExists( $name, __METHOD__ ) ) {
732 $this->
output(
"...$name table already exists.\n" );
734 return $this->
applyPatch( $patch, $fullpath,
"Creating $name table" );
749 protected function addField( $table, $field, $patch, $fullpath =
false ) {
750 if ( !$this->
doTable( $table ) ) {
754 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
755 $this->
output(
"...$table table does not exist, skipping new field patch.\n" );
756 } elseif ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
757 $this->
output(
"...have $field field in $table table.\n" );
759 return $this->
applyPatch( $patch, $fullpath,
"Adding $field field to table $table" );
774 protected function addIndex( $table, $index, $patch, $fullpath =
false ) {
775 if ( !$this->
doTable( $table ) ) {
779 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
780 $this->
output(
"...skipping: '$table' table doesn't exist yet.\n" );
781 } elseif ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
782 $this->
output(
"...index $index already set on $table table.\n" );
784 return $this->
applyPatch( $patch, $fullpath,
"Adding index $index to table $table" );
801 if ( !$this->
doTable( $table ) ) {
805 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
806 $this->
output(
"...skipping: '$table' table doesn't exist yet.\n" );
810 $newIndex = $indexes[0];
811 foreach ( $indexes as $index ) {
812 if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
814 "...skipping index $newIndex because index $index already set on $table table.\n"
820 return $this->
applyPatch( $patch, $fullpath,
"Adding index $index to table $table" );
832 protected function dropField( $table, $field, $patch, $fullpath =
false ) {
833 if ( !$this->
doTable( $table ) ) {
837 if ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
838 return $this->
applyPatch( $patch, $fullpath,
"Table $table contains $field field. Dropping" );
840 $this->
output(
"...$table table does not contain $field field.\n" );
855 protected function dropIndex( $table, $index, $patch, $fullpath =
false ) {
856 if ( !$this->
doTable( $table ) ) {
860 if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
861 return $this->
applyPatch( $patch, $fullpath,
"Dropping $index index from table $table" );
863 $this->
output(
"...$index key doesn't exist.\n" );
882 $skipBothIndexExistWarning, $patch, $fullpath =
false
884 if ( !$this->
doTable( $table ) ) {
889 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
890 $this->
output(
"...skipping: '$table' table doesn't exist yet.\n" );
896 if ( $this->db->indexExists( $table, $newIndex, __METHOD__ ) ) {
897 $this->
output(
"...index $newIndex already set on $table table.\n" );
898 if ( !$skipBothIndexExistWarning &&
899 $this->db->indexExists( $table, $oldIndex, __METHOD__ )
901 $this->
output(
"...WARNING: $oldIndex still exists, despite it has " .
902 "been renamed into $newIndex (which also exists).\n" .
903 " $oldIndex should be manually removed if not needed anymore.\n" );
910 if ( !$this->db->indexExists( $table, $oldIndex, __METHOD__ ) ) {
911 $this->
output(
"...skipping: index $oldIndex doesn't exist.\n" );
920 "Renaming index $oldIndex into $newIndex to table $table"
935 public function dropTable( $table, $patch =
false, $fullpath =
false ) {
936 if ( !$this->
doTable( $table ) ) {
940 if ( $this->db->tableExists( $table, __METHOD__ ) ) {
941 $msg =
"Dropping table $table";
943 if ( $patch ===
false ) {
944 $this->
output(
"$msg ..." );
945 $this->db->dropTable( $table, __METHOD__ );
946 $this->
output(
"done.\n" );
948 return $this->
applyPatch( $patch, $fullpath, $msg );
951 $this->
output(
"...$table doesn't exist.\n" );
966 public function modifyField( $table, $field, $patch, $fullpath =
false ) {
967 if ( !$this->
doTable( $table ) ) {
971 $updateKey =
"$table-$field-$patch";
972 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
973 $this->
output(
"...$table table does not exist, skipping modify field patch.\n" );
974 } elseif ( !$this->db->fieldExists( $table, $field, __METHOD__ ) ) {
975 $this->
output(
"...$field field does not exist in $table table, " .
976 "skipping modify field patch.\n" );
978 $this->
output(
"...$field in table $table already modified by patch $patch.\n" );
980 $apply = $this->
applyPatch( $patch, $fullpath,
"Modifying $field field of table $table" );
998 public function modifyTable( $table, $patch, $fullpath =
false ) {
999 if ( !$this->
doTable( $table ) ) {
1003 $updateKey =
"$table-$patch";
1004 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
1005 $this->
output(
"...$table table does not exist, skipping modify table patch.\n" );
1007 $this->
output(
"...table $table already modified by patch $patch.\n" );
1009 $apply = $this->
applyPatch( $patch, $fullpath,
"Modifying table $table" );
1034 $this->
output(
"Running $script...\n" );
1035 $task = $this->maintenance->runChild( $class );
1036 $ok = $task->execute();
1038 throw new RuntimeException(
"Execution of $script did not complete successfully." );
1040 $this->
output(
"done.\n" );
1049 $repo = RepoGroup::singleton()->getLocalRepo();
1050 $zonePath = $repo->getZonePath(
'temp' );
1051 if ( $repo->getBackend()->directoryExists( [
'dir' => $zonePath ] ) ) {
1053 $status = $repo->getBackend()->secure( [
1058 if ( $status->isOK() ) {
1059 $this->
output(
"Set the local repo temp zone container to be private.\n" );
1061 $this->
output(
"Failed to set the local repo temp zone container to be private.\n" );
1073 $this->
output(
"Purging caches..." );
1076 $this->db->delete(
'objectcache',
'*', __METHOD__ );
1085 MediaWikiServices::getInstance()->getResourceLoader()
1087 $blobStore->clear();
1090 $this->db->delete(
'module_deps',
'*', __METHOD__ );
1091 $this->
output(
"done.\n" );
1098 $this->
output(
"...site_stats is populated..." );
1099 $row = $this->db->selectRow(
'site_stats',
'*', [
'ss_row_id' => 1 ], __METHOD__ );
1100 if ( $row ===
false ) {
1101 $this->
output(
"data is missing! rebuilding...\n" );
1102 } elseif ( isset( $row->site_stats ) && $row->ss_total_pages == -1 ) {
1103 $this->
output(
"missing ss_total_pages, rebuilding...\n" );
1105 $this->
output(
"done.\n" );
1112 # Common updater functions
1118 $activeUsers = $this->db->selectField(
'site_stats',
'ss_active_users',
'', __METHOD__ );
1119 if ( $activeUsers == -1 ) {
1120 $activeUsers = $this->db->selectField(
'recentchanges',
1121 'COUNT( DISTINCT rc_user_text )',
1122 [
'rc_user != 0',
'rc_bot' => 0,
"rc_log_type != 'newusers'" ], __METHOD__
1124 $this->db->update(
'site_stats',
1125 [
'ss_active_users' => intval( $activeUsers ) ],
1126 [
'ss_row_id' => 1 ], __METHOD__, [
'LIMIT' => 1 ]
1129 $this->
output(
"...ss_active_users user count set...\n" );
1138 "Populating log_user_text field, printing progress markers. For large\n" .
1139 "databases, you may want to hit Ctrl-C and do this manually with\n" .
1140 "maintenance/populateLogUsertext.php.\n"
1143 $task = $this->maintenance->runChild( PopulateLogUsertext::class );
1145 $this->
output(
"done.\n" );
1155 "Populating log_search table, printing progress markers. For large\n" .
1156 "databases, you may want to hit Ctrl-C and do this manually with\n" .
1157 "maintenance/populateLogSearch.php.\n" );
1159 $task = $this->maintenance->runChild( PopulateLogSearch::class );
1161 $this->
output(
"done.\n" );
1170 if ( $this->db->fieldExists(
'categorylinks',
'cl_collation', __METHOD__ ) ) {
1171 if ( $this->db->selectField(
1178 $this->
output(
"...collations up-to-date.\n" );
1183 $this->
output(
"Updating category collations..." );
1184 $task = $this->maintenance->runChild( UpdateCollation::class );
1186 $this->
output(
"...done.\n" );
1194 if ( $this->db->tableExists(
'user_properties' ) ) {
1195 $cl = $this->maintenance->runChild( ConvertUserOptions::class,
'convertUserOptions.php' );
1197 $this->
output(
"done.\n" );
1207 if ( !$this->
doTable(
'profiling' ) ) {
1211 $profileToDb =
false;
1214 if ( $out ===
'db' ) {
1215 $profileToDb =
true;
1216 } elseif ( is_array( $out ) && in_array(
'db', $out ) ) {
1217 $profileToDb =
true;
1221 if ( $profileToDb && !$this->db->tableExists(
'profiling', __METHOD__ ) ) {
1222 $this->
applyPatch(
'patch-profiling.sql',
false,
'Add profiling table' );
1233 $cl = $this->maintenance->runChild(
1234 RebuildLocalisationCache::class,
'rebuildLocalisationCache.php'
1236 '@phan-var RebuildLocalisationCache $cl';
1237 $this->
output(
"Rebuilding localisation cache...\n" );
1240 $this->
output(
"done.\n" );
1251 $this->
output(
"Turning off Content Handler DB fields for this part of upgrade.\n" );
1263 if ( $this->holdContentHandlerUseDB ) {
1264 $this->
output(
"Content Handler DB fields should be usable now.\n" );
1276 "Migrating comments to the 'comments' table, printing progress markers. For large\n" .
1277 "databases, you may want to hit Ctrl-C and do this manually with\n" .
1278 "maintenance/migrateComments.php.\n"
1280 $task = $this->maintenance->runChild( MigrateComments::class,
'migrateComments.php' );
1281 $ok = $task->execute();
1282 $this->
output( $ok ?
"done.\n" :
"errors were encountered.\n" );
1291 if ( $this->
tableExists(
'image_comment_temp' ) ) {
1292 $this->
output(
"Merging image_comment_temp into the image table\n" );
1293 $task = $this->maintenance->runChild(
1294 MigrateImageCommentTemp::class,
'migrateImageCommentTemp.php'
1298 $ok = $task->execute();
1299 $this->
output( $ok ?
"done.\n" :
"errors were encountered.\n" );
1301 $this->
dropTable(
'image_comment_temp' );
1313 "Migrating actors to the 'actor' table, printing progress markers. For large\n" .
1314 "databases, you may want to hit Ctrl-C and do this manually with\n" .
1315 "maintenance/migrateActors.php.\n"
1317 $task = $this->maintenance->runChild(
'MigrateActors',
'migrateActors.php' );
1318 $ok = $task->execute();
1319 $this->
output( $ok ?
"done.\n" :
"errors were encountered.\n" );
1328 if ( $this->db->fieldExists(
'archive',
'ar_text', __METHOD__ ) ) {
1329 $this->
output(
"Migrating archive ar_text to modern storage.\n" );
1330 $task = $this->maintenance->runChild( MigrateArchiveText::class,
'migrateArchiveText.php' );
1333 if ( $task->execute() ) {
1334 $this->
applyPatch(
'patch-drop-ar_text.sql',
false,
1335 'Dropping ar_text and ar_flags columns' );
1345 $info = $this->db->fieldInfo(
'archive',
'ar_rev_id', __METHOD__ );
1347 throw new MWException(
'Missing ar_rev_id field of archive table. Should not happen.' );
1349 if ( $info->isNullable() ) {
1350 $this->
output(
"Populating ar_rev_id.\n" );
1351 $task = $this->maintenance->runChild(
'PopulateArchiveRevId',
'populateArchiveRevId.php' );
1352 if ( $task->execute() ) {
1353 $this->
applyPatch(
'patch-ar_rev_id-not-null.sql',
false,
1354 'Making ar_rev_id not nullable' );
1364 if ( !$this->
updateRowExists(
'populate externallinks.el_index_60' ) ) {
1366 "Populating el_index_60 field, printing progress markers. For large\n" .
1367 "databases, you may want to hit Ctrl-C and do this manually with\n" .
1368 "maintenance/populateExternallinksIndex60.php.\n"
1370 $task = $this->maintenance->runChild(
'PopulateExternallinksIndex60',
1371 'populateExternallinksIndex60.php' );
1373 $this->
output(
"done.\n" );
1387 "Migrating revision data to the MCR 'slot' and 'content' tables, printing progress markers.\n" .
1388 "For large databases, you may want to hit Ctrl-C and do this manually with\n" .
1389 "maintenance/populateContentTables.php.\n"
1391 $task = $this->maintenance->runChild(
1394 $ok = $task->execute();
1395 $this->
output( $ok ?
"done.\n" :
"errors were encountered.\n" );
1426 if ( $func === $this ) {
1428 $func = array_shift( $params );
1431 if ( !is_array( $func ) && method_exists( $this, $func ) ) {
1432 $func = [ $this, $func ];
1433 } elseif ( $passSelf ) {
1434 array_unshift( $params, $this );
1438 return $func( ...$params );
int $wgMultiContentRevisionSchemaMigrationStage
RevisionStore table schema migration stage (content, slots, content_models & slot_roles tables).
$wgAutoloadClasses
Array mapping class names to filenames, for autoloading.
$wgProfiler
Profiler configuration.
$wgCategoryCollation
Specify how category names should be sorted, when listed on a category page.
$wgHooks
Global list of hooks.
$wgSharedDB
Shared database for multiple wikis.
$wgContentHandlerUseDB
Set to false to disable use of the database fields introduced by the ContentHandler facility.
$wgLocalisationCacheConf
Localisation cache configuration.
global $wgCommandLineMode
Class for handling database updates.
purgeCache()
Purge various database caches.
addExtensionTable( $tableName, $sqlPath)
Convenience wrapper for addExtensionUpdate() when adding a new table (which is the most common usage ...
getDB()
Get a database connection to run updates.
setFileAccess()
Set any .htaccess files or equivilent for storage repos.
migrateImageCommentTemp()
Merge image_comment_temp into the image table.
loadExtensions()
Loads LocalSettings.php, if needed, and initialises everything needed for LoadExtensionSchemaUpdates ...
addIndex( $table, $index, $patch, $fullpath=false)
Add a new index to an existing table.
array $updates
Array of updates to perform on the database.
$holdContentHandlerUseDB
Hold the value of $wgContentHandlerUseDB during the upgrade.
modifyExtensionTable( $tableName, $sqlPath)
disableContentHandlerUseDB()
Turns off content handler fields during parts of the upgrade where they aren't available.
bool $skipSchema
Flag specifying whether or not to skip schema (e.g.
populateArchiveRevId()
Populate ar_rev_id, then make it not nullable.
runMaintenance( $class, $script)
Run a maintenance script.
migrateArchiveText()
Migrate ar_text to modern storage.
addField( $table, $field, $patch, $fullpath=false)
Add a new field to an existing table.
addExtensionIndex( $tableName, $indexName, $sqlPath)
modifyTable( $table, $patch, $fullpath=false)
Modify an existing table, similar to modifyField.
doUpdates(array $what=[ 'core', 'extensions', 'stats'])
Do all the updates.
updateRowExists( $key)
Helper function: check if the given key is present in the updatelog table.
const REPLICATION_WAIT_TIMEOUT
runUpdates(array $updates, $passSelf)
Helper function for doUpdates()
getCoreUpdateList()
Get an array of updates to perform on the database.
enableContentHandlerUseDB()
Turns content handler fields back on.
populateExternallinksIndex60()
Populates the externallinks.el_index_60 field.
output( $str)
Output some text.
doLogSearchPopulation()
Migrate log params to new table and index for searching.
getPostDatabaseUpdateMaintenance()
doLogUsertextPopulation()
Populates the log_user_text field in the logging table.
getExtensionUpdates()
Get the list of extension-defined updates.
insertUpdateRow( $key, $val=null)
Helper function: Add a key to the updatelog table Obviously, only use this for updates that occur aft...
canUseNewUpdatelog()
Updatelog was changed in 1.17 to have a ul_value column so we can record more information about what ...
patchPath(IDatabase $db, $patch)
Get the full path of a patch file.
copyFile( $filename)
Append an SQL fragment to the open file handle.
string[] $postDatabaseUpdateMaintenance
Scripts to run after database update Should be a subclass of LoggedUpdateMaintenance.
renameIndex( $table, $oldIndex, $newIndex, $skipBothIndexExistWarning, $patch, $fullpath=false)
Rename an index from an existing table.
writeSchemaUpdateFile(array $schemaUpdate=[])
rebuildLocalisationCache()
Rebuilds the localisation cache.
addExtensionField( $tableName, $columnName, $sqlPath)
IMaintainableDatabase $db
Handle to the database subclass.
dropExtensionTable( $tableName, $sqlPath)
addTable( $name, $patch, $fullpath=false)
Add a new table to the database.
modifyField( $table, $field, $patch, $fullpath=false)
Modify an existing field.
doActiveUsersInit()
Sets the number of active users in the site_stats table.
addIndexIfNoneExist( $table, $indexes, $patch, $fullpath=false)
Add a new index to an existing table if none of the given indexes exist.
dropExtensionField( $tableName, $columnName, $sqlPath)
static newForDB(IMaintainableDatabase $db, $shared=false, Maintenance $maintenance=null)
getOldGlobalUpdates()
Before 1.17, we used to handle updates via stuff like $wgExtNewTables/Fields/Indexes.
addPostDatabaseUpdateMaintenance( $class)
Add a maintenance script to be run after the database updates are complete.
dropField( $table, $field, $patch, $fullpath=false)
Drop a field from an existing table.
doCollationUpdate()
Update CategoryLinks collation.
renameExtensionIndex( $tableName, $oldIndexName, $newIndexName, $sqlPath, $skipBothIndexExistWarning=false)
Rename an index on an extension table.
migrateActors()
Migrate actors to the new 'actor' table.
addExtensionUpdate(array $update)
Add a new update coming from an extension.
array $updatesSkipped
Array of updates that were skipped.
resource $fileHandle
File handle for SQL output.
appendLine( $line)
Append a line to the open filehandle.
dropExtensionIndex( $tableName, $indexName, $sqlPath)
Drop an index from an extension table.
initOldGlobals()
Initialize all of the old globals.
doEnableProfiling()
Enable profiling table when it's turned on.
array $extensionUpdates
List of extension-provided database updates.
checkStats()
Check the site_stats table is not properly populated.
modifyExtensionField( $tableName, $fieldName, $sqlPath)
applyPatch( $path, $isFullPath=false, $msg=null)
Applies a SQL patch.
dropIndex( $table, $index, $patch, $fullpath=false)
Drop an index from an existing table.
populateContentTables()
Populates the MCR content tables.
__construct(IMaintainableDatabase &$db, $shared, Maintenance $maintenance=null)
dropTable( $table, $patch=false, $fullpath=false)
If the specified table exists, drop it, or execute the patch if one is provided.
migrateComments()
Migrate comments to the new 'comment' table.
ifNoActorTable( $func,... $params)
Only run a function if the actor table does not exist.
getSchemaVars()
Get appropriate schema variables in the current database connection.
doTable( $name)
Returns whether updates should be executed on the database table $name.
doMigrateUserOptions()
Migrates user options from the user table blob to user_properties.
Fake maintenance wrapper, mostly used for the web installer/updater.
static getExistingLocalSettings()
Determine if LocalSettings.php exists.
static getDBTypes()
Get a list of known DB types.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
setDB(IMaintainableDatabase $db)
Sets database object to be returned by getDB().
This class generates message blobs for use by ResourceLoader.
static doAllAndCommit( $database, array $options=[])
Do all updates and commit them.
const SCHEMA_COMPAT_WRITE_NEW
Advanced database interface for IDatabase handles that include maintenance methods.