MediaWiki master
CreateDatabaseTask.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Installer\Task;
4
5use MediaWiki\MainConfigNames;
6use MediaWiki\Status\Status;
7
13class CreateDatabaseTask extends Task {
15 public function getName() {
16 return 'database';
17 }
18
20 public function getAliases() {
21 return 'schema';
22 }
23
24 public function execute(): Status {
25 $creator = $this->getDatabaseCreator();
26 $dbName = $this->getConfigVar( MainConfigNames::DBname );
27 if ( !$creator->existsLocally( $dbName ) ) {
28 return $creator->createLocally( $dbName );
29 }
30 return Status::newGood();
31 }
32}
Create the MySQL/MariaDB or PostgreSQL database.
getAliases()
Get alternative names of this task.These aliases can be used to fulfill dependencies of other tasks....
getName()
Get the symbolic name of the task.string
Base class for installer tasks.
Definition Task.php:24
getConfigVar(string $name)
Get a configuration variable for the wiki being created.
Definition Task.php:180
getDatabaseCreator()
Get a helper for creating databases.
Definition Task.php:284
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:44