Workaround null Title error in parser during main page creation. Used $wgTitle. I...
[lhc/web/wiklou.git] / includes / installer / SqliteInstaller.php
index 4dccdd1..32d22e6 100644 (file)
@@ -5,15 +5,15 @@
  * @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',
@@ -41,10 +41,8 @@ class SqliteInstaller extends DatabaseInstaller {
        }
 
        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() {
@@ -95,17 +93,21 @@ class SqliteInstaller extends DatabaseInstaller {
                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;
        }
@@ -175,4 +177,4 @@ class SqliteInstaller extends DatabaseInstaller {
 "# SQLite-specific settings
 \$wgSQLiteDataDir    = \"{$dir}\";";
        }
-}
\ No newline at end of file
+}