MediaWiki master
CreateDatabaseTask.php
Go to the documentation of this file.
1<?php
2
4
7
13class CreateDatabaseTask extends Task {
14 public function getName() {
15 return 'database';
16 }
17
18 public function getAliases() {
19 return 'schema';
20 }
21
22 public function execute(): Status {
23 $creator = $this->getDatabaseCreator();
24 $dbName = $this->getConfigVar( MainConfigNames::DBname );
25 if ( !$creator->existsLocally( $dbName ) ) {
26 return $creator->createLocally( $dbName );
27 }
28 return Status::newGood();
29 }
30}
Create the MySQL/MariaDB or PostgreSQL database.
getAliases()
Get alternative names of this task.
getName()
Get the symbolic name of the task.
Base class for installer tasks.
Definition Task.php:24
getConfigVar(string $name)
Get a configuration variable for the wiki being created.
Definition Task.php:182
getDatabaseCreator()
Get a helper for creating databases.
Definition Task.php:286
A class containing constants representing the names of configuration variables.
const DBname
Name constant for the DBname setting, for use with Config::get()
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:54