MediaWiki  1.27.4
DatabaseUpdater Class Reference

Class for handling database updates. More...

Inheritance diagram for DatabaseUpdater:
Collaboration diagram for DatabaseUpdater:

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 ($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 ()
 
 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)
 
 modifyField ($table, $field, $patch, $fullpath=false)
 Modify an existing field. More...
 
 output ($str)
 Output some text. More...
 
 purgeCache ()
 Purge the objectcache table. More...
 
 renameExtensionIndex ($tableName, $oldIndexName, $newIndexName, $sqlPath, $skipBothIndexExistWarning=false)
 Rename an index on an extension table. 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 (&$db, $shared=false, $maintenance=null)
 

Protected Member Functions

 __construct (DatabaseBase &$db, $shared, Maintenance $maintenance=null)
 Constructor. More...
 
 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...
 
 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...
 
 doUpdateTranscacheField ()
 Updates the timestamps in the transcache table. 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...
 
 rebuildLocalisationCache ()
 Rebuilds the localisation cache. More...
 
 renameIndex ($table, $oldIndex, $newIndex, $skipBothIndexExistWarning, $patch, $fullpath=false)
 Rename an index from an existing table. More...
 
 setAppliedUpdates ($version, $updates=[])
 

Protected Attributes

DatabaseBase $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...
 
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...
 

Static Protected Attributes

static $updateCounter = 0
 

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 ($schemaUpdate=[])
 

Detailed Description

Class for handling database updates.

Roughly based off of updaters.inc, with a few improvements :)

Since
1.17

Definition at line 33 of file DatabaseUpdater.php.

Constructor & Destructor Documentation

DatabaseUpdater::__construct ( DatabaseBase $db,
  $shared,
Maintenance  $maintenance = null 
)
protected

Constructor.

Parameters
DatabaseBase$dbTo perform updates on
bool$sharedWhether to perform updates on shared tables
Maintenance$maintenanceMaintenance object which created us

Definition at line 106 of file DatabaseUpdater.php.

References $db, $maintenance, $shared, DBO_DDLMODE, initOldGlobals(), loadExtensions(), Hooks\run(), Maintenance\setDB(), and DatabaseBase\setFlag().

Member Function Documentation

DatabaseUpdater::addExtensionField (   $tableName,
  $columnName,
  $sqlPath 
)
Since
1.19
Parameters
string$tableName
string$columnName
string$sqlPath

Definition at line 265 of file DatabaseUpdater.php.

References true.

DatabaseUpdater::addExtensionIndex (   $tableName,
  $indexName,
  $sqlPath 
)
Since
1.19
Parameters
string$tableName
string$indexName
string$sqlPath

Definition at line 253 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)

Since
1.18
Parameters
string$tableNameName of table to create
string$sqlPathFull path to the schema file

Definition at line 242 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.

Since
1.17
Parameters
array$updateThe update to run. Format is the following: first item is the callback function, it also can be a simple string with the name of a function in this class, following elements are parameters to the function. Note that callback functions will receive this object as first parameter.

Definition at line 229 of file DatabaseUpdater.php.

DatabaseUpdater::addField (   $table,
  $field,
  $patch,
  $fullpath = false 
)
protected

Add a new field to an existing table.

Parameters
string$tableName of the table to modify
string$fieldName of the new field
string$patchPath to the patch file
bool$fullpathWhether to treat $patch path as a relative or not
Returns
bool False if this was skipped because schema changes are skipped

Definition at line 707 of file DatabaseUpdater.php.

References applyPatch(), doTable(), and output().

DatabaseUpdater::addIndex (   $table,
  $index,
  $patch,
  $fullpath = false 
)
protected

Add a new index to an existing table.

Parameters
string$tableName of the table to modify
string$indexName of the new index
string$patchPath to the patch file
bool$fullpathWhether to treat $patch path as a relative or not
Returns
bool False if this was skipped because schema changes are skipped

Definition at line 732 of file DatabaseUpdater.php.

References applyPatch(), doTable(), and output().

DatabaseUpdater::addPostDatabaseUpdateMaintenance (   $class)

