(bug 20260) SQLite: don't always autocreate DB and its directory. If the file isn...
authorChad Horohoe <demon@users.mediawiki.org>
Sat, 29 Aug 2009 12:35:40 +0000 (12:35 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Sat, 29 Aug 2009 12:35:40 +0000 (12:35 +0000)
RELEASE-NOTES
includes/db/DatabaseSqlite.php

index d0a90ab..019ffe6 100644 (file)
@@ -438,6 +438,9 @@ this. Was used when mwEmbed was going to be an extension.
 * (bug 19055) maintenance/rebuildrecentchanges.php now purges
   Special:Recentchanges's RSS and Atom feed cache
 * The installer will now try to bypass PHP's max_execution_time
+* (bug 20260) SQLite no longer tries to automatically create the database at
+  execution time, this now happens only at install time; if it is not available 
+  at script execution, it now throws an exception
 
 == API changes in 1.16 ==
 
index 4514c2b..d48a705 100644 (file)
@@ -21,12 +21,12 @@ class DatabaseSqlite extends DatabaseBase {
         * Constructor
         */
        function __construct($server = false, $user = false, $password = false, $dbName = false, $failFunction = false, $flags = 0) {
-               global $wgSQLiteDataDir, $wgSQLiteDataDirMode;
-               if ("$wgSQLiteDataDir" == '') $wgSQLiteDataDir = dirname($_SERVER['DOCUMENT_ROOT']).'/data';
-               if (!is_dir($wgSQLiteDataDir)) wfMkdirParents( $wgSQLiteDataDir, $wgSQLiteDataDirMode );
+               global $wgSQLiteDataDir;
                $this->mFailFunction = $failFunction;
                $this->mFlags = $flags;
                $this->mDatabaseFile = "$wgSQLiteDataDir/$dbName.sqlite";
+               if( !is_readable( $this->mDatabaseFile ) )
+                       throw new DBConnectionError( $this, "SQLite database not accessible" );
                $this->mName = $dbName;
                $this->open($server, $user, $password, $dbName);
        }