MediaWiki master
|
Base class for DBMS-specific installation helper classes. More...
Inherited by MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
Public Member Functions | |
__construct ( $parent) | |
Construct and initialise parent. | |
checkPrerequisites () | |
Checks for installation prerequisites other than those checked by isCompiled() | |
createExtensionTables () | |
Create the tables for each extension the user enabled. | |
createManualTables () | |
Create database tables from scratch. | |
createTables () | |
Create database tables from scratch from the automatically generated file. | |
doUpgrade () | |
Perform database upgrades. | |
enableLB () | |
Set up LBFactory so that getPrimaryDatabase() etc. | |
getConnectForm (WebInstaller $webInstaller) | |
getConnection () | |
Connect to the database using the administrative user/password currently defined in the session. | |
getGeneratedSchemaPath ( $db) | |
Return a path to the DBMS-specific automatically generated schema file. | |
getGlobalDefaults () | |
Get a name=>value map of MW configuration globals for the default values. | |
getGlobalNames () | |
Get an array of MW configuration globals that will be configured by this class. | |
getInternalDefaults () | |
Get a name=>value map of internal variables used during installation. | |
getLocalSettings () | |
Get the DBMS-specific options for LocalSettings.php generation. | |
getName () | |
Return the internal name, e.g. | |
getReadableName () | |
Get the internationalised name for this DBMS. | |
getSchemaPath ( $db) | |
Return a path to the DBMS-specific schema file, otherwise default to tables.sql. | |
getSchemaVars () | |
Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files. | |
getSettingsForm (WebInstaller $webInstaller) | |
getUpdateKeysPath ( $db) | |
Return a path to the DBMS-specific update key file, otherwise default to update-keys.sql. | |
getVar ( $var, $default=null) | |
Get a variable, taking local defaults into account. | |
insertUpdateKeys () | |
Insert update keys into table to prevent running unneeded updates. | |
isCompiled () | |
needsUpgrade () | |
Determine whether an existing installation of MediaWiki is present in the configured administrative connection. | |
openConnection () | |
Open a connection to the database using the administrative user/password currently defined in the session, without any caching. | |
outputHandler ( $string) | |
populateInterwikiTable () | |
Common function for databases that don't understand the MySQLish syntax of interwiki.list. | |
preInstall () | |
Allow DB installers a chance to make last-minute changes before installation occurs. | |
preUpgrade () | |
Allow DB installers a chance to make checks before upgrade. | |
setupDatabase () | |
Create the database and return a Status object indicating success or failure. | |
setupSchemaVars () | |
Set appropriate schema variables in the current database connection. | |
setVar ( $name, $value) | |
Convenience alias for $this->parent->setVar() | |
Static Public Member Functions | |
static | meetsMinimumRequirement (IDatabase $conn) |
Whether the provided version meets the necessary requirements for this type. | |
Public Attributes | |
Database | $db = null |
The database connection. | |
Installer | $parent |
The Installer object. | |
Static Public Attributes | |
static string | $minimumVersion |
Set by subclasses. | |
Protected Member Functions | |
selectDatabase (Database $conn, string $database) | |
Static Protected Member Functions | |
static | checkExtension ( $name) |
Convenience function. | |
Protected Attributes | |
array | $globalNames = [] |
Array of MW configuration globals this class uses. | |
array | $internalDefaults = [] |
Internal variables for installation. | |
Static Protected Attributes | |
static string | $notMinimumVersionMessage |
Set by subclasses. | |
Base class for DBMS-specific installation helper classes.
Definition at line 45 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::__construct | ( | $parent | ) |
Construct and initialise parent.
This is typically only called from Installer::getDBInstaller()
WebInstaller | $parent |
Definition at line 419 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\$parent.
|
staticprotected |
Convenience function.
Check if a named extension is present.
string | $name |
Definition at line 430 of file DatabaseInstaller.php.
Referenced by MediaWiki\Installer\MysqlInstaller\isCompiled(), MediaWiki\Installer\PostgresInstaller\isCompiled(), and MediaWiki\Installer\SqliteInstaller\isCompiled().
MediaWiki\Installer\DatabaseInstaller::checkPrerequisites | ( | ) |
Checks for installation prerequisites other than those checked by isCompiled()
Reimplemented in MediaWiki\Installer\SqliteInstaller.
Definition at line 118 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::createExtensionTables | ( | ) |
Create the tables for each extension the user enabled.
Definition at line 291 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\enableLB(), MediaWiki\Installer\DatabaseInstaller\getConnection(), and MediaWiki\Installer\DatabaseUpdater\newForDB().
MediaWiki\Installer\DatabaseInstaller::createManualTables | ( | ) |
Create database tables from scratch.
Reimplemented in MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
Definition at line 223 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::createTables | ( | ) |
Create database tables from scratch from the automatically generated file.
Reimplemented in MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
Definition at line 214 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::doUpgrade | ( | ) |
Perform database upgrades.
Definition at line 371 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\enableLB(), MediaWiki\Installer\DatabaseUpdater\newForDB(), and MediaWiki\Installer\DatabaseInstaller\setupSchemaVars().
MediaWiki\Installer\DatabaseInstaller::enableLB | ( | ) |
Set up LBFactory so that getPrimaryDatabase() etc.
works. We set up a special LBFactory instance which returns the current installer connection.
Definition at line 345 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\getConnection().
Referenced by MediaWiki\Installer\DatabaseInstaller\createExtensionTables(), and MediaWiki\Installer\DatabaseInstaller\doUpgrade().
|
abstract |
MediaWiki\Installer\DatabaseInstaller::getConnection | ( | ) |
Connect to the database using the administrative user/password currently defined in the session.
Returns a status object. On success, the status object will contain a Database object in its value member.
This will return a cached connection if one is available.
Reimplemented in MediaWiki\Installer\PostgresInstaller.
Definition at line 149 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\openConnection().
Referenced by MediaWiki\Installer\DatabaseInstaller\createExtensionTables(), MediaWiki\Installer\DatabaseInstaller\enableLB(), MediaWiki\Installer\DatabaseInstaller\needsUpgrade(), MediaWiki\Installer\DatabaseInstaller\populateInterwikiTable(), MediaWiki\Installer\Installer\populateSiteStats(), and MediaWiki\Installer\DatabaseInstaller\setupSchemaVars().
MediaWiki\Installer\DatabaseInstaller::getGeneratedSchemaPath | ( | $db | ) |
Return a path to the DBMS-specific automatically generated schema file.
IDatabase | $db |
Definition at line 272 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\$db.
MediaWiki\Installer\DatabaseInstaller::getGlobalDefaults | ( | ) |
Get a name=>value map of MW configuration globals for the default values.
Reimplemented in MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
Definition at line 448 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\getGlobalNames().
Referenced by MediaWiki\Installer\DatabaseInstaller\getVar().
MediaWiki\Installer\DatabaseInstaller::getGlobalNames | ( | ) |
Get an array of MW configuration globals that will be configured by this class.
Definition at line 410 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\$globalNames.
Referenced by MediaWiki\Installer\DatabaseInstaller\getGlobalDefaults().
MediaWiki\Installer\DatabaseInstaller::getInternalDefaults | ( | ) |
Get a name=>value map of internal variables used during installation.
Definition at line 462 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\$internalDefaults.
Referenced by MediaWiki\Installer\DatabaseInstaller\getVar().
|
abstract |
Get the DBMS-specific options for LocalSettings.php generation.
Reimplemented in MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
|
abstract |
Return the internal name, e.g.
'mysql', or 'sqlite'.
Reimplemented in MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
Referenced by MediaWiki\Installer\DatabaseInstaller\getReadableName().
MediaWiki\Installer\DatabaseInstaller::getReadableName | ( | ) |
Get the internationalised name for this DBMS.
Definition at line 438 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\getName(), and wfMessage().
MediaWiki\Installer\DatabaseInstaller::getSchemaPath | ( | $db | ) |
Return a path to the DBMS-specific schema file, otherwise default to tables.sql.
IDatabase | $db |
Definition at line 262 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\$db.
MediaWiki\Installer\DatabaseInstaller::getSchemaVars | ( | ) |
Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files.
Reimplemented in MediaWiki\Installer\MysqlInstaller.
Definition at line 318 of file DatabaseInstaller.php.
Referenced by MediaWiki\Installer\DatabaseInstaller\setupSchemaVars().
|
abstract |
MediaWiki\Installer\DatabaseInstaller::getUpdateKeysPath | ( | $db | ) |
Return a path to the DBMS-specific update key file, otherwise default to update-keys.sql.
IDatabase | $db |
Definition at line 283 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\$db.
MediaWiki\Installer\DatabaseInstaller::getVar | ( | $var, | |
$default = null ) |
Get a variable, taking local defaults into account.
string | $var | |
mixed | null | $default |
Definition at line 472 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\getGlobalDefaults(), and MediaWiki\Installer\DatabaseInstaller\getInternalDefaults().
Referenced by MediaWiki\Installer\DatabaseInstaller\needsUpgrade(), and MediaWiki\Installer\DatabaseInstaller\populateInterwikiTable().
MediaWiki\Installer\DatabaseInstaller::insertUpdateKeys | ( | ) |
Insert update keys into table to prevent running unneeded updates.
Definition at line 232 of file DatabaseInstaller.php.
|
abstract |
Reimplemented in MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
|
static |
Whether the provided version meets the necessary requirements for this type.
IDatabase | $conn |
Reimplemented in MediaWiki\Installer\MysqlInstaller.
Definition at line 92 of file DatabaseInstaller.php.
References Wikimedia\Rdbms\IReadableDatabase\getServerVersion().
Referenced by MediaWiki\Installer\PostgresConnectForm\submit().
MediaWiki\Installer\DatabaseInstaller::needsUpgrade | ( | ) |
Determine whether an existing installation of MediaWiki is present in the configured administrative connection.
Returns true if there is such a wiki, false if the database doesn't exist.
Traditionally, this is done by testing for the existence of either the revision table or the cur table.
Reimplemented in MediaWiki\Installer\SqliteInstaller.
Definition at line 507 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\getConnection(), MediaWiki\Installer\DatabaseInstaller\getVar(), and MediaWiki\Installer\DatabaseInstaller\selectDatabase().
|
abstract |
Open a connection to the database using the administrative user/password currently defined in the session, without any caching.
Returns a status object. On success, the status object will contain a Database object in its value member.
Reimplemented in MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
Referenced by MediaWiki\Installer\DatabaseInstaller\getConnection().
MediaWiki\Installer\DatabaseInstaller::outputHandler | ( | $string | ) |
Definition at line 575 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::populateInterwikiTable | ( | ) |
Common function for databases that don't understand the MySQLish syntax of interwiki.list.
Definition at line 531 of file DatabaseInstaller.php.
References $IP, MediaWiki\Installer\DatabaseInstaller\getConnection(), MediaWiki\Installer\DatabaseInstaller\getVar(), and MediaWiki\Installer\DatabaseInstaller\selectDatabase().
MediaWiki\Installer\DatabaseInstaller::preInstall | ( | ) |
Allow DB installers a chance to make last-minute changes before installation occurs.
This happens before setupDatabase() or createTables() is called, but long after the constructor. Helpful for things like modifying setup steps :)
Reimplemented in MediaWiki\Installer\MysqlInstaller, and MediaWiki\Installer\PostgresInstaller.
Definition at line 397 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::preUpgrade | ( | ) |
Allow DB installers a chance to make checks before upgrade.
Reimplemented in MediaWiki\Installer\MysqlInstaller, and MediaWiki\Installer\PostgresInstaller.
Definition at line 403 of file DatabaseInstaller.php.
|
protected |
Database | $conn | |
string | $database |
Definition at line 585 of file DatabaseInstaller.php.
References Wikimedia\Rdbms\Database\dbSchema(), Wikimedia\Rdbms\Database\selectDomain(), and Wikimedia\Rdbms\Database\tablePrefix().
Referenced by MediaWiki\Installer\DatabaseInstaller\needsUpgrade(), and MediaWiki\Installer\DatabaseInstaller\populateInterwikiTable().
|
abstract |
Create the database and return a Status object indicating success or failure.
Reimplemented in MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
MediaWiki\Installer\DatabaseInstaller::setupSchemaVars | ( | ) |
Set 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.
Definition at line 328 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\getConnection(), and MediaWiki\Installer\DatabaseInstaller\getSchemaVars().
Referenced by MediaWiki\Installer\DatabaseInstaller\doUpgrade().
MediaWiki\Installer\DatabaseInstaller::setVar | ( | $name, | |
$value ) |
Convenience alias for $this->parent->setVar()
string | $name | |
mixed | $value |
Definition at line 489 of file DatabaseInstaller.php.
Database MediaWiki\Installer\DatabaseInstaller::$db = null |
The database connection.
Definition at line 69 of file DatabaseInstaller.php.
Referenced by MediaWiki\Installer\DatabaseInstaller\getGeneratedSchemaPath(), MediaWiki\Installer\DatabaseInstaller\getSchemaPath(), and MediaWiki\Installer\DatabaseInstaller\getUpdateKeysPath().
|
protected |
Array of MW configuration globals this class uses.
Definition at line 83 of file DatabaseInstaller.php.
Referenced by MediaWiki\Installer\DatabaseInstaller\getGlobalNames().
|
protected |
Internal variables for installation.
Definition at line 76 of file DatabaseInstaller.php.
Referenced by MediaWiki\Installer\DatabaseInstaller\getInternalDefaults().
|
static |
Set by subclasses.
Definition at line 57 of file DatabaseInstaller.php.
|
staticprotected |
Set by subclasses.
Definition at line 62 of file DatabaseInstaller.php.
Installer MediaWiki\Installer\DatabaseInstaller::$parent |
The Installer object.
Definition at line 52 of file DatabaseInstaller.php.
Referenced by MediaWiki\Installer\DatabaseInstaller\__construct().