Add a maintenance script to be run after the database updates are complete.

Script should subclass LoggedUpdateMaintenance

Since
1.19
Parameters
string$className of a Maintenance subclass

Definition at line 362 of file DatabaseUpdater.php.

DatabaseUpdater::addTable (   $name,
  $patch,
  $fullpath = false 
)
protected

Add a new table to the database.

Parameters
string$nameName of the new table
string$patchPath to the patch file
bool$fullpathWhether to treat $patch path as a relative or not
Returns
bool False if this was skipped because schema changes are skipped

Definition at line 684 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().

Parameters
string$lineText to append to the file
Returns
bool False to skip actually executing the file
Exceptions
MWException

Definition at line 634 of file DatabaseUpdater.php.

References $line.

DatabaseUpdater::applyPatch (   $path,
  $isFullPath = false,
  $msg = null 
)
protected

Applies a SQL patch.

Parameters
string$pathPath to the patch file
bool$isFullPathWhether to treat $path as a relative or not
string$msgDescription of the patch
Returns
bool False if patch is skipped.

Definition at line 651 of file DatabaseUpdater.php.

References $path, copyFile(), and output().

Referenced by addField(), addIndex(), PostgresUpdater\addInterwikiType(), PostgresUpdater\addPgExtIndex(), addTable(), MysqlUpdater\checkBin(), PostgresUpdater\checkIwlPrefix(), PostgresUpdater\checkPageDeletedTrigger(), PostgresUpdater\checkRevUserFkey(), PostgresUpdater\convertArchive2(), MysqlUpdater\doBacklinkingIndicesUpdate(), MysqlUpdater\doCategorylinksIndicesUpdate(), MysqlUpdater\doClFieldsUpdate(), doEnableProfiling(), MysqlUpdater\doFilearchiveIndicesUpdate(), MysqlUpdater\doFixAncientImagelinks(), OracleUpdater\doFKRenameDeferr(), OracleUpdater\doFunctions17(), MysqlUpdater\doIndexUpdate(), MysqlUpdater\doInterwikiUpdate(), MysqlUpdater\doIwlinksIndexNonUnique(), MysqlUpdater\doLangLinksLengthUpdate(), MysqlUpdater\doMaybeProfilingMemoryUpdate(), OracleUpdater\doNamespaceDefaults(), MysqlUpdater\doPagelinksUpdate(), OracleUpdater\doPageRestrictionsPKUKFix(), OracleUpdater\doRebuildDuplicateFunction(), OracleUpdater\doRecentchangesFK2Cascade(), OracleUpdater\doRemoveNotNullEmptyDefaults(), OracleUpdater\doRemoveNotNullEmptyDefaults2(), MysqlUpdater\doRestrictionsUpdate(), OracleUpdater\doSchemaUpgrade17(), MysqlUpdater\doTemplatelinksUpdate(), MysqlUpdater\doUniquePlTlIl(), MysqlUpdater\doUpdateMimeMinorField(), doUpdateTranscacheField(), MysqlUpdater\doUserGroupsUpdate(), MysqlUpdater\doUserNewTalkTimestampNotNull(), MysqlUpdater\doUserNewTalkUseridUnsigned(), MysqlUpdater\doUserUniqueUpdate(), MysqlUpdater\doWatchlistNull(), dropField(), dropIndex(), dropTable(), modifyField(), PostgresUpdater\rebuildTextSearch(), renameIndex(), PostgresUpdater\renameTable(), SqliteUpdater\sqliteInitialIndexes(), SqliteUpdater\sqliteSetupSearchindex(), and PostgresUpdater\tsearchFixes().

DatabaseUpdater::canUseNewUpdatelog ( )
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

Returns
bool

Definition at line 529 of file DatabaseUpdater.php.

Referenced by insertUpdateRow(), and setAppliedUpdates().

DatabaseUpdater::checkStats ( )
protected

Check the site_stats table is not properly populated.

Definition at line 957 of file DatabaseUpdater.php.

References SiteStatsInit\doAllAndCommit(), and output().

Referenced by doUpdates().

DatabaseUpdater::copyFile (   $filename)

