From: Chad Horohoe Date: Sat, 29 Aug 2009 12:35:40 +0000 (+0000) Subject: (bug 20260) SQLite: don't always autocreate DB and its directory. If the file isn... X-Git-Tag: 1.31.0-rc.0~40002 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=4cdc449d9042418e1a804bbcfa2c89d1d0e41ef2;p=lhc%2Fweb%2Fwiklou.git (bug 20260) SQLite: don't always autocreate DB and its directory. If the file isn't readable at execution time, we now throw an exception --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d0a90abf97..019ffe67ff 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 4514c2b6f0..d48a705615 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -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); }