* @file
* @ingroup Deployment
*/
-
+
/**
* Class for setting up the MediaWiki database using SQLLite.
- *
+ *
* @ingroup Deployment
* @since 1.17
*/
class SqliteInstaller extends DatabaseInstaller {
-
+
protected $globalNames = array(
'wgDBname',
'wgSQLiteDataDir',
}
public function getConnectForm() {
- return $this->getTextBox( 'wgSQLiteDataDir', 'config-sqlite-dir' ) .
- $this->parent->getHelpBox( 'config-sqlite-dir-help' ) .
- $this->getTextBox( 'wgDBname', 'config-db-name' ) .
- $this->parent->getHelpBox( 'config-sqlite-name-help' );
+ return $this->getTextBox( 'wgSQLiteDataDir', 'config-sqlite-dir', array(), $this->parent->getHelpBox( 'config-sqlite-dir-help' ) ) .
+ $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-sqlite-name-help' ) );
}
public function submitConnectForm() {
global $wgSQLiteDataDir;
$status = Status::newGood();
- $dir = $this->getVar( 'wgSQLiteDataDir' );
- $dbName = $this->getVar( 'wgDBname' );
-
- try {
- # FIXME: need more sensible constructor parameters, e.g. single associative array
- # Setting globals kind of sucks
- $wgSQLiteDataDir = $dir;
- $this->db = new DatabaseSqlite( false, false, false, $dbName );
+ if( is_null( $this->db ) ) {
+ $dir = $this->getVar( 'wgSQLiteDataDir' );
+ $dbName = $this->getVar( 'wgDBname' );
+
+ try {
+ # FIXME: need more sensible constructor parameters, e.g. single associative array
+ # Setting globals kind of sucks
+ $wgSQLiteDataDir = $dir;
+ $this->db = new DatabaseSqlite( false, false, false, $dbName );
+ $status->value = $this->db;
+ } catch ( DBConnectionError $e ) {
+ $status->fatal( 'config-sqlite-connection-error', $e->getMessage() );
+ }
+ } else {
$status->value = $this->db;
- } catch ( DBConnectionError $e ) {
- $status->fatal( 'config-sqlite-connection-error', $e->getMessage() );
}
return $status;
}
"# SQLite-specific settings
\$wgSQLiteDataDir = \"{$dir}\";";
}
-}
\ No newline at end of file
+}