Debian Codegraph @

includes/installer/SqliteConnectForm.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Installer;
4
5 use MediaWiki\Status\Status;
6
7 /**
8 * @internal
9 */
10 class SqliteConnectForm extends DatabaseConnectForm {
11
12 public function getHtml() {
13 return $this->getTextBox(
14 'wgSQLiteDataDir',
15 'config-sqlite-dir', [],
16 $this->webInstaller->getHelpBox( 'config-sqlite-dir-help' )
17 ) .
18 $this->getTextBox(
19 'wgDBname',
20 'config-db-name',
21 [],
22 $this->webInstaller->getHelpBox( 'config-sqlite-name-help' )
23 );
24 }
25
26 /**
27 * @return Status
28 */
29 public function submit() {
30 $this->setVarsFromRequest( [ 'wgSQLiteDataDir', 'wgDBname' ] );
31
32 # Try realpath() if the directory already exists
33 $dir = SqliteInstaller::realpath( $this->getVar( 'wgSQLiteDataDir' ) );
34 $result = SqliteInstaller::checkDataDir( $dir );
35 if ( $result->isOK() ) {
36 # Try expanding again in case we've just created it
37 $dir = SqliteInstaller::realpath( $dir );
38 $this->setVar( 'wgSQLiteDataDir', $dir );
39 }
40 # Table prefix is not used on SQLite, keep it empty
41 $this->setVar( 'wgDBprefix', '' );
42
43 return $result;
44 }
45
46 }