Append an SQL fragment to the open file handle.

Parameters
string$filenameFile name to open

Definition at line 618 of file DatabaseUpdater.php.

Referenced by applyPatch().

DatabaseUpdater::disableContentHandlerUseDB ( )
protected

Turns off content handler fields during parts of the upgrade where they aren't available.

Definition at line 1119 of file DatabaseUpdater.php.

References global, and output().

DatabaseUpdater::doActiveUsersInit ( )
protected

Sets the number of active users in the site_stats table.

Definition at line 977 of file DatabaseUpdater.php.

References output().

DatabaseUpdater::doCollationUpdate ( )
protected

Update CategoryLinks collation.

Definition at line 1043 of file DatabaseUpdater.php.

References global, and output().

DatabaseUpdater::doEnableProfiling ( )
protected

Enable profiling table when it's turned on.

Definition at line 1079 of file DatabaseUpdater.php.

References $out, $wgProfiler, applyPatch(), doTable(), and global.

DatabaseUpdater::doLogSearchPopulation ( )
protected

Migrate log params to new table and index for searching.

Definition at line 1012 of file DatabaseUpdater.php.

References output(), and updateRowExists().

DatabaseUpdater::doLogUsertextPopulation ( )
protected

Populates the log_user_text field in the logging table.

Definition at line 995 of file DatabaseUpdater.php.

References output(), and updateRowExists().

DatabaseUpdater::doMigrateUserOptions ( )
protected

Migrates user options from the user table blob to user_properties.

Definition at line 1068 of file DatabaseUpdater.php.

References output().

DatabaseUpdater::doTable (   $name)
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.

Parameters
string$nameTable name
Returns
bool

Definition at line 542 of file DatabaseUpdater.php.

References $name, $wgSharedDB, $wgSharedTables, global, and output().

Referenced by addField(), addIndex(), addTable(), MysqlUpdater\checkBin(), doEnableProfiling(), MysqlUpdater\doInterwikiUpdate(), MysqlUpdater\doMaybeProfilingMemoryUpdate(), MysqlUpdater\doUserGroupsUpdate(), MysqlUpdater\doUserNewTalkTimestampNotNull(), MysqlUpdater\doUserNewTalkUseridUnsigned(), MysqlUpdater\doUserUniqueUpdate(), dropField(), dropIndex(), dropTable(), MysqlUpdater\indexHasField(), modifyField(), and renameIndex().

DatabaseUpdater::doUpdates (   $what = [ 'core',
'extensions ,
'stats']   
)

Do all the updates.

Parameters
array$whatWhat updates to perform

Definition at line 409 of file DatabaseUpdater.php.

References $wgVersion, checkStats(), getCoreUpdateList(), getExtensionUpdates(), getOldGlobalUpdates(), global, runUpdates(), setAppliedUpdates(), updates(), and writeSchemaUpdateFile().

DatabaseUpdater::doUpdateTranscacheField ( )
protected

Updates the timestamps in the transcache table.

Returns
bool

Definition at line 1029 of file DatabaseUpdater.php.

References applyPatch(), output(), and updateRowExists().

DatabaseUpdater::dropExtensionField (   $tableName,
  $columnName,
  $sqlPath 
)
Since
1.20
Parameters
string$tableName
string$columnName
string$sqlPath

Definition at line 277 of file DatabaseUpdater.php.

References true.

DatabaseUpdater::dropExtensionIndex (   $tableName,
  $indexName,
  $sqlPath 
)

Drop an index from an extension table.

Since
1.21
Parameters
string$tableNameThe table name
string$indexNameThe index name
string$sqlPathThe path to the SQL change path

Definition at line 290 of file DatabaseUpdater.php.

References true.

DatabaseUpdater::dropExtensionTable (   $tableName,
  $sqlPath 
)
Since
1.20
Parameters
string$tableName
string$sqlPath

Definition at line 301 of file DatabaseUpdater.php.

References true.

DatabaseUpdater::dropField (   $table,
  $field,
  $patch,
  $fullpath = false 
)
protected

Drop a field from an existing table.

