[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/installer/ -> DatabaseUpdater.php (summary)

DBMS-specific updater helper. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 1075 lines (31 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 maintenance/Maintenance.php

Defines 50 functions

  __construct()
  initOldGlobals()
  loadExtensions()
  newForDB()
  getDB()
  output()
  addExtensionUpdate()
  addExtensionTable()
  addExtensionIndex()
  addExtensionField()
  dropExtensionField()
  dropExtensionIndex()
  dropExtensionTable()
  renameExtensionIndex()
  modifyExtensionField()
  tableExists()
  addPostDatabaseUpdateMaintenance()
  getExtensionUpdates()
  getPostDatabaseUpdateMaintenance()
  writeSchemaUpdateFile()
  doUpdates()
  runUpdates()
  setAppliedUpdates()
  updateRowExists()
  insertUpdateRow()
  canUseNewUpdatelog()
  doTable()
  getOldGlobalUpdates()
  copyFile()
  appendLine()
  applyPatch()
  addTable()
  addField()
  addIndex()
  dropField()
  dropIndex()
  renameIndex()
  dropTable()
  modifyField()
  purgeCache()
  checkStats()
  doActiveUsersInit()
  doLogUsertextPopulation()
  doLogSearchPopulation()
  doUpdateTranscacheField()
  doCollationUpdate()
  doMigrateUserOptions()
  rebuildLocalisationCache()
  disableContentHandlerUseDB()
  enableContentHandlerUseDB()

Functions
Functions that are not part of a class:

__construct( DatabaseBase &$db, $shared, Maintenance $maintenance = null )   X-Ref
Constructor

param: DatabaseBase $db To perform updates on
param: bool $shared Whether to perform updates on shared tables
param: Maintenance $maintenance Maintenance object which created us

initOldGlobals()   X-Ref
Initialize all of the old globals. One day this should all become
something much nicer


loadExtensions()   X-Ref
Loads LocalSettings.php, if needed, and initialises everything needed for
LoadExtensionSchemaUpdates hook.


newForDB( &$db, $shared = false, $maintenance = null )   X-Ref

param: DatabaseBase $db
param: bool $shared
param: Maintenance $maintenance
return: DatabaseUpdater

getDB()   X-Ref
Get a database connection to run updates

return: DatabaseBase

output( $str )   X-Ref
Output some text. If we're running from web, escape the text first.

param: string $str Text to output

addExtensionUpdate( array $update )   X-Ref
Add a new update coming from an extension. This should be called by
extensions while executing the LoadExtensionSchemaUpdates hook.

param: array $update The update to run. Format is the following:

addExtensionTable( $tableName, $sqlPath )   X-Ref
Convenience wrapper for addExtensionUpdate() when adding a new table (which
is the most common usage of updaters in an extension)

param: string $tableName Name of table to create
param: string $sqlPath Full path to the schema file

addExtensionIndex( $tableName, $indexName, $sqlPath )   X-Ref

param: string $tableName
param: string $indexName
param: string $sqlPath

addExtensionField( $tableName, $columnName, $sqlPath )   X-Ref

param: string $tableName
param: string $columnName
param: string $sqlPath

dropExtensionField( $tableName, $columnName, $sqlPath )   X-Ref

param: string $tableName
param: string $columnName
param: string $sqlPath

dropExtensionIndex( $tableName, $indexName, $sqlPath )   X-Ref
Drop an index from an extension table

param: string $tableName The table name
param: string $indexName The index name
param: string $sqlPath The path to the SQL change path

dropExtensionTable( $tableName, $sqlPath )   X-Ref

param: string $tableName
param: string $sqlPath

renameExtensionIndex( $tableName, $oldIndexName, $newIndexName,$sqlPath, $skipBothIndexExistWarning = false)   X-Ref
Rename an index on an extension table

param: string $tableName The table name
param: string $oldIndexName The old index name
param: string $newIndexName The new index name
param: string $sqlPath The path to the SQL change path
param: bool $skipBothIndexExistWarning Whether to warn if both the old

modifyExtensionField( $tableName, $fieldName, $sqlPath )   X-Ref

param: string $tableName The table name
param: string $fieldName The field to be modified
param: string $sqlPath The path to the SQL change path

tableExists( $tableName )   X-Ref

param: string $tableName
return: bool

addPostDatabaseUpdateMaintenance( $class )   X-Ref
Add a maintenance script to be run after the database updates are complete.

Script should subclass LoggedUpdateMaintenance

param: string $class Name of a Maintenance subclass

getExtensionUpdates()   X-Ref
Get the list of extension-defined updates

return: array

getPostDatabaseUpdateMaintenance()   X-Ref

return: array

writeSchemaUpdateFile( $schemaUpdate = array()   X-Ref

param: array $schemaUpdate

doUpdates( $what = array( 'core', 'extensions', 'stats' )   X-Ref
Do all the updates

param: array $what What updates to perform

runUpdates( array $updates, $passSelf )   X-Ref
Helper function for doUpdates()

param: array $updates Array of updates to run
param: bool $passSelf Whether to pass this object we calling external functions

setAppliedUpdates( $version, $updates = array()   X-Ref

param: string $version
param: array $updates

updateRowExists( $key )   X-Ref
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!

param: string $key Name of the key to check for
return: bool

insertUpdateRow( $key, $val = null )   X-Ref
Helper function: Add a key to the updatelog table
Obviously, only use this for updates that occur after the updatelog table was
created!

param: string $key Name of key to insert
param: string $val [optional] Value to insert along with the key

canUseNewUpdatelog()   X-Ref
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

return: bool

doTable( $name )   X-Ref
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.

param: string $name Table name
return: bool

getOldGlobalUpdates()   X-Ref
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.

return: array

copyFile( $filename )   X-Ref
Append an SQL fragment to the open file handle.

param: string $filename File name to open

appendLine( $line )   X-Ref
Append a line to the open filehandle.  The line is assumed to
be a complete SQL statement.

This is used as a callback for for sourceLine().

param: string $line Text to append to the file
return: bool False to skip actually executing the file

applyPatch( $path, $isFullPath = false, $msg = null )   X-Ref
Applies a SQL patch

param: string $path Path to the patch file
param: bool $isFullPath Whether to treat $path as a relative or not
param: string $msg Description of the patch
return: bool False if patch is skipped.

addTable( $name, $patch, $fullpath = false )   X-Ref
Add a new table to the database

param: string $name Name of the new table
param: string $patch Path to the patch file
param: bool $fullpath Whether to treat $patch path as a relative or not
return: bool False if this was skipped because schema changes are skipped

addField( $table, $field, $patch, $fullpath = false )   X-Ref
Add a new field to an existing table

param: string $table Name of the table to modify
param: string $field Name of the new field
param: string $patch Path to the patch file
param: bool $fullpath Whether to treat $patch path as a relative or not
return: bool False if this was skipped because schema changes are skipped

addIndex( $table, $index, $patch, $fullpath = false )   X-Ref
Add a new index to an existing table

param: string $table Name of the table to modify
param: string $index Name of the new index
param: string $patch Path to the patch file
param: bool $fullpath Whether to treat $patch path as a relative or not
return: bool False if this was skipped because schema changes are skipped

dropField( $table, $field, $patch, $fullpath = false )   X-Ref
Drop a field from an existing table

param: string $table Name of the table to modify
param: string $field Name of the old field
param: string $patch Path to the patch file
param: bool $fullpath Whether to treat $patch path as a relative or not
return: bool False if this was skipped because schema changes are skipped

dropIndex( $table, $index, $patch, $fullpath = false )   X-Ref
Drop an index from an existing table

param: string $table Name of the table to modify
param: string $index Name of the index
param: string $patch Path to the patch file
param: bool $fullpath Whether to treat $patch path as a relative or not
return: bool False if this was skipped because schema changes are skipped

renameIndex( $table, $oldIndex, $newIndex,$skipBothIndexExistWarning, $patch, $fullpath = false)   X-Ref
Rename an index from an existing table

param: string $table Name of the table to modify
param: string $oldIndex Old name of the index
param: string $newIndex New name of the index
param: bool $skipBothIndexExistWarning Whether to warn if both the
param: string $patch Path to the patch file
param: bool $fullpath Whether to treat $patch path as a relative or not
return: bool False if this was skipped because schema changes are skipped

dropTable( $table, $patch = false, $fullpath = false )   X-Ref
If the specified table exists, drop it, or execute the
patch if one is provided.

Public @since 1.20

param: string $table Table to drop.
param: string|bool $patch String of patch file that will drop the table. Default: false.
param: bool $fullpath Whether $patch is a full path. Default: false.
return: bool False if this was skipped because schema changes are skipped

modifyField( $table, $field, $patch, $fullpath = false )   X-Ref
Modify an existing field

param: string $table Name of the table to which the field belongs
param: string $field Name of the field to modify
param: string $patch Path to the patch file
param: bool $fullpath Whether to treat $patch path as a relative or not
return: bool False if this was skipped because schema changes are skipped

purgeCache()   X-Ref
Purge the objectcache table


checkStats()   X-Ref
Check the site_stats table is not properly populated.


doActiveUsersInit()   X-Ref
Sets the number of active users in the site_stats table


doLogUsertextPopulation()   X-Ref
Populates the log_user_text field in the logging table


doLogSearchPopulation()   X-Ref
Migrate log params to new table and index for searching


doUpdateTranscacheField()   X-Ref
Updates the timestamps in the transcache table

return: bool

doCollationUpdate()   X-Ref
Update CategoryLinks collation


doMigrateUserOptions()   X-Ref
Migrates user options from the user table blob to user_properties


rebuildLocalisationCache()   X-Ref
Rebuilds the localisation cache


disableContentHandlerUseDB()   X-Ref
Turns off content handler fields during parts of the upgrade
where they aren't available.


enableContentHandlerUseDB()   X-Ref
Turns content handler fields back on.




Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1