MediaWiki
1.32.5
|
Class for handling database updates. More...
Public Member Functions | |
addExtensionField ( $tableName, $columnName, $sqlPath) | |
addExtensionIndex ( $tableName, $indexName, $sqlPath) | |
addExtensionTable ( $tableName, $sqlPath) | |
Convenience wrapper for addExtensionUpdate() when adding a new table (which is the most common usage of updaters in an extension) More... | |
addExtensionUpdate (array $update) | |
Add a new update coming from an extension. More... | |
addPostDatabaseUpdateMaintenance ( $class) | |
Add a maintenance script to be run after the database updates are complete. More... | |
appendLine ( $line) | |
Append a line to the open filehandle. More... | |
copyFile ( $filename) | |
Append an SQL fragment to the open file handle. More... | |
doUpdates (array $what=[ 'core', 'extensions', 'stats']) | |
Do all the updates. More... | |
dropExtensionField ( $tableName, $columnName, $sqlPath) | |
dropExtensionIndex ( $tableName, $indexName, $sqlPath) | |
Drop an index from an extension table. More... | |
dropExtensionTable ( $tableName, $sqlPath) | |
dropTable ( $table, $patch=false, $fullpath=false) | |
If the specified table exists, drop it, or execute the patch if one is provided. More... | |
getDB () | |
Get a database connection to run updates. More... | |
getPostDatabaseUpdateMaintenance () | |
getSchemaVars () | |
Get appropriate schema variables in the current database connection. More... | |
insertUpdateRow ( $key, $val=null) | |
Helper function: Add a key to the updatelog table Obviously, only use this for updates that occur after the updatelog table was created! More... | |
modifyExtensionField ( $tableName, $fieldName, $sqlPath) | |
modifyExtensionTable ( $tableName, $sqlPath) | |
modifyField ( $table, $field, $patch, $fullpath=false) | |
Modify an existing field. More... | |
modifyTable ( $table, $patch, $fullpath=false) | |
Modify an existing table, similar to modifyField. More... | |
output ( $str) | |
Output some text. More... | |
patchPath (IDatabase $db, $patch) | |
Get the full path of a patch file. More... | |
purgeCache () | |
Purge various database caches. More... | |
renameExtensionIndex ( $tableName, $oldIndexName, $newIndexName, $sqlPath, $skipBothIndexExistWarning=false) | |
Rename an index on an extension table. More... | |
runMaintenance ( $class, $script) | |
Run a maintenance script. More... | |
setFileAccess () | |
Set any .htaccess files or equivilent for storage repos. More... | |
tableExists ( $tableName) | |
updateRowExists ( $key) | |
Helper function: check if the given key is present in the updatelog table. More... | |
Static Public Member Functions | |
static | newForDB (Database $db, $shared=false, Maintenance $maintenance=null) |
Public Attributes | |
const | REPLICATION_WAIT_TIMEOUT = 300 |
Protected Member Functions | |
__construct (Database &$db, $shared, Maintenance $maintenance=null) | |
addField ( $table, $field, $patch, $fullpath=false) | |
Add a new field to an existing table. More... | |
addIndex ( $table, $index, $patch, $fullpath=false) | |
Add a new index to an existing table. More... | |
addIndexIfNoneExist ( $table, $indexes, $patch, $fullpath=false) | |
Add a new index to an existing table if none of the given indexes exist. More... | |
addTable ( $name, $patch, $fullpath=false) | |
Add a new table to the database. More... | |
applyPatch ( $path, $isFullPath=false, $msg=null) | |
Applies a SQL patch. More... | |
canUseNewUpdatelog () | |
Updatelog was changed in 1.17 to have a ul_value column so we can record more information about what kind of updates we've done (that's what this class does). More... | |
checkStats () | |
Check the site_stats table is not properly populated. More... | |
disableContentHandlerUseDB () | |
Turns off content handler fields during parts of the upgrade where they aren't available. More... | |
doActiveUsersInit () | |
Sets the number of active users in the site_stats table. More... | |
doCollationUpdate () | |
Update CategoryLinks collation. More... | |
doEnableProfiling () | |
Enable profiling table when it's turned on. More... | |
doLogSearchPopulation () | |
Migrate log params to new table and index for searching. More... | |
doLogUsertextPopulation () | |
Populates the log_user_text field in the logging table. More... | |
doMigrateUserOptions () | |
Migrates user options from the user table blob to user_properties. More... | |
doTable ( $name) | |
Returns whether updates should be executed on the database table $name. More... | |
dropField ( $table, $field, $patch, $fullpath=false) | |
Drop a field from an existing table. More... | |
dropIndex ( $table, $index, $patch, $fullpath=false) | |
Drop an index from an existing table. More... | |
enableContentHandlerUseDB () | |
Turns content handler fields back on. More... | |
getCoreUpdateList () | |
Get an array of updates to perform on the database. More... | |
getExtensionUpdates () | |
Get the list of extension-defined updates. More... | |
getOldGlobalUpdates () | |
Before 1.17, we used to handle updates via stuff like $wgExtNewTables/Fields/Indexes. More... | |
migrateActors () | |
Migrate actors to the new 'actor' table. More... | |
migrateArchiveText () | |
Migrate ar_text to modern storage. More... | |
migrateComments () | |
Migrate comments to the new 'comment' table. More... | |
migrateImageCommentTemp () | |
Merge image_comment_temp into the image table. More... | |
populateArchiveRevId () | |
Populate ar_rev_id, then make it not nullable. More... | |
populateContentTables () | |
Populates the MCR content tables. More... | |
populateExternallinksIndex60 () | |
Populates the externallinks.el_index_60 field. More... | |
rebuildLocalisationCache () | |
Rebuilds the localisation cache. More... | |
renameIndex ( $table, $oldIndex, $newIndex, $skipBothIndexExistWarning, $patch, $fullpath=false) | |
Rename an index from an existing table. More... | |
Protected Attributes | |
Database | $db |
Handle to the database subclass. More... | |
array | $extensionUpdates = [] |
List of extension-provided database updates. More... | |
resource | $fileHandle = null |
File handle for SQL output. More... | |
$holdContentHandlerUseDB = true | |
Hold the value of $wgContentHandlerUseDB during the upgrade. More... | |
Maintenance | $maintenance |
string[] | $postDatabaseUpdateMaintenance |
Scripts to run after database update Should be a subclass of LoggedUpdateMaintenance. More... | |
$shared = false | |
bool | $skipSchema = false |
Flag specifying whether or not to skip schema (e.g. More... | |
array | $updates = [] |
Array of updates to perform on the database. More... | |
array | $updatesSkipped = [] |
Array of updates that were skipped. More... | |
Private Member Functions | |
initOldGlobals () | |
Initialize all of the old globals. More... | |
loadExtensions () | |
Loads LocalSettings.php, if needed, and initialises everything needed for LoadExtensionSchemaUpdates hook. More... | |
runUpdates (array $updates, $passSelf) | |
Helper function for doUpdates() More... | |
writeSchemaUpdateFile (array $schemaUpdate=[]) | |
Class for handling database updates.
Roughly based off of updaters.inc, with a few improvements :)
Definition at line 36 of file DatabaseUpdater.php.
|
protected |
Database | &$db | To perform updates on |
bool | $shared | Whether to perform updates on shared tables |
Maintenance | null | $maintenance | Maintenance object which created us |
Definition at line 116 of file DatabaseUpdater.php.
References $db, $maintenance, $shared, DBO_DDLMODE, initOldGlobals(), loadExtensions(), Hooks\run(), Maintenance\setDB(), and Wikimedia\Rdbms\Database\setFlag().
DatabaseUpdater::addExtensionField | ( | $tableName, | |
$columnName, | |||
$sqlPath | |||
) |
string | $tableName | |
string | $columnName | |
string | $sqlPath |
Definition at line 275 of file DatabaseUpdater.php.
References true.
DatabaseUpdater::addExtensionIndex | ( | $tableName, | |
$indexName, | |||
$sqlPath | |||
) |
string | $tableName | |
string | $indexName | |
string | $sqlPath |
Definition at line 263 of file DatabaseUpdater.php.
References true.
DatabaseUpdater::addExtensionTable | ( | $tableName, | |
$sqlPath | |||
) |
Convenience wrapper for addExtensionUpdate() when adding a new table (which is the most common usage of updaters in an extension)
string | $tableName | Name of table to create |
string | $sqlPath | Full path to the schema file |
Definition at line 252 of file DatabaseUpdater.php.
References true.
DatabaseUpdater::addExtensionUpdate | ( | array | $update | ) |
Add a new update coming from an extension.
This should be called by extensions while executing the LoadExtensionSchemaUpdates hook.
array | $update | The update to run. Format is [ $callback, $params... ] $callback is the method to call; either a DatabaseUpdater method name or a callable. Must be serializable (ie. no anonymous functions allowed). The rest of the parameters (if any) will be passed to the callback. The first parameter passed to the callback is always this object. |
Definition at line 239 of file DatabaseUpdater.php.
|
protected |
Add a new field to an existing table.
string | $table | Name of the table to modify |
string | $field | Name of the new field |
string | $patch | Path to the patch file |
bool | $fullpath | Whether to treat $patch path as a relative or not |
Definition at line 744 of file DatabaseUpdater.php.
References applyPatch(), doTable(), and output().
|
protected |
Add a new index to an existing table.
string | $table | Name of the table to modify |
string | $index | Name of the new index |
string | $patch | Path to the patch file |
bool | $fullpath | Whether to treat $patch path as a relative or not |
Definition at line 769 of file DatabaseUpdater.php.
References applyPatch(), doTable(), and output().
|
protected |
Add a new index to an existing table if none of the given indexes exist.
string | $table | Name of the table to modify |
string[] | $indexes | Name of the indexes to check. $indexes[0] should be the one actually being added. |
string | $patch | Path to the patch file |
bool | $fullpath | Whether to treat $patch path as a relative or not |
Definition at line 795 of file DatabaseUpdater.php.
References applyPatch(), as, doTable(), and output().
DatabaseUpdater::addPostDatabaseUpdateMaintenance | ( | $class | ) |
Add a maintenance script to be run after the database updates are complete.
Script should subclass LoggedUpdateMaintenance
string | $class | Name of a Maintenance subclass |
Definition at line 382 of file DatabaseUpdater.php.
|
protected |
Add a new table to the database.
string | $name | Name of the new table |
string | $patch | Path to the patch file |
bool | $fullpath | Whether to treat $patch path as a relative or not |
Definition at line 721 of file DatabaseUpdater.php.
References $name, applyPatch(), doTable(), and output().
DatabaseUpdater::appendLine | ( | $line | ) |
Append a line to the open filehandle.
The line is assumed to be a complete SQL statement.
This is used as a callback for sourceLine().
string | $line | Text to append to the file |
MWException |
Definition at line 651 of file DatabaseUpdater.php.
References $line.
|
protected |
Applies a SQL patch.
string | $path | Path to the patch file |
bool | $isFullPath | Whether to treat $path as a relative or not |
string | null | $msg | Description of the patch |
Reimplemented in MssqlUpdater.
Definition at line 668 of file DatabaseUpdater.php.
References $path, copyFile(), output(), and patchPath().
Referenced by addField(), addIndex(), addIndexIfNoneExist(), PostgresUpdater\addInterwikiType(), PostgresUpdater\addPgExtIndex(), addTable(), MysqlUpdater\checkBin(), PostgresUpdater\checkIwlPrefix(), PostgresUpdater\checkPageDeletedTrigger(), PostgresUpdater\checkRevUserFkey(), PostgresUpdater\convertArchive2(), OracleUpdater\doAutoIncrementTriggers(), MysqlUpdater\doBacklinkingIndicesUpdate(), MysqlUpdater\doCategorylinksIndicesUpdate(), MysqlUpdater\doClFieldsUpdate(), doEnableProfiling(), MysqlUpdater\doExtendCommentLengths(), MysqlUpdater\doFilearchiveIndicesUpdate(), MysqlUpdater\doFixAncientImagelinks(), OracleUpdater\doFKRenameDeferr(), OracleUpdater\doFunctions17(), MysqlUpdater\doIndexUpdate(), MysqlUpdater\doInterwikiUpdate(), MysqlUpdater\doIwlinksIndexNonUnique(), MysqlUpdater\doLangLinksLengthUpdate(), MysqlUpdater\doMaybeProfilingMemoryUpdate(), OracleUpdater\doNamespaceDefaults(), MysqlUpdater\doNonUniquePlTlIl(), MysqlUpdater\doPagelinksUpdate(), OracleUpdater\doPageRestrictionsPKUKFix(), OracleUpdater\doRebuildDuplicateFunction(), OracleUpdater\doRecentchangesFK2Cascade(), OracleUpdater\doRemoveNotNullEmptyDefaults(), OracleUpdater\doRemoveNotNullEmptyDefaults2(), MysqlUpdater\doRestrictionsUpdate(), MysqlUpdater\doRevisionPageRevIndexNonUnique(), OracleUpdater\doSchemaUpgrade17(), MysqlUpdater\doTemplatelinksUpdate(), MysqlUpdater\doUnsignedSyncronisation(), MysqlUpdater\doUpdateMimeMinorField(), MysqlUpdater\doUserGroupsUpdate(), MysqlUpdater\doUserNewTalkTimestampNotNull(), MysqlUpdater\doUserUniqueUpdate(), MysqlUpdater\doWatchlistNull(), dropField(), dropIndex(), dropTable(), migrateArchiveText(), modifyField(), modifyTable(), populateArchiveRevId(), PostgresUpdater\rebuildTextSearch(), renameIndex(), PostgresUpdater\renameTable(), SqliteUpdater\sqliteInitialIndexes(), SqliteUpdater\sqliteSetupSearchindex(), and PostgresUpdater\tsearchFixes().
|
protected |
Updatelog was changed in 1.17 to have a ul_value column so we can record more information about what kind of updates we've done (that's what this class does).
Pre-1.17 wikis won't have this column, and really old wikis might not even have updatelog at all
Definition at line 542 of file DatabaseUpdater.php.
Referenced by insertUpdateRow().
|
protected |
Check the site_stats table is not properly populated.
Definition at line 1090 of file DatabaseUpdater.php.
References SiteStatsInit\doAllAndCommit(), and output().
Referenced by doUpdates().
DatabaseUpdater::copyFile | ( | $filename | ) |
Append an SQL fragment to the open file handle.
string | $filename | File name to open |
Definition at line 631 of file DatabaseUpdater.php.
Referenced by applyPatch().
|
protected |
Turns off content handler fields during parts of the upgrade where they aren't available.
Definition at line 1239 of file DatabaseUpdater.php.
References $wgContentHandlerUseDB, and output().
|
protected |
Sets the number of active users in the site_stats table.
Definition at line 1110 of file DatabaseUpdater.php.
References output().
|
protected |
Update CategoryLinks collation.
Definition at line 1161 of file DatabaseUpdater.php.
References $wgCategoryCollation, class, and output().
|
protected |
Enable profiling table when it's turned on.
Definition at line 1197 of file DatabaseUpdater.php.
References $out, $wgProfiler, applyPatch(), and doTable().
|
protected |
Migrate log params to new table and index for searching.
Definition at line 1145 of file DatabaseUpdater.php.
References class, output(), and updateRowExists().
|
protected |
Populates the log_user_text field in the logging table.
Definition at line 1128 of file DatabaseUpdater.php.
References class, output(), and updateRowExists().
|
protected |
Migrates user options from the user table blob to user_properties.
Definition at line 1186 of file DatabaseUpdater.php.
|
protected |
Returns whether updates should be executed on the database table $name.
Updates will be prevented if the table is a shared table and it is not specified to run updates on shared tables.
string | $name | Table name |
Definition at line 555 of file DatabaseUpdater.php.
References $name, $wgSharedDB, $wgSharedTables, and output().
Referenced by addField(), addIndex(), addIndexIfNoneExist(), addTable(), MysqlUpdater\checkBin(), doEnableProfiling(), MysqlUpdater\doInterwikiUpdate(), MysqlUpdater\doMaybeProfilingMemoryUpdate(), MysqlUpdater\doRevisionPageRevIndexNonUnique(), MysqlUpdater\doUnsignedSyncronisation(), MysqlUpdater\doUserGroupsUpdate(), MysqlUpdater\doUserNewTalkTimestampNotNull(), MysqlUpdater\doUserUniqueUpdate(), dropField(), dropIndex(), dropTable(), MysqlUpdater\indexHasField(), modifyField(), modifyTable(), and renameIndex().
DatabaseUpdater::doUpdates | ( | array | $what = [ 'core' , |
'extensions' | , | ||
'stats'] | |||
) |
Do all the updates.
array | $what | What updates to perform |
Definition at line 443 of file DatabaseUpdater.php.
References checkStats(), getCoreUpdateList(), getExtensionUpdates(), getOldGlobalUpdates(), getSchemaVars(), runUpdates(), and writeSchemaUpdateFile().
DatabaseUpdater::dropExtensionField | ( | $tableName, | |
$columnName, | |||
$sqlPath | |||
) |
string | $tableName | |
string | $columnName | |
string | $sqlPath |
Definition at line 287 of file DatabaseUpdater.php.
References true.
DatabaseUpdater::dropExtensionIndex | ( | $tableName, | |
$indexName, | |||
$sqlPath | |||
) |
Drop an index from an extension table.
string | $tableName | The table name |
string | $indexName | The index name |
string | $sqlPath | The path to the SQL change path |
Definition at line 300 of file DatabaseUpdater.php.
References true.
DatabaseUpdater::dropExtensionTable | ( | $tableName, | |
$sqlPath | |||
) |
string | $tableName | |
string | $sqlPath |
Definition at line 311 of file DatabaseUpdater.php.
References true.
|
protected |
Drop a field from an existing table.
string | $table | Name of the table to modify |
string | $field | Name of the old field |
string | $patch | Path to the patch file |
bool | $fullpath | Whether to treat $patch path as a relative or not |
Definition at line 827 of file DatabaseUpdater.php.
References applyPatch(), doTable(), and output().
|
protected |
Drop an index from an existing table.
string | $table | Name of the table to modify |
string | $index | Name of the index |
string | $patch | Path to the patch file |
bool | $fullpath | Whether to treat $patch path as a relative or not |
Definition at line 850 of file DatabaseUpdater.php.
References applyPatch(), doTable(), and output().
If the specified table exists, drop it, or execute the patch if one is provided.
Public
string | $table | Table to drop. |
string | bool | $patch | String of patch file that will drop the table. Default: false. |
bool | $fullpath | Whether $patch is a full path. Default: false. |
Definition at line 930 of file DatabaseUpdater.php.
References applyPatch(), doTable(), and output().
Referenced by migrateImageCommentTemp().
|
protected |
Turns content handler fields back on.
Definition at line 1252 of file DatabaseUpdater.php.
References $holdContentHandlerUseDB, $wgContentHandlerUseDB, and output().
|
abstractprotected |
Get an array of updates to perform on the database.
Should return a multi-dimensional array. The main key is the MediaWiki version (1.12, 1.13...) with the values being arrays of updates, identical to how updaters.inc did it (for now)
Reimplemented in PostgresUpdater, MssqlUpdater, OracleUpdater, MysqlUpdater, and SqliteUpdater.
Referenced by doUpdates().
DatabaseUpdater::getDB | ( | ) |
Get a database connection to run updates.
Definition at line 205 of file DatabaseUpdater.php.
References $db.
|
protected |
Get the list of extension-defined updates.
Definition at line 391 of file DatabaseUpdater.php.
References $extensionUpdates.
Referenced by doUpdates().
|
protected |
Before 1.17, we used to handle updates via stuff like $wgExtNewTables/Fields/Indexes.
This is nasty :) We refactored a lot of this in 1.17 but we want to remain back-compatible for a while. So load up these old global-based things into our update list.
Reimplemented in PostgresUpdater.
Definition at line 580 of file DatabaseUpdater.php.
References $updates, as, and true.
Referenced by doUpdates().
DatabaseUpdater::getPostDatabaseUpdateMaintenance | ( | ) |
Definition at line 400 of file DatabaseUpdater.php.
References $postDatabaseUpdateMaintenance.
DatabaseUpdater::getSchemaVars | ( | ) |
Get appropriate schema variables in the current database connection.
This should be called after any request data has been imported, but before any write operations to the database. The result should be passed to the DB setSchemaVars() method.
Reimplemented in MysqlUpdater.
Definition at line 434 of file DatabaseUpdater.php.
Referenced by doUpdates().
|
private |
Initialize all of the old globals.
One day this should all become something much nicer
Definition at line 136 of file DatabaseUpdater.php.
Referenced by __construct().
DatabaseUpdater::insertUpdateRow | ( | $key, | |
$val = null |
|||
) |
Helper function: Add a key to the updatelog table Obviously, only use this for updates that occur after the updatelog table was created!
string | $key | Name of key to insert |
string | null | $val | [optional] Value to insert along with the key |
Definition at line 524 of file DatabaseUpdater.php.
References canUseNewUpdatelog(), and DBO_DDLMODE.
Referenced by modifyField(), modifyTable(), populateContentTables(), and MssqlUpdater\updateSchema().
|
private |
Loads LocalSettings.php, if needed, and initialises everything needed for LoadExtensionSchemaUpdates hook.
Definition at line 154 of file DatabaseUpdater.php.
References $queue, $vars, $wgAutoloadClasses, $wgHooks, Installer\getExistingLocalSettings(), and ExtensionRegistry\getInstance().
Referenced by __construct().
|
protected |
Migrate actors to the new 'actor' table.
Definition at line 1310 of file DatabaseUpdater.php.
References $wgActorTableSchemaMigrationStage, output(), SCHEMA_COMPAT_WRITE_NEW, and updateRowExists().
|
protected |
Migrate ar_text to modern storage.
Definition at line 1330 of file DatabaseUpdater.php.
References applyPatch(), class, and output().
|
protected |
Migrate comments to the new 'comment' table.
Definition at line 1265 of file DatabaseUpdater.php.
References $wgCommentTableSchemaMigrationStage, class, MIGRATION_WRITE_NEW, output(), and updateRowExists().
|
protected |
Merge image_comment_temp
into the image
table.
Definition at line 1285 of file DatabaseUpdater.php.
References $wgCommentTableSchemaMigrationStage, class, dropTable(), MIGRATION_OLD, output(), and tableExists().
DatabaseUpdater::modifyExtensionField | ( | $tableName, | |
$fieldName, | |||
$sqlPath | |||
) |
string | $tableName | The table name |
string | $fieldName | The field to be modified |
string | $sqlPath | The path to the SQL patch |
Definition at line 348 of file DatabaseUpdater.php.
References true.
DatabaseUpdater::modifyExtensionTable | ( | $tableName, | |
$sqlPath | |||
) |
string | $tableName | The table name |
string | $sqlPath | The path to the SQL patch |
Definition at line 358 of file DatabaseUpdater.php.
References true.
DatabaseUpdater::modifyField | ( | $table, | |
$field, | |||
$patch, | |||
$fullpath = false |
|||
) |
Modify an existing field.
string | $table | Name of the table to which the field belongs |
string | $field | Name of the field to modify |
string | $patch | Path to the patch file |
bool | $fullpath | Whether to treat $patch path as a relative or not |
Definition at line 961 of file DatabaseUpdater.php.
References applyPatch(), doTable(), insertUpdateRow(), output(), and updateRowExists().
DatabaseUpdater::modifyTable | ( | $table, | |
$patch, | |||
$fullpath = false |
|||
) |
Modify an existing table, similar to modifyField.
Intended for changes that touch more than one column on a table.
string | $table | Name of the table to modify |
string | $patch | Name of the patch file to apply |
string | bool | $fullpath | Whether to treat $patch path as relative or not, defaults to false |
Definition at line 993 of file DatabaseUpdater.php.
References applyPatch(), doTable(), insertUpdateRow(), output(), and updateRowExists().
|
static |
Database | $db | |
bool | $shared | |
Maintenance | null | $maintenance |
MWException |
Definition at line 189 of file DatabaseUpdater.php.
References $db, $maintenance, $shared, $type, Installer\getDBTypes(), and Wikimedia\Rdbms\IDatabase\getType().
Referenced by DatabaseInstaller\createExtensionTables(), DatabaseInstaller\doUpgrade(), PatchSql\execute(), MwSql\execute(), UpdateMediaWiki\execute(), DatabaseSqliteTest\prepareTestDB(), and DbTestRecorder\start().
DatabaseUpdater::output | ( | $str | ) |
Output some text.
If we're running from web, escape the text first.
string | $str | Text to output |
-taint | $str | escapes_html |
Definition at line 215 of file DatabaseUpdater.php.
References $wgCommandLineMode.
Referenced by addField(), addIndex(), addIndexIfNoneExist(), PostgresUpdater\addPgEnumValue(), PostgresUpdater\addPgExtIndex(), PostgresUpdater\addPgField(), PostgresUpdater\addPgIndex(), PostgresUpdater\addSequence(), addTable(), applyPatch(), PostgresUpdater\changeField(), PostgresUpdater\changeFieldPurgeTable(), PostgresUpdater\changeFkeyDeferrable(), PostgresUpdater\changeNullableField(), MysqlUpdater\checkBin(), PostgresUpdater\checkIndex(), PostgresUpdater\checkOiDeleted(), PostgresUpdater\checkOiNameConstraint(), PostgresUpdater\checkPageDeletedTrigger(), PostgresUpdater\checkRevUserFkey(), checkStats(), PostgresUpdater\convertArchive2(), disableContentHandlerUseDB(), doActiveUsersInit(), OracleUpdater\doAutoIncrementTriggers(), MysqlUpdater\doCategoryPopulation(), MysqlUpdater\doClFieldsUpdate(), doCollationUpdate(), MysqlUpdater\doExtendCommentLengths(), MysqlUpdater\doFixAncientImagelinks(), MysqlUpdater\doIndexUpdate(), OracleUpdater\doInsertPage0(), MysqlUpdater\doInterwikiUpdate(), MysqlUpdater\doIwlinksIndexNonUnique(), MysqlUpdater\doLangLinksLengthUpdate(), doLogSearchPopulation(), doLogUsertextPopulation(), MysqlUpdater\doMaybeProfilingMemoryUpdate(), doMigrateUserOptions(), MysqlUpdater\doNamespaceSize(), MysqlUpdater\doNonUniquePlTlIl(), MysqlUpdater\doPagelinksUpdate(), MysqlUpdater\doPageRandomUpdate(), OracleUpdater\doPageRestrictionsPKUKFix(), MysqlUpdater\doPopulateParentId(), MysqlUpdater\doRestrictionsUpdate(), MysqlUpdater\doRevisionPageRevIndexNonUnique(), MysqlUpdater\doSchemaRestructuring(), doTable(), MysqlUpdater\doTemplatelinksUpdate(), MysqlUpdater\doUnsignedSyncronisation(), MysqlUpdater\doUpdateMimeMinorField(), MysqlUpdater\doUserGroupsUpdate(), MysqlUpdater\doUserNewTalkTimestampNotNull(), MysqlUpdater\doUserUniqueUpdate(), MysqlUpdater\doWatchlistNull(), MysqlUpdater\doWatchlistUpdate(), PostgresUpdater\dropDefault(), dropField(), PostgresUpdater\dropFkey(), dropIndex(), PostgresUpdater\dropPgField(), PostgresUpdater\dropPgIndex(), PostgresUpdater\dropSequence(), dropTable(), enableContentHandlerUseDB(), MysqlUpdater\indexHasField(), migrateActors(), migrateArchiveText(), migrateComments(), migrateImageCommentTemp(), modifyField(), modifyTable(), populateArchiveRevId(), populateContentTables(), populateExternallinksIndex60(), OracleUpdater\purgeCache(), purgeCache(), rebuildLocalisationCache(), PostgresUpdater\rebuildTextSearch(), PostgresUpdater\renameIndex(), renameIndex(), PostgresUpdater\renameSequence(), PostgresUpdater\renameTable(), runMaintenance(), PostgresUpdater\setDefault(), setFileAccess(), PostgresUpdater\setSequenceOwner(), SqliteUpdater\sqliteInitialIndexes(), SqliteUpdater\sqliteSetupSearchindex(), and MssqlUpdater\updateSchema().
DatabaseUpdater::patchPath | ( | IDatabase | $db, |
$patch | |||
) |
Get the full path of a patch file.
Originally based on archive() from updaters.inc. Keep in mind this always returns a patch, as it fails back to MySQL if no DB-specific patch can be found
IDatabase | $db | |
string | $patch | The name of the patch, like patch-something.sql |
Definition at line 702 of file DatabaseUpdater.php.
References $db, $IP, and Wikimedia\Rdbms\IDatabase\getType().
Referenced by applyPatch().
|
protected |
Populate ar_rev_id, then make it not nullable.
Definition at line 1346 of file DatabaseUpdater.php.
References applyPatch(), and output().
|
protected |
Populates the MCR content tables.
Definition at line 1383 of file DatabaseUpdater.php.
References $wgMultiContentRevisionSchemaMigrationStage, class, insertUpdateRow(), output(), SCHEMA_COMPAT_WRITE_NEW, and updateRowExists().
|
protected |
Populates the externallinks.el_index_60 field.
Definition at line 1365 of file DatabaseUpdater.php.
References output(), and updateRowExists().
DatabaseUpdater::purgeCache | ( | ) |
Purge various database caches.
Reimplemented in OracleUpdater.
Definition at line 1064 of file DatabaseUpdater.php.
References $wgLocalisationCacheConf, output(), and rebuildLocalisationCache().
|
protected |
Rebuilds the localisation cache.
Definition at line 1222 of file DatabaseUpdater.php.
References class, and output().
Referenced by purgeCache().
DatabaseUpdater::renameExtensionIndex | ( | $tableName, | |
$oldIndexName, | |||
$newIndexName, | |||
$sqlPath, | |||
$skipBothIndexExistWarning = false |
|||
) |
Rename an index on an extension table.
string | $tableName | The table name |
string | $oldIndexName | The old index name |
string | $newIndexName | The new index name |
string | $sqlPath | The path to the SQL change path |
bool | $skipBothIndexExistWarning | Whether to warn if both the old and the new indexes exist. [facultative; by default, false] |
Definition at line 327 of file DatabaseUpdater.php.
References true.
|
protected |
Rename an index from an existing table.
string | $table | Name of the table to modify |
string | $oldIndex | Old name of the index |
string | $newIndex | New name of the index |
bool | $skipBothIndexExistWarning | Whether to warn if both the old and the new indexes exist. |
string | $patch | Path to the patch file |
bool | $fullpath | Whether to treat $patch path as a relative or not |
Reimplemented in PostgresUpdater.
Definition at line 876 of file DatabaseUpdater.php.
References applyPatch(), doTable(), and output().
DatabaseUpdater::runMaintenance | ( | $class, | |
$script | |||
) |
Run a maintenance script.
This should only be used when the maintenance script must run before later updates. If later updates don't depend on the script, add it to DatabaseUpdater::$postDatabaseUpdateMaintenance instead.
The script's execute() method must return true to indicate successful completion, and must return false (or throw an exception) to indicate unsuccessful completion.
string | $class | Maintenance subclass |
string | $script | Script path and filename, usually "maintenance/fooBar.php" |
Definition at line 1028 of file DatabaseUpdater.php.
References output().
|
private |
Helper function for doUpdates()
array | $updates | Array of updates to run |
bool | $passSelf | Whether to pass this object we calling external functions |
Definition at line 472 of file DatabaseUpdater.php.
References $params, $ret, $updates, $updatesSkipped, as, and updates().
Referenced by doUpdates().
DatabaseUpdater::setFileAccess | ( | ) |
Set any .htaccess files or equivilent for storage repos.
Some zones (e.g. "temp") used to be public and may have been initialized as such
Definition at line 1043 of file DatabaseUpdater.php.
References output(), and RepoGroup\singleton().
DatabaseUpdater::tableExists | ( | $tableName | ) |
string | $tableName |
Definition at line 369 of file DatabaseUpdater.php.
Referenced by migrateImageCommentTemp().
DatabaseUpdater::updateRowExists | ( | $key | ) |
Helper function: check if the given key is present in the updatelog table.
Obviously, only use this for updates that occur after the updatelog table was created!
string | $key | Name of the key to check for |
Definition at line 505 of file DatabaseUpdater.php.
Referenced by MysqlUpdater\doCategoryPopulation(), MysqlUpdater\doClFieldsUpdate(), doLogSearchPopulation(), doLogUsertextPopulation(), MysqlUpdater\doPopulateParentId(), MysqlUpdater\doUpdateMimeMinorField(), migrateActors(), migrateComments(), modifyField(), modifyTable(), populateContentTables(), populateExternallinksIndex60(), PostgresUpdater\rebuildTextSearch(), SqliteUpdater\sqliteInitialIndexes(), SqliteUpdater\sqliteSetupSearchindex(), and MssqlUpdater\updateSchema().
|
private |
Writes the schema updates desired to a file for the DB Admin to run.
array | $schemaUpdate |
Definition at line 410 of file DatabaseUpdater.php.
References $args, $updates, $updatesSkipped, and as.
Referenced by doUpdates().
|
protected |
Handle to the database subclass.
Definition at line 64 of file DatabaseUpdater.php.
Referenced by __construct(), getDB(), newForDB(), and patchPath().
|
protected |
List of extension-provided database updates.
Definition at line 57 of file DatabaseUpdater.php.
Referenced by getExtensionUpdates().
|
protected |
File handle for SQL output.
Definition at line 97 of file DatabaseUpdater.php.
|
protected |
Hold the value of $wgContentHandlerUseDB during the upgrade.
Definition at line 109 of file DatabaseUpdater.php.
Referenced by enableContentHandlerUseDB().
|
protected |
Definition at line 69 of file DatabaseUpdater.php.
Referenced by __construct(), and newForDB().
|
protected |
Scripts to run after database update Should be a subclass of LoggedUpdateMaintenance.
Definition at line 77 of file DatabaseUpdater.php.
Referenced by getPostDatabaseUpdateMaintenance().
|
protected |
Definition at line 71 of file DatabaseUpdater.php.
Referenced by __construct(), and newForDB().
|
protected |
Flag specifying whether or not to skip schema (e.g.
SQL-only) updates.
Definition at line 104 of file DatabaseUpdater.php.
|
protected |
Array of updates to perform on the database.
Definition at line 44 of file DatabaseUpdater.php.
Referenced by getOldGlobalUpdates(), PostgresUpdater\getOldGlobalUpdates(), runUpdates(), and writeSchemaUpdateFile().
|
protected |
Array of updates that were skipped.
Definition at line 51 of file DatabaseUpdater.php.
Referenced by runUpdates(), and writeSchemaUpdateFile().
const DatabaseUpdater::REPLICATION_WAIT_TIMEOUT = 300 |
Definition at line 37 of file DatabaseUpdater.php.
Referenced by MysqlUpdater\doTemplatelinksUpdate().