Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| CreateDatabaseTask | |
0.00% |
0 / 7 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAliases | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| execute | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Installer\Task; |
| 4 | |
| 5 | use MediaWiki\MainConfigNames; |
| 6 | use MediaWiki\Status\Status; |
| 7 | |
| 8 | /** |
| 9 | * Create the MySQL/MariaDB or PostgreSQL database |
| 10 | * |
| 11 | * @internal For use by the installer |
| 12 | */ |
| 13 | class CreateDatabaseTask extends Task { |
| 14 | /** @inheritDoc */ |
| 15 | public function getName() { |
| 16 | return 'database'; |
| 17 | } |
| 18 | |
| 19 | /** @inheritDoc */ |
| 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 | } |