MediaWiki
master
DatabaseCreator.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Installer
;
4
5
use
MediaWiki\Installer\Task\ITaskContext
;
6
use
MediaWiki\MainConfigNames
;
7
use
MediaWiki\Status\Status
;
8
use
Wikimedia\Rdbms\ILoadBalancer
;
9
15
abstract
class
DatabaseCreator
{
17
protected
$context
;
18
25
public
static
function
createInstance
(
ITaskContext
$context
):
DatabaseCreator
{
26
$type =
$context
->getConfigVar(
MainConfigNames
::DBtype );
27
28
switch
( $type ) {
29
case
'mysql'
:
30
return
new
MysqlDatabaseCreator
(
$context
);
31
case
'postgres'
:
32
return
new
PostgresDatabaseCreator
(
$context
);
33
case
'sqlite'
:
34
return
new
SqliteDatabaseCreator
(
$context
);
35
default
:
36
throw
new \InvalidArgumentException(
"Unknown DBMS type \"$type\""
);
37
}
38
}
39
43
protected
function
__construct
(
ITaskContext
$context ) {
44
$this->context = $context;
45
}
46
53
abstract
public
function
existsLocally
( $database );
54
63
abstract
public
function
existsInLoadBalancer
(
ILoadBalancer
$loadBalancer, $database );
64
71
abstract
public
function
createLocally
( $database ):
Status
;
72
81
abstract
public
function
createInLoadBalancer
(
ILoadBalancer
$loadBalancer, $database ):
Status
;
82
}
MediaWiki\Installer\DatabaseCreator
Helper for creating databases.
Definition
DatabaseCreator.php:15
MediaWiki\Installer\DatabaseCreator\createInstance
static createInstance(ITaskContext $context)
Definition
DatabaseCreator.php:25
MediaWiki\Installer\DatabaseCreator\createInLoadBalancer
createInLoadBalancer(ILoadBalancer $loadBalancer, $database)
Create a database in the specified LoadBalancer which may be for an external cluster.
MediaWiki\Installer\DatabaseCreator\$context
ITaskContext $context
Definition
DatabaseCreator.php:17
MediaWiki\Installer\DatabaseCreator\existsInLoadBalancer
existsInLoadBalancer(ILoadBalancer $loadBalancer, $database)
Check if a database exists in the specified LoadBalancer which may be for an external cluster.
MediaWiki\Installer\DatabaseCreator\existsLocally
existsLocally( $database)
Check if a database exists on the local cluster or context.
MediaWiki\Installer\DatabaseCreator\createLocally
createLocally( $database)
Create a database in the local cluster or install context.
MediaWiki\Installer\DatabaseCreator\__construct
__construct(ITaskContext $context)
Definition
DatabaseCreator.php:43
MediaWiki\Installer\MysqlDatabaseCreator
Definition
MysqlDatabaseCreator.php:8
MediaWiki\Installer\PostgresDatabaseCreator
Definition
PostgresDatabaseCreator.php:8
MediaWiki\Installer\SqliteDatabaseCreator
Definition
SqliteDatabaseCreator.php:11
MediaWiki\MainConfigNames
A class containing constants representing the names of configuration variables.
Definition
MainConfigNames.php:22
MediaWiki\Status\Status
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition
Status.php:54
MediaWiki\Installer\Task\ITaskContext
Dependency bundle and execution context for installer tasks.
Definition
ITaskContext.php:14
Wikimedia\Rdbms\ILoadBalancer
This class is a delegate to ILBFactory for a given database cluster.
Definition
ILoadBalancer.php:113
MediaWiki\Installer
Definition
CliInstaller.php:23
includes
installer
DatabaseCreator.php
Generated on Tue Jan 7 2025 20:23:13 for MediaWiki by
1.10.0