BlueSpice MediaWiki REL1_27
|
Public Member Functions | |
getDB () | |
output ($str) | |
addExtensionUpdate (array $update) | |
addExtensionTable ($tableName, $sqlPath) | |
addExtensionIndex ($tableName, $indexName, $sqlPath) | |
addExtensionField ($tableName, $columnName, $sqlPath) | |
dropExtensionField ($tableName, $columnName, $sqlPath) | |
dropExtensionIndex ($tableName, $indexName, $sqlPath) | |
dropExtensionTable ($tableName, $sqlPath) | |
renameExtensionIndex ($tableName, $oldIndexName, $newIndexName, $sqlPath, $skipBothIndexExistWarning=false) | |
modifyExtensionField ($tableName, $fieldName, $sqlPath) | |
tableExists ($tableName) | |
addPostDatabaseUpdateMaintenance ($class) | |
getPostDatabaseUpdateMaintenance () | |
doUpdates ($what=[ 'core', 'extensions', 'stats']) | |
updateRowExists ($key) | |
insertUpdateRow ($key, $val=null) | |
copyFile ($filename) | |
appendLine ($line) | |
dropTable ($table, $patch=false, $fullpath=false) | |
modifyField ($table, $field, $patch, $fullpath=false) | |
setFileAccess () | |
purgeCache () | |
Static Public Member Functions | |
static | newForDB (&$db, $shared=false, $maintenance=null) |
Protected Member Functions | |
__construct (DatabaseBase &$db, $shared, Maintenance $maintenance=null) | |
getExtensionUpdates () | |
setAppliedUpdates ($version, $updates=[]) | |
canUseNewUpdatelog () | |
doTable ($name) | |
getOldGlobalUpdates () | |
getCoreUpdateList () | |
applyPatch ($path, $isFullPath=false, $msg=null) | |
addTable ($name, $patch, $fullpath=false) | |
addField ($table, $field, $patch, $fullpath=false) | |
addIndex ($table, $index, $patch, $fullpath=false) | |
dropField ($table, $field, $patch, $fullpath=false) | |
dropIndex ($table, $index, $patch, $fullpath=false) | |
renameIndex ($table, $oldIndex, $newIndex, $skipBothIndexExistWarning, $patch, $fullpath=false) | |
checkStats () | |
doActiveUsersInit () | |
doLogUsertextPopulation () | |
doLogSearchPopulation () | |
doUpdateTranscacheField () | |
doCollationUpdate () | |
doMigrateUserOptions () | |
doEnableProfiling () | |
disableContentHandlerUseDB () | |
enableContentHandlerUseDB () | |
Protected Attributes | |
$updates = [] | |
$updatesSkipped = [] | |
$extensionUpdates = [] | |
$db | |
$shared = false | |
$postDatabaseUpdateMaintenance | |
$fileHandle = null | |
$skipSchema = false | |
$holdContentHandlerUseDB = true | |
Static Protected Attributes | |
static | $updateCounter = 0 |
Class for handling database updates. Roughly based off of updaters.inc, with a few improvements :)
|
protected |
Constructor
DatabaseBase | $db | To perform updates on |
bool | $shared | Whether to perform updates on shared tables |
Maintenance | $maintenance | Maintenance object which created us |
DatabaseUpdater::addExtensionField | ( | $tableName, | |
$columnName, | |||
$sqlPath | |||
) |
string | $tableName | |
string | $columnName | |
string | $sqlPath |
DatabaseUpdater::addExtensionIndex | ( | $tableName, | |
$indexName, | |||
$sqlPath | |||
) |
string | $tableName | |
string | $indexName | |
string | $sqlPath |
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 |
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 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. |
|
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 |
|
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 |
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 |
|
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 |
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 |
|
protected |
Applies a SQL patch
string | $path | Path to the patch file |
bool | $isFullPath | Whether to treat $path as a relative or not |
string | $msg | Description of the patch |
|
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
|
protected |
Check the site_stats table is not properly populated.
DatabaseUpdater::copyFile | ( | $filename | ) |
Append an SQL fragment to the open file handle.
string | $filename | File name to open |
|
protected |
Turns off content handler fields during parts of the upgrade where they aren't available.
|
protected |
Sets the number of active users in the site_stats table
|
protected |
Update CategoryLinks collation
|
protected |
Enable profiling table when it's turned on
|
protected |
Migrate log params to new table and index for searching
|
protected |
Populates the log_user_text field in the logging table
|
protected |
Migrates user options from the user table blob to user_properties
|
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 |
DatabaseUpdater::doUpdates | ( | $what = [ 'core' , |
|
'extensions' | , | ||
'stats'] | |||
) |
Do all the updates
array | $what | What updates to perform |
|
protected |
Updates the timestamps in the transcache table
DatabaseUpdater::dropExtensionField | ( | $tableName, | |
$columnName, | |||
$sqlPath | |||
) |
string | $tableName | |
string | $columnName | |
string | $sqlPath |
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 |
DatabaseUpdater::dropExtensionTable | ( | $tableName, | |
$sqlPath | |||
) |
string | $tableName | |
string | $sqlPath |
|
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 |
|
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 |
DatabaseUpdater::dropTable | ( | $table, | |
$patch = false , |
|||
$fullpath = false |
|||
) |
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. |
|
protected |
Turns content handler fields back on.
|
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)
DatabaseUpdater::getDB | ( | ) |
Get a database connection to run updates
|
protected |
Get the list of extension-defined updates
|
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.
DatabaseUpdater::getPostDatabaseUpdateMaintenance | ( | ) |
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 | $val | [optional] Value to insert along with the key |
DatabaseUpdater::modifyExtensionField | ( | $tableName, | |
$fieldName, | |||
$sqlPath | |||
) |
string | $tableName | The table name |
string | $fieldName | The field to be modified |
string | $sqlPath | The path to the SQL change path |
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 |
|
static |
DatabaseBase | $db | |
bool | $shared | |
Maintenance | $maintenance |
MWException |
DatabaseUpdater::output | ( | $str | ) |
Output some text. If we're running from web, escape the text first.
string | $str | Text to output |
DatabaseUpdater::purgeCache | ( | ) |
Purge the objectcache table
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] |
|
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 |
|
protected |
string | $version | |
array | $updates |
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
DatabaseUpdater::tableExists | ( | $tableName | ) |
string | $tableName |
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 |
|
protected |
Hold the value of $wgContentHandlerUseDB during the upgrade.
|
protected |