Last modified: 2009-08-29 12:35:59 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T22260, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 20260 - SQLite: don't always autocreate DB and its directory
SQLite: don't always autocreate DB and its directory
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.16.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: sqlite
  Show dependency treegraph
 
Reported: 2009-08-15 13:08 UTC by Max Semenik
Modified: 2009-08-29 12:35 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Max Semenik 2009-08-15 13:08:17 UTC
Currently $wgSQLiteDataDir is created not only by installer, but also by DatabaseSqlite::__construct, and the database file is silently created if it does not exists, which leads to a few problems:
1) If $wgSQLiteDataDir is empty, the directory defaults to dirname($_SERVER['DOCUMENT_ROOT']).'/data'. However, if MediaWiki is not installed in the document root, the data directory will be different for web scripts and command line maintenance scripts, which will fail with cryptic SQL errors.
2) If the database file is inaccessible to MW post-install, it will be transparently recreated and pageviews will result in SQL error messages. An equivalent of MySQL's "Can't contact database server" would be much more appropriate.

So my proposal is to check DB file accessibility in DatabaseSqlite constructor, and throw exceptions instead of creating useless empty databases. This should also result in deprecation $wgSQLiteDataDirMode, as this value should and needs to be specified by user during installation once and forever.
Comment 1 Chad H. 2009-08-29 12:35:59 UTC
Done in r55669.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links