Merge "Remove incorrect timezone conversion from date parameters"
[lhc/web/wiklou.git] / includes / installer / SqliteInstaller.php
index 31718fe..aa95438 100644 (file)
@@ -160,9 +160,9 @@ class SqliteInstaller extends DatabaseInstaller {
                        # Called early on in the installer, later we just want to sanity check
                        # if it's still writable
                        if ( $create ) {
-                               MediaWiki\suppressWarnings();
+                               Wikimedia\suppressWarnings();
                                $ok = wfMkdirParents( $dir, 0700, __METHOD__ );
-                               MediaWiki\restoreWarnings();
+                               Wikimedia\restoreWarnings();
                                if ( !$ok ) {
                                        return Status::newFatal( 'config-sqlite-mkdir-error', $dir );
                                }
@@ -230,6 +230,7 @@ class SqliteInstaller extends DatabaseInstaller {
                $status = Status::newGood();
                $status->merge( $this->makeStubDBFile( $dir, $db ) );
                $status->merge( $this->makeStubDBFile( $dir, "wikicache" ) );
+               $status->merge( $this->makeStubDBFile( $dir, "{$db}_l10n_cache" ) );
                if ( !$status->isOK() ) {
                        return $status;
                }
@@ -242,7 +243,8 @@ class SqliteInstaller extends DatabaseInstaller {
 
                # Create the global cache DB
                try {
-                       $conn = Database::factory( 'sqlite', [ 'dbname' => 'wikicache', 'dbDirectory' => $dir ] );
+                       $conn = Database::factory(
+                               'sqlite', [ 'dbname' => 'wikicache', 'dbDirectory' => $dir ] );
                        # @todo: don't duplicate objectcache definition, though it's very simple
                        $sql =
 <<<EOT
@@ -260,6 +262,27 @@ EOT;
                        return Status::newFatal( 'config-sqlite-connection-error', $e->getMessage() );
                }
 
+               # Create the l10n cache DB
+               try {
+                       $conn = Database::factory(
+                               'sqlite', [ 'dbname' => "{$db}_l10n_cache", 'dbDirectory' => $dir ] );
+                       # @todo: don't duplicate l10n_cache definition, though it's very simple
+                       $sql =
+<<<EOT
+       CREATE TABLE l10n_cache (
+               lc_lang BLOB NOT NULL,
+               lc_key TEXT NOT NULL,
+               lc_value BLOB NOT NULL,
+               PRIMARY KEY (lc_lang, lc_key)
+       );
+EOT;
+                       $conn->query( $sql );
+                       $conn->query( "PRAGMA journal_mode=WAL" ); // this is permanent
+                       $conn->close();
+               } catch ( DBConnectionError $e ) {
+                       return Status::newFatal( 'config-sqlite-connection-error', $e->getMessage() );
+               }
+
                # Open the main DB
                return $this->getConnection();
        }
@@ -330,6 +353,13 @@ EOT;
                'dbDirectory' => \$wgSQLiteDataDir,
                'flags' => 0
        ]
+];
+\$wgLocalisationCacheConf['storeServer'] = [
+       'type' => 'sqlite',
+       'dbname' => \"{\$wgDBname}_l10n_cache\",
+       'tablePrefix' => '',
+       'dbDirectory' => \$wgSQLiteDataDir,
+       'flags' => 0
 ];";
        }
 }