Merge "Fix installation failure due to unexpected dbpath under CLI installation"
[lhc/web/wiklou.git] / includes / installer / SqliteInstaller.php
index d012f1b..b21a177 100644 (file)
@@ -255,27 +255,6 @@ class SqliteInstaller extends DatabaseInstaller {
                $this->setVar( 'wgDBpassword', '' );
                $this->setupSchemaVars();
 
-               # Create the global cache DB
-               try {
-                       $conn = Database::factory(
-                               'sqlite', [ 'dbname' => 'wikicache', 'dbDirectory' => $dir ] );
-                       # @todo: don't duplicate objectcache definition, though it's very simple
-                       $sql =
-<<<EOT
-       CREATE TABLE IF NOT EXISTS objectcache (
-               keyname BLOB NOT NULL default '' PRIMARY KEY,
-               value BLOB,
-               exptime TEXT
-       )
-EOT;
-                       $conn->query( $sql );
-                       $conn->query( "CREATE INDEX IF NOT EXISTS exptime ON objectcache (exptime)" );
-                       $conn->query( "PRAGMA journal_mode=WAL" ); // this is permanent
-                       $conn->close();
-               } catch ( DBConnectionError $e ) {
-                       return Status::newFatal( 'config-sqlite-connection-error', $e->getMessage() );
-               }
-
                # Create the l10n cache DB
                try {
                        $conn = Database::factory(
@@ -369,7 +348,14 @@ EOT;
                global $IP;
 
                $module = DatabaseSqlite::getFulltextSearchModule();
-               $fts3tTable = $this->db->checkForEnabledSearch();
+               $searchIndexSql = (string)$this->db->selectField(
+                       $this->db->addIdentifierQuotes( 'sqlite_master' ),
+                       'sql',
+                       [ 'tbl_name' => $this->db->tableName( 'searchindex', 'raw' ) ],
+                       __METHOD__
+               );
+               $fts3tTable = ( stristr( $searchIndexSql, 'fts' ) !== false );
+
                if ( $fts3tTable && !$module ) {
                        $status->warning( 'config-sqlite-fts3-downgrade' );
                        $this->db->sourceFile( "$IP/maintenance/sqlite/archives/searchindex-no-fts.sql" );