MediaWiki master
|
Class for handling database updates. More...
Inherited by MediaWiki\Installer\MysqlUpdater, MediaWiki\Installer\PostgresUpdater, and MediaWiki\Installer\SqliteUpdater.
Public Member Functions | |
addExtensionField ( $tableName, $columnName, $sqlPath) | |
Add a field to an existing extension table. | |
addExtensionIndex ( $tableName, $indexName, $sqlPath) | |
Add an index to an existing extension table. | |
addExtensionTable ( $tableName, $sqlPath) | |
Convenience wrapper for addExtensionUpdate() when adding a new table (which is the most common usage of updaters in an extension) Intended for use in LoadExtensionSchemaUpdates hook handlers. | |
addExtensionUpdate (array $update) | |
Add a new update coming from an extension. | |
addExtensionUpdateOnVirtualDomain (array $update) | |
Add a new update coming from an extension on virtual domain databases. | |
addPostDatabaseUpdateMaintenance ( $class) | |
Add a maintenance script to be run after the database updates are complete. | |
doUpdates (array $what=[ 'core', 'extensions', 'stats']) | |
Do all the updates. | |
dropExtensionField ( $tableName, $columnName, $sqlPath) | |
Drop a field from an extension table. | |
dropExtensionIndex ( $tableName, $indexName, $sqlPath) | |
Drop an index from an extension table Intended for use in LoadExtensionSchemaUpdates hook handlers. | |
dropExtensionTable ( $tableName, $sqlPath=false) | |
Drop an extension table. | |
fieldExists ( $tableName, $fieldName) | |
getDB () | |
Get a database connection to run updates. | |
getPostDatabaseUpdateMaintenance () | |
getSchemaVars () | |
Get appropriate schema variables in the current database connection. | |
insertInitialUpdateKeys () | |
Add initial keys to the updatelog table. | |
insertUpdateRow ( $key, $val=null) | |
Helper function: Add a key to the updatelog table. | |
modifyExtensionField ( $tableName, $fieldName, $sqlPath) | |
Modify an existing field in an extension table. | |
modifyExtensionTable ( $tableName, $sqlPath) | |
Modify an existing extension table. | |
output ( $str) | |
Output some text. | |
patchPath (IDatabase $db, $patch) | |
Get the full path of a patch file. | |
purgeCache () | |
Purge various database caches. | |
renameExtensionIndex ( $tableName, $oldIndexName, $newIndexName, $sqlPath, $skipBothIndexExistWarning=false) | |
Rename an index on an extension table Intended for use in LoadExtensionSchemaUpdates hook handlers. | |
setAutoExtensionHookContainer (HookContainer $hookContainer) | |
Set the HookContainer to use for loading extension schema updates. | |
setFileAccess () | |
Set any .htaccess files or equivalent for storage repos. | |
tableExists ( $tableName) | |
updateRowExists ( $key) | |
Helper function: check if the given key is present in the updatelog table. | |
Static Public Member Functions | |
static | newForDB (IMaintainableDatabase $db, $shared=false, ?Maintenance $maintenance=null) |
Public Attributes | |
const | REPLICATION_WAIT_TIMEOUT = 300 |
Protected Member Functions | |
__construct (IMaintainableDatabase &$db, $shared, ?Maintenance $maintenance=null) | |
addField ( $table, $field, $patch, $fullpath=false) | |
Add a new field to an existing table. | |
addIndex ( $table, $index, $patch, $fullpath=false) | |
Add a new index to an existing table. | |
addTable ( $name, $patch, $fullpath=false) | |
Add a new table to the database. | |
appendLine ( $line) | |
Append a line to the open file handle. | |
applyPatch ( $path, $isFullPath=false, $msg=null) | |
Applies a SQL patch. | |
checkStats () | |
Check the site_stats table is not properly populated. | |
copyFile ( $filename) | |
Append an SQL fragment to the open file handle. | |
doCollationUpdate () | |
Update CategoryLinks collation. | |
doConvertDjvuMetadata () | |
doTable ( $name) | |
Returns whether updates should be executed on the database table $name. | |
dropField ( $table, $field, $patch, $fullpath=false) | |
Drop a field from an existing table. | |
dropIndex ( $table, $index, $patch, $fullpath=false) | |
Drop an index from an existing table. | |
dropTable ( $table, $patch=false, $fullpath=false) | |
If the specified table exists, drop it, or execute the patch if one is provided. | |
getCoreUpdateList () | |
Get an array of updates to perform on the database. | |
getExtensionUpdates () | |
Get the list of extension-defined updates. | |
getInitialUpdateKeys () | |
Get an array of update keys to insert into the updatelog table after a new installation. | |
ifFieldExists ( $table, $field, $func,... $params) | |
Only run a function if the named field exists. | |
ifTableNotExists ( $table, $func,... $params) | |
Only run a function if a table does not exist. | |
migratePagelinks () | |
migrateTemplatelinks () | |
modifyField ( $table, $field, $patch, $fullpath=false) | |
Modify an existing field. | |
modifyTable ( $table, $patch, $fullpath=false) | |
Modify an existing table, similar to modifyField. | |
rebuildLocalisationCache () | |
Rebuilds the localisation cache. | |
renameIndex ( $table, $oldIndex, $newIndex, $skipBothIndexExistWarning, $patch, $fullpath=false) | |
Rename an index from an existing table. | |
runMaintenance ( $class, $unused='') | |
Run a maintenance script. | |
Protected Attributes | |
HookContainer null | $autoExtensionHookContainer |
IMaintainableDatabase | $db |
Handle to the database subclass. | |
array | $extensionUpdates = [] |
List of extension-provided database updates. | |
array | $extensionUpdatesWithVirtualDomains = [] |
List of extension-provided database updates on virtual domain dbs. | |
resource null | $fileHandle = null |
File handle for SQL output. | |
Maintenance | $maintenance |
string[] | $postDatabaseUpdateMaintenance |
Scripts to run after database update Should be a subclass of LoggedUpdateMaintenance. | |
bool | $shared = false |
bool | $skipSchema = false |
Flag specifying whether to skip schema (e.g., SQL-only) updates. | |
array | $updates = [] |
Array of updates to perform on the database. | |
array | $updatesSkipped = [] |
Array of updates that were skipped. | |
|
protected |
IMaintainableDatabase | &$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 133 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\$db, MediaWiki\Installer\DatabaseUpdater\$maintenance, MediaWiki\Installer\DatabaseUpdater\$shared, DBO_DDLMODE, MediaWiki\Maintenance\Maintenance\setDB(), and Wikimedia\Rdbms\Database\IDatabaseFlags\setFlag().
MediaWiki\Installer\DatabaseUpdater::addExtensionField | ( | $tableName, | |
$columnName, | |||
$sqlPath ) |
Add a field to an existing extension table.
Intended for use in LoadExtensionSchemaUpdates hook handlers.
string | $tableName | |
string | $columnName | |
string | $sqlPath |
Definition at line 348 of file DatabaseUpdater.php.
MediaWiki\Installer\DatabaseUpdater::addExtensionIndex | ( | $tableName, | |
$indexName, | |||
$sqlPath ) |
Add an index to an existing extension table.
Intended for use in LoadExtensionSchemaUpdates hook handlers.
string | $tableName | |
string | $indexName | |
string | $sqlPath |
Definition at line 334 of file DatabaseUpdater.php.
MediaWiki\Installer\DatabaseUpdater::addExtensionTable | ( | $tableName, | |
$sqlPath ) |
Convenience wrapper for addExtensionUpdate() when adding a new table (which is the most common usage of updaters in an extension) Intended for use in LoadExtensionSchemaUpdates hook handlers.
string | $tableName | Name of table to create |
string | $sqlPath | Full path to the schema file |
Definition at line 320 of file DatabaseUpdater.php.
MediaWiki\Installer\DatabaseUpdater::addExtensionUpdate | ( | array | $update | ) |
Add a new update coming from an extension.
Intended for use in LoadExtensionSchemaUpdates hook handlers.
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 (i.e., 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 293 of file DatabaseUpdater.php.
MediaWiki\Installer\DatabaseUpdater::addExtensionUpdateOnVirtualDomain | ( | array | $update | ) |
Add a new update coming from an extension on virtual domain databases.
Intended for use in LoadExtensionSchemaUpdates hook handlers.
array | $update | The update to run. The format is [ $virtualDomain, $callback, $params... ] similarly to addExtensionUpdate() |
Definition at line 306 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 859 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\applyPatch(), MediaWiki\Installer\DatabaseUpdater\doTable(), and MediaWiki\Installer\DatabaseUpdater\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 887 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\applyPatch(), MediaWiki\Installer\DatabaseUpdater\doTable(), and MediaWiki\Installer\DatabaseUpdater\output().
MediaWiki\Installer\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 477 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 834 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\applyPatch(), MediaWiki\Installer\DatabaseUpdater\doTable(), and MediaWiki\Installer\DatabaseUpdater\output().
|
protected |
Append a line to the open file handle.
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 |
Definition at line 761 of file DatabaseUpdater.php.
Referenced by MediaWiki\Installer\DatabaseUpdater\copyFile().
|
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 |
Definition at line 781 of file DatabaseUpdater.php.
References $path, MediaWiki\Installer\DatabaseUpdater\copyFile(), MediaWiki\Installer\DatabaseUpdater\output(), and MediaWiki\Installer\DatabaseUpdater\patchPath().
Referenced by MediaWiki\Installer\DatabaseUpdater\addField(), MediaWiki\Installer\DatabaseUpdater\addIndex(), MediaWiki\Installer\PostgresUpdater\addPgExtIndex(), MediaWiki\Installer\DatabaseUpdater\addTable(), MediaWiki\Installer\DatabaseUpdater\dropField(), MediaWiki\Installer\DatabaseUpdater\dropIndex(), MediaWiki\Installer\DatabaseUpdater\dropTable(), MediaWiki\Installer\DatabaseUpdater\modifyField(), MediaWiki\Installer\DatabaseUpdater\modifyTable(), MediaWiki\Installer\DatabaseUpdater\renameIndex(), and MediaWiki\Installer\PostgresUpdater\renameTable().
|
protected |
Check the site_stats table is not properly populated.
Definition at line 1209 of file DatabaseUpdater.php.
References MediaWiki\SiteStats\SiteStatsInit\doAllAndCommit(), and MediaWiki\Installer\DatabaseUpdater\output().
Referenced by MediaWiki\Installer\DatabaseUpdater\doUpdates().
|
protected |
Append an SQL fragment to the open file handle.
string | $filename | File name to open |
Definition at line 738 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\appendLine().
Referenced by MediaWiki\Installer\DatabaseUpdater\applyPatch().
|
protected |
Update CategoryLinks collation.
Definition at line 1233 of file DatabaseUpdater.php.
References $wgCategoryCollation, MediaWiki\Installer\DatabaseUpdater\insertUpdateRow(), MediaWiki\Installer\DatabaseUpdater\output(), and MediaWiki\Installer\DatabaseUpdater\updateRowExists().
Referenced by MediaWiki\Installer\DatabaseUpdater\doUpdates().
|
protected |
Definition at line 1248 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\insertUpdateRow(), MediaWiki\Installer\DatabaseUpdater\output(), and MediaWiki\Installer\DatabaseUpdater\updateRowExists().
|
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 693 of file DatabaseUpdater.php.
References $wgSharedDB, $wgSharedTables, and MediaWiki\Installer\DatabaseUpdater\output().
Referenced by MediaWiki\Installer\DatabaseUpdater\addField(), MediaWiki\Installer\DatabaseUpdater\addIndex(), MediaWiki\Installer\DatabaseUpdater\addTable(), MediaWiki\Installer\DatabaseUpdater\dropField(), MediaWiki\Installer\DatabaseUpdater\dropIndex(), MediaWiki\Installer\DatabaseUpdater\dropTable(), MediaWiki\Installer\DatabaseUpdater\modifyField(), MediaWiki\Installer\DatabaseUpdater\modifyTable(), and MediaWiki\Installer\DatabaseUpdater\renameIndex().
MediaWiki\Installer\DatabaseUpdater::doUpdates | ( | array | $what = [ 'core', 'extensions', 'stats' ] | ) |
Do all the updates.
array | $what | What updates to perform |
Definition at line 535 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\checkStats(), MediaWiki\Installer\DatabaseUpdater\doCollationUpdate(), MediaWiki\Installer\DatabaseUpdater\getCoreUpdateList(), MediaWiki\Installer\DatabaseUpdater\getExtensionUpdates(), MediaWiki\Installer\DatabaseUpdater\getSchemaVars(), MediaWiki\Installer\DatabaseUpdater\insertInitialUpdateKeys(), and MediaWiki\Installer\DatabaseUpdater\output().
MediaWiki\Installer\DatabaseUpdater::dropExtensionField | ( | $tableName, | |
$columnName, | |||
$sqlPath ) |
Drop a field from an extension table.
Intended for use in LoadExtensionSchemaUpdates hook handlers.
string | $tableName | |
string | $columnName | |
string | $sqlPath |
Definition at line 362 of file DatabaseUpdater.php.
MediaWiki\Installer\DatabaseUpdater::dropExtensionIndex | ( | $tableName, | |
$indexName, | |||
$sqlPath ) |
Drop an index from an extension table Intended for use in LoadExtensionSchemaUpdates hook handlers.
string | $tableName | |
string | $indexName | |
string | $sqlPath | The path to the SQL change path |
Definition at line 376 of file DatabaseUpdater.php.
MediaWiki\Installer\DatabaseUpdater::dropExtensionTable | ( | $tableName, | |
$sqlPath = false ) |
Drop an extension table.
Intended for use in LoadExtensionSchemaUpdates hook handlers.
string | $tableName | |
string | bool | $sqlPath |
Definition at line 389 of file DatabaseUpdater.php.
|
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 915 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\applyPatch(), MediaWiki\Installer\DatabaseUpdater\doTable(), and MediaWiki\Installer\DatabaseUpdater\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 940 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\applyPatch(), MediaWiki\Installer\DatabaseUpdater\doTable(), and MediaWiki\Installer\DatabaseUpdater\output().
|
protected |
If the specified table exists, drop it, or execute the patch if one is provided.
string | $table | Table to drop. |
string | false | $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 1024 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\applyPatch(), MediaWiki\Installer\DatabaseUpdater\doTable(), and MediaWiki\Installer\DatabaseUpdater\output().
MediaWiki\Installer\DatabaseUpdater::fieldExists | ( | $tableName, | |
$fieldName ) |
string | $tableName | |
string | $fieldName |
Definition at line 464 of file DatabaseUpdater.php.
|
abstractprotected |
Get an array of updates to perform on the database.
Should return a multidimensional array. The main key is the MediaWiki version (1.12, 1.13...) with the values being arrays of updates.
Reimplemented in MediaWiki\Installer\MysqlUpdater, MediaWiki\Installer\PostgresUpdater, and MediaWiki\Installer\SqliteUpdater.
Referenced by MediaWiki\Installer\DatabaseUpdater\doUpdates().
MediaWiki\Installer\DatabaseUpdater::getDB | ( | ) |
Get a database connection to run updates.
Definition at line 260 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\$db.
|
protected |
Get the list of extension-defined updates.
Definition at line 486 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\$extensionUpdates.
Referenced by MediaWiki\Installer\DatabaseUpdater\doUpdates().
|
abstractprotected |
Get an array of update keys to insert into the updatelog table after a new installation.
The named operations will then be skipped by a subsequent update.
Add keys here to skip updates that are redundant or harmful on a new installation, for example reducing field sizes, adding constraints, etc.
Reimplemented in MediaWiki\Installer\MysqlUpdater, MediaWiki\Installer\PostgresUpdater, and MediaWiki\Installer\SqliteUpdater.
Referenced by MediaWiki\Installer\DatabaseUpdater\insertInitialUpdateKeys().
MediaWiki\Installer\DatabaseUpdater::getPostDatabaseUpdateMaintenance | ( | ) |
Definition at line 495 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\$postDatabaseUpdateMaintenance.
MediaWiki\Installer\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 MediaWiki\Installer\MysqlUpdater.
Definition at line 526 of file DatabaseUpdater.php.
Referenced by MediaWiki\Installer\DatabaseUpdater\doUpdates().
|
protected |
Only run a function if the named field exists.
string | $table | Table to check. If passed $this, it's assumed to be a call from runUpdates() with $passSelf = true: all other parameters are shifted and $this is prepended to the rest of $params. |
string | $field | Field to check |
string | array | static | $func | Normally this is the string naming the method on $this to call. It may also be an array style callable. |
mixed | ...$params Parameters for $func |
Definition at line 1378 of file DatabaseUpdater.php.
References $params.
|
protected |
Only run a function if a table does not exist.
string | $table | Table to check. If passed $this, it's assumed to be a call from runUpdates() with $passSelf = true: all other parameters are shifted and $this is prepended to the rest of $params. |
string | array | static | $func | Normally this is the string naming the method on $this to call. It may also be an array style callable. |
mixed | ...$params Parameters for $func |
Definition at line 1341 of file DatabaseUpdater.php.
References $params.
MediaWiki\Installer\DatabaseUpdater::insertInitialUpdateKeys | ( | ) |
Add initial keys to the updatelog table.
Should be called during installation.
Definition at line 672 of file DatabaseUpdater.php.
References DBO_DDLMODE, and MediaWiki\Installer\DatabaseUpdater\getInitialUpdateKeys().
Referenced by MediaWiki\Installer\DatabaseUpdater\doUpdates().
MediaWiki\Installer\DatabaseUpdater::insertUpdateRow | ( | $key, | |
$val = null ) |
Helper function: Add a key to the updatelog table.
string | $key | Name of the key to insert |
string | null | $val | [optional] Value to insert along with the key |
Definition at line 649 of file DatabaseUpdater.php.
References DBO_DDLMODE.
Referenced by MediaWiki\Installer\MysqlUpdater\changeTableOption(), MediaWiki\Installer\DatabaseUpdater\doCollationUpdate(), MediaWiki\Installer\DatabaseUpdater\doConvertDjvuMetadata(), MediaWiki\Installer\MysqlUpdater\dropDefault(), MediaWiki\Installer\DatabaseUpdater\modifyField(), and MediaWiki\Installer\DatabaseUpdater\modifyTable().
|
protected |
Definition at line 1307 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\output(), and MediaWiki\Installer\DatabaseUpdater\updateRowExists().
|
protected |
Definition at line 1286 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\output(), and MediaWiki\Installer\DatabaseUpdater\updateRowExists().
MediaWiki\Installer\DatabaseUpdater::modifyExtensionField | ( | $tableName, | |
$fieldName, | |||
$sqlPath ) |
Modify an existing field in an extension table.
Intended for use in LoadExtensionSchemaUpdates hook handlers.
string | $tableName | |
string | $fieldName | The field to be modified |
string | $sqlPath | The path to the SQL patch |
Definition at line 430 of file DatabaseUpdater.php.
MediaWiki\Installer\DatabaseUpdater::modifyExtensionTable | ( | $tableName, | |
$sqlPath ) |
Modify an existing extension table.
Intended for use in LoadExtensionSchemaUpdates hook handlers.
string | $tableName | |
string | $sqlPath | The path to the SQL patch |
Definition at line 443 of file DatabaseUpdater.php.
|
protected |
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 1060 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\applyPatch(), MediaWiki\Installer\DatabaseUpdater\doTable(), MediaWiki\Installer\DatabaseUpdater\insertUpdateRow(), MediaWiki\Installer\DatabaseUpdater\output(), and MediaWiki\Installer\DatabaseUpdater\updateRowExists().
|
protected |
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 1097 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\applyPatch(), MediaWiki\Installer\DatabaseUpdater\doTable(), MediaWiki\Installer\DatabaseUpdater\insertUpdateRow(), MediaWiki\Installer\DatabaseUpdater\output(), and MediaWiki\Installer\DatabaseUpdater\updateRowExists().
|
static |
IMaintainableDatabase | $db | |
bool | $shared | |
Maintenance | null | $maintenance |
Definition at line 229 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\$db, MediaWiki\Installer\DatabaseUpdater\$maintenance, MediaWiki\Installer\DatabaseUpdater\$shared, MediaWiki\Installer\Installer\getDBTypes(), and Wikimedia\Rdbms\IReadableDatabase\getType().
Referenced by MediaWiki\Installer\WebInstaller\doUpgrade().
MediaWiki\Installer\DatabaseUpdater::output | ( | $str | ) |
Output some text.
If we're running via the web, escape the text first.
string | $str | Text to output |
Definition at line 270 of file DatabaseUpdater.php.
References MW_ENTRY_POINT.
Referenced by MediaWiki\Installer\DatabaseUpdater\addField(), MediaWiki\Installer\DatabaseUpdater\addIndex(), MediaWiki\Installer\PostgresUpdater\addPgExtIndex(), MediaWiki\Installer\PostgresUpdater\addPgField(), MediaWiki\Installer\PostgresUpdater\addPgIndex(), MediaWiki\Installer\PostgresUpdater\addSequence(), MediaWiki\Installer\DatabaseUpdater\addTable(), MediaWiki\Installer\DatabaseUpdater\applyPatch(), MediaWiki\Installer\PostgresUpdater\changeField(), MediaWiki\Installer\PostgresUpdater\changeFieldPurgeTable(), MediaWiki\Installer\PostgresUpdater\changeFkeyDeferrable(), MediaWiki\Installer\PostgresUpdater\changeNullableField(), MediaWiki\Installer\PostgresUpdater\changePrimaryKey(), MediaWiki\Installer\MysqlUpdater\changeTableOption(), MediaWiki\Installer\PostgresUpdater\checkIndex(), MediaWiki\Installer\DatabaseUpdater\checkStats(), MediaWiki\Installer\DatabaseUpdater\doCollationUpdate(), MediaWiki\Installer\DatabaseUpdater\doConvertDjvuMetadata(), MediaWiki\Installer\DatabaseUpdater\doTable(), MediaWiki\Installer\DatabaseUpdater\doUpdates(), MediaWiki\Installer\MysqlUpdater\dropDefault(), MediaWiki\Installer\PostgresUpdater\dropDefault(), MediaWiki\Installer\DatabaseUpdater\dropField(), MediaWiki\Installer\PostgresUpdater\dropFkey(), MediaWiki\Installer\DatabaseUpdater\dropIndex(), MediaWiki\Installer\PostgresUpdater\dropPgField(), MediaWiki\Installer\PostgresUpdater\dropPgIndex(), MediaWiki\Installer\PostgresUpdater\dropSequence(), MediaWiki\Installer\DatabaseUpdater\dropTable(), MediaWiki\Installer\DatabaseUpdater\migratePagelinks(), MediaWiki\Installer\DatabaseUpdater\migrateTemplatelinks(), MediaWiki\Installer\DatabaseUpdater\modifyField(), MediaWiki\Installer\DatabaseUpdater\modifyTable(), MediaWiki\Installer\DatabaseUpdater\purgeCache(), MediaWiki\Installer\DatabaseUpdater\rebuildLocalisationCache(), MediaWiki\Installer\PostgresUpdater\renameIndex(), MediaWiki\Installer\DatabaseUpdater\renameIndex(), MediaWiki\Installer\PostgresUpdater\renameSequence(), MediaWiki\Installer\PostgresUpdater\renameTable(), MediaWiki\Installer\DatabaseUpdater\runMaintenance(), MediaWiki\Installer\MysqlUpdater\setDefault(), MediaWiki\Installer\PostgresUpdater\setDefault(), MediaWiki\Installer\DatabaseUpdater\setFileAccess(), and MediaWiki\Installer\PostgresUpdater\setSequenceOwner().
MediaWiki\Installer\DatabaseUpdater::patchPath | ( | IDatabase | $db, |
$patch ) |
Get the full path of a patch file.
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 812 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\$db, MediaWiki\MainConfigNames\BaseDirectory, MediaWiki\MediaWikiServices\getInstance(), and Wikimedia\Rdbms\IReadableDatabase\getType().
Referenced by MediaWiki\Installer\DatabaseUpdater\applyPatch().
MediaWiki\Installer\DatabaseUpdater::purgeCache | ( | ) |
Purge various database caches.
Definition at line 1173 of file DatabaseUpdater.php.
References $wgLocalisationCacheConf, MediaWiki\ResourceLoader\MessageBlobStore\clearGlobalCacheEntry(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Installer\DatabaseUpdater\output(), and MediaWiki\Installer\DatabaseUpdater\rebuildLocalisationCache().
|
protected |
Rebuilds the localisation cache.
Definition at line 1272 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\output().
Referenced by MediaWiki\Installer\DatabaseUpdater\purgeCache().
MediaWiki\Installer\DatabaseUpdater::renameExtensionIndex | ( | $tableName, | |
$oldIndexName, | |||
$newIndexName, | |||
$sqlPath, | |||
$skipBothIndexExistWarning = false ) |
Rename an index on an extension table Intended for use in LoadExtensionSchemaUpdates hook handlers.
string | $tableName | |
string | $oldIndexName | |
string | $newIndexName | |
string | $sqlPath | The path to the SQL change file |
bool | $skipBothIndexExistWarning | Whether to warn if both the old and the new indexes exist. [facultative; by default, false] |
Definition at line 406 of file DatabaseUpdater.php.
|
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 new indexes exist. |
string | $patch | Path to the patch file |
bool | $fullpath | Whether to treat $patch path as a relative or not |
Reimplemented in MediaWiki\Installer\PostgresUpdater.
Definition at line 967 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\applyPatch(), MediaWiki\Installer\DatabaseUpdater\doTable(), and MediaWiki\Installer\DatabaseUpdater\output().
|
protected |
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 | $unused | Unused, kept for compatibility |
Definition at line 1137 of file DatabaseUpdater.php.
References MediaWiki\Installer\DatabaseUpdater\output().
MediaWiki\Installer\DatabaseUpdater::setAutoExtensionHookContainer | ( | HookContainer | $hookContainer | ) |
Set the HookContainer to use for loading extension schema updates.
HookContainer | $hookContainer |
Definition at line 251 of file DatabaseUpdater.php.
MediaWiki\Installer\DatabaseUpdater::setFileAccess | ( | ) |
Set any .htaccess files or equivalent for storage repos.
Some zones (e.g. "temp") used to be public and may have been initialized as such
Definition at line 1152 of file DatabaseUpdater.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\Installer\DatabaseUpdater\output().
MediaWiki\Installer\DatabaseUpdater::tableExists | ( | $tableName | ) |
string | $tableName |
Definition at line 453 of file DatabaseUpdater.php.
MediaWiki\Installer\DatabaseUpdater::updateRowExists | ( | $key | ) |
Helper function: check if the given key is present in the updatelog table.
string | $key | Name of the key to check for |
Definition at line 623 of file DatabaseUpdater.php.
Referenced by MediaWiki\Installer\MysqlUpdater\changeTableOption(), MediaWiki\Installer\DatabaseUpdater\doCollationUpdate(), MediaWiki\Installer\DatabaseUpdater\doConvertDjvuMetadata(), MediaWiki\Installer\MysqlUpdater\dropDefault(), MediaWiki\Installer\DatabaseUpdater\migratePagelinks(), MediaWiki\Installer\DatabaseUpdater\migrateTemplatelinks(), MediaWiki\Installer\DatabaseUpdater\modifyField(), and MediaWiki\Installer\DatabaseUpdater\modifyTable().
|
protected |
Definition at line 103 of file DatabaseUpdater.php.
|
protected |
Handle to the database subclass.
Definition at line 92 of file DatabaseUpdater.php.
Referenced by MediaWiki\Installer\DatabaseUpdater\__construct(), MediaWiki\Installer\DatabaseUpdater\getDB(), MediaWiki\Installer\DatabaseUpdater\newForDB(), and MediaWiki\Installer\DatabaseUpdater\patchPath().
|
protected |
List of extension-provided database updates.
Definition at line 79 of file DatabaseUpdater.php.
Referenced by MediaWiki\Installer\DatabaseUpdater\getExtensionUpdates().
|
protected |
List of extension-provided database updates on virtual domain dbs.
Definition at line 85 of file DatabaseUpdater.php.
|
protected |
File handle for SQL output.
Definition at line 119 of file DatabaseUpdater.php.
|
protected |
Definition at line 97 of file DatabaseUpdater.php.
Referenced by MediaWiki\Installer\DatabaseUpdater\__construct(), and MediaWiki\Installer\DatabaseUpdater\newForDB().
|
protected |
Scripts to run after database update Should be a subclass of LoggedUpdateMaintenance.
Definition at line 109 of file DatabaseUpdater.php.
Referenced by MediaWiki\Installer\DatabaseUpdater\getPostDatabaseUpdateMaintenance().
|
protected |
Definition at line 100 of file DatabaseUpdater.php.
Referenced by MediaWiki\Installer\DatabaseUpdater\__construct(), and MediaWiki\Installer\DatabaseUpdater\newForDB().
|
protected |
Flag specifying whether to skip schema (e.g., SQL-only) updates.
Definition at line 126 of file DatabaseUpdater.php.
|
protected |
Array of updates to perform on the database.
Definition at line 66 of file DatabaseUpdater.php.
|
protected |
Array of updates that were skipped.
Definition at line 73 of file DatabaseUpdater.php.
const MediaWiki\Installer\DatabaseUpdater::REPLICATION_WAIT_TIMEOUT = 300 |
Definition at line 59 of file DatabaseUpdater.php.