Parameters
string$tableName of the table to modify
string$fieldName of the old field
string$patchPath to the patch file
bool$fullpathWhether to treat $patch path as a relative or not
Returns
bool False if this was skipped because schema changes are skipped

Definition at line 757 of file DatabaseUpdater.php.

References applyPatch(), doTable(), and output().

DatabaseUpdater::dropIndex (   $table,
  $index,
  $patch,
  $fullpath = false 
)
protected

Drop an index from an existing table.

Parameters
string$tableName of the table to modify
string$indexName of the index
string$patchPath to the patch file
bool$fullpathWhether to treat $patch path as a relative or not
Returns
bool False if this was skipped because schema changes are skipped

Definition at line 780 of file DatabaseUpdater.php.

References applyPatch(), doTable(), and output().

DatabaseUpdater::dropTable (   $table,
  $patch = false,
  $fullpath = false 
)

If the specified table exists, drop it, or execute the patch if one is provided.

Public

Since
1.20
Parameters
string$tableTable to drop.
string | bool$patchString of patch file that will drop the table. Default: false.
bool$fullpathWhether $patch is a full path. Default: false.
Returns
bool False if this was skipped because schema changes are skipped

Definition at line 860 of file DatabaseUpdater.php.

References applyPatch(), doTable(), and output().

DatabaseUpdater::enableContentHandlerUseDB ( )
protected

Turns content handler fields back on.

Definition at line 1132 of file DatabaseUpdater.php.

References $holdContentHandlerUseDB, global, and output().

DatabaseUpdater::getCoreUpdateList ( )
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)

Returns
array

Referenced by doUpdates().

DatabaseUpdater::getDB ( )

Get a database connection to run updates.

Returns
DatabaseBase

Definition at line 195 of file DatabaseUpdater.php.

References $db.

DatabaseUpdater::getExtensionUpdates ( )
protected

Get the list of extension-defined updates.

Returns
array

Definition at line 371 of file DatabaseUpdater.php.

References $extensionUpdates.

Referenced by doUpdates().

DatabaseUpdater::getOldGlobalUpdates ( )
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.

Returns
array

Definition at line 567 of file DatabaseUpdater.php.

References $updates, as, global, and true.

Referenced by doUpdates().

DatabaseUpdater::getPostDatabaseUpdateMaintenance ( )
Since
1.17
Returns
string[]

Definition at line 380 of file DatabaseUpdater.php.

References $postDatabaseUpdateMaintenance.

DatabaseUpdater::initOldGlobals ( )
private

Initialize all of the old globals.

One day this should all become something much nicer

Definition at line 126 of file DatabaseUpdater.php.

References global.

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!

Parameters
string$keyName of key to insert
string$val[optional] Value to insert along with the key

Definition at line 511 of file DatabaseUpdater.php.

References $key, canUseNewUpdatelog(), and DBO_DDLMODE.

Referenced by modifyField(), and MssqlUpdater\updateSchema().

DatabaseUpdater::loadExtensions ( )
private

Loads LocalSettings.php, if needed, and initialises everything needed for LoadExtensionSchemaUpdates hook.

Definition at line 144 of file DatabaseUpdater.php.

References $queue, $vars, $wgAutoloadClasses, $wgHooks, Installer\getExistingLocalSettings(), ExtensionRegistry\getInstance(), and global.

Referenced by __construct().

DatabaseUpdater::modifyExtensionField (   $tableName,
  $fieldName,
  $sqlPath 
)
Since
1.21
Parameters
string$tableNameThe table name
string$fieldNameThe field to be modified
string$sqlPathThe path to the SQL change path

Definition at line 338 of file DatabaseUpdater.php.

References true.

DatabaseUpdater::modifyField (   $table,
  $field,
  $patch,
  $fullpath = false 
)

Modify an existing field.

Parameters
string$tableName of the table to which the field belongs
string$fieldName of the field to modify
string$patchPath to the patch file
bool$fullpathWhether to treat $patch path as a relative or not
Returns
bool False if this was skipped because schema changes are skipped

Definition at line 891 of file DatabaseUpdater.php.

References applyPatch(), doTable(), insertUpdateRow(), output(), and updateRowExists().

static DatabaseUpdater::newForDB ( $db,
  $shared = false,
  $maintenance = null 
)
static
DatabaseUpdater::output (   $str)

Output some text.

If we're running from web, escape the text first.

Parameters
string$strText to output

Definition at line 204 of file DatabaseUpdater.php.

References $wgCommandLineMode, and global.

Referenced by addField(), addIndex(), 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(), MysqlUpdater\doCategoryPopulation(), MysqlUpdater\doClFieldsUpdate(), doCollationUpdate(), MysqlUpdater\doFixAncientImagelinks(), MysqlUpdater\doIndexUpdate(), OracleUpdater\doInsertPage0(), MysqlUpdater\doInterwikiUpdate(), MysqlUpdater\doIwlinksIndexNonUnique(), MysqlUpdater\doLangLinksLengthUpdate(), doLogSearchPopulation(), doLogUsertextPopulation(), MysqlUpdater\doMaybeProfilingMemoryUpdate(), doMigrateUserOptions(), MysqlUpdater\doNamespaceSize(), MysqlUpdater\doPagelinksUpdate(), MysqlUpdater\doPageRandomUpdate(), OracleUpdater\doPageRestrictionsPKUKFix(), MysqlUpdater\doPopulateParentId(), MysqlUpdater\doRestrictionsUpdate(), MysqlUpdater\doSchemaRestructuring(), doTable(), MysqlUpdater\doTemplatelinksUpdate(), MysqlUpdater\doUniquePlTlIl(), MysqlUpdater\doUpdateMimeMinorField(), doUpdateTranscacheField(), MysqlUpdater\doUserGroupsUpdate(), MysqlUpdater\doUserNewTalkTimestampNotNull(), MysqlUpdater\doUserNewTalkUseridUnsigned(), MysqlUpdater\doUserUniqueUpdate(), MysqlUpdater\doWatchlistNull(), MysqlUpdater\doWatchlistUpdate(), dropField(), PostgresUpdater\dropFkey(), dropIndex(), PostgresUpdater\dropIndex(), dropTable(), enableContentHandlerUseDB(), MysqlUpdater\indexHasField(), modifyField(), OracleUpdater\purgeCache(), purgeCache(), rebuildLocalisationCache(), PostgresUpdater\rebuildTextSearch(), PostgresUpdater\renameIndex(), renameIndex(), PostgresUpdater\renameSequence(), PostgresUpdater\renameTable(), PostgresUpdater\setDefault(), setFileAccess(), SqliteUpdater\sqliteInitialIndexes(), SqliteUpdater\sqliteSetupSearchindex(), and MssqlUpdater\updateSchema().

DatabaseUpdater::purgeCache ( )

Purge the objectcache table.

Definition at line 939 of file DatabaseUpdater.php.

References $wgLocalisationCacheConf, global, output(), and rebuildLocalisationCache().

DatabaseUpdater::rebuildLocalisationCache ( )
protected

Rebuilds the localisation cache.

Definition at line 1104 of file DatabaseUpdater.php.

References output().

Referenced by purgeCache().

DatabaseUpdater::renameExtensionIndex (   $tableName,
  $oldIndexName,
  $newIndexName,
  $sqlPath,
  $skipBothIndexExistWarning = false 
)

Rename an index on an extension table.

Since
1.21
Parameters
string$tableNameThe table name
string$oldIndexNameThe old index name
string$newIndexNameThe new index name
string$sqlPathThe path to the SQL change path
bool$skipBothIndexExistWarningWhether to warn if both the old and the new indexes exist. [facultative; by default, false]

Definition at line 317 of file DatabaseUpdater.php.

References true.

DatabaseUpdater::renameIndex (   $table,
  $oldIndex,
  $newIndex,
  $skipBothIndexExistWarning,
  $patch,
  $fullpath = false 
)
protected

Rename an index from an existing table.

Parameters
string$tableName of the table to modify
string$oldIndexOld name of the index
string$newIndexNew name of the index
bool$skipBothIndexExistWarningWhether to warn if both the old and the new indexes exist.
string$patchPath to the patch file
bool$fullpathWhether to treat $patch path as a relative or not
Returns
bool False if this was skipped because schema changes are skipped

Definition at line 806 of file DatabaseUpdater.php.

References applyPatch(), doTable(), and output().

DatabaseUpdater::runUpdates ( array  $updates,
  $passSelf 
)
private

Helper function for doUpdates()

Parameters
array$updatesArray of updates to run
bool$passSelfWhether to pass this object we calling external functions

Definition at line 444 of file DatabaseUpdater.php.

References $params, $ret, as, updates(), and wfGetLBFactory().

Referenced by doUpdates().

DatabaseUpdater::setAppliedUpdates (   $version,
  $updates = [] 
)
protected
Parameters
string$version
array$updates

Definition at line 472 of file DatabaseUpdater.php.

References $key, canUseNewUpdatelog(), DBO_DDLMODE, and serialize().

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 918 of file DatabaseUpdater.php.

References $status, output(), and RepoGroup\singleton().

DatabaseUpdater::tableExists (   $tableName)
Since
1.20
Parameters
string$tableName
Returns
bool

Definition at line 349 of file DatabaseUpdater.php.

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!

Parameters
string$keyName of the key to check for
Returns
bool

Definition at line 492 of file DatabaseUpdater.php.

References $key.

Referenced by MysqlUpdater\doCategoryPopulation(), MysqlUpdater\doClFieldsUpdate(), doLogSearchPopulation(), doLogUsertextPopulation(), MysqlUpdater\doPopulateParentId(), MysqlUpdater\doUpdateMimeMinorField(), doUpdateTranscacheField(), modifyField(), PostgresUpdater\rebuildTextSearch(), SqliteUpdater\sqliteInitialIndexes(), SqliteUpdater\sqliteSetupSearchindex(), and MssqlUpdater\updateSchema().

DatabaseUpdater::writeSchemaUpdateFile (   $schemaUpdate = [])
private
Since
1.21

Writes the schema updates desired to a file for the DB Admin to run.

Parameters
array$schemaUpdate

Definition at line 390 of file DatabaseUpdater.php.

References $updatesSkipped, and as.

Referenced by doUpdates().

Member Data Documentation

DatabaseBase DatabaseUpdater::$db
protected

Handle to the database subclass.

Definition at line 61 of file DatabaseUpdater.php.

Referenced by __construct(), FakeDatabaseUpdater\__construct(), and getDB().

array DatabaseUpdater::$extensionUpdates = []
protected

List of extension-provided database updates.

Definition at line 54 of file DatabaseUpdater.php.

Referenced by getExtensionUpdates().

resource DatabaseUpdater::$fileHandle = null
protected

File handle for SQL output.

Definition at line 85 of file DatabaseUpdater.php.

DatabaseUpdater::$holdContentHandlerUseDB = true
protected

Hold the value of $wgContentHandlerUseDB during the upgrade.

Definition at line 97 of file DatabaseUpdater.php.

Referenced by enableContentHandlerUseDB().

DatabaseUpdater::$shared = false
protected

Definition at line 63 of file DatabaseUpdater.php.

Referenced by __construct(), and newForDB().

bool DatabaseUpdater::$skipSchema = false
protected

Flag specifying whether or not to skip schema (e.g.

SQL-only) updates.

Definition at line 92 of file DatabaseUpdater.php.

DatabaseUpdater::$updateCounter = 0
staticprotected

Definition at line 34 of file DatabaseUpdater.php.

array DatabaseUpdater::$updates = []
protected

Array of updates to perform on the database.

Definition at line 41 of file DatabaseUpdater.php.

Referenced by PostgresUpdater\getOldGlobalUpdates(), getOldGlobalUpdates(), and FakeDatabaseUpdater\setAppliedUpdates().

array DatabaseUpdater::$updatesSkipped = []
protected

Array of updates that were skipped.

Definition at line 48 of file DatabaseUpdater.php.

Referenced by writeSchemaUpdateFile().


The documentation for this class was generated from the following file: