commit d3ddc03dc6d6f131247243690743b9465618f87e
parent 540abc70da357ef4d1b7ed4293d2cbc74f6e3e18
Author: Simon Kornblith <simon@simonster.com>
Date: Thu, 26 Jan 2012 23:44:21 -0500
Remove dbLockExclusive hidden preference
Diffstat:
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js
@@ -23,6 +23,11 @@
***** END LICENSE BLOCK *****
*/
+// Exclusive locking mode (default) prevents access to Zotero database while Firefox is open.
+// Normal mode is more convenient for development, but risks database corruption, particularly if
+// the same database is accessed simultaneously by multiple Zotero instances.
+const DB_LOCK_EXCLUSIVE = true;
+
Zotero.DBConnection = function(dbName) {
if (!dbName) {
throw ('DB name not provided in Zotero.DBConnection()');
@@ -869,10 +874,9 @@ Zotero.DBConnection.prototype.backupDatabase = function (suffix) {
// Turn off DB locking before backup and reenable after, since otherwise
// the lock is lost
- var dbLockExclusive = Zotero.Prefs.get('dbLockExclusive');
var hadDummyStatement = !!this._dummyStatement;
try {
- if (dbLockExclusive) {
+ if (DB_LOCK_EXCLUSIVE) {
this.query("PRAGMA locking_mode=NORMAL");
}
if (hadDummyStatement) {
@@ -889,7 +893,7 @@ Zotero.DBConnection.prototype.backupDatabase = function (suffix) {
return false;
}
finally {
- if (dbLockExclusive) {
+ if (DB_LOCK_EXCLUSIVE) {
this.query("PRAGMA locking_mode=EXCLUSIVE");
}
if (hadDummyStatement) {
@@ -1183,9 +1187,7 @@ Zotero.DBConnection.prototype._getDBConnection = function () {
throw (e);
}
- // Exclusive locking mode (default) prevents access to Zotero database
- // while Firefox is open -- normal mode is more convenient for development
- if (Zotero.Prefs.get('dbLockExclusive')) {
+ if (DB_LOCK_EXCLUSIVE) {
Zotero.DB.query("PRAGMA locking_mode=EXCLUSIVE");
}
else {
diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js
@@ -9,7 +9,6 @@ pref("extensions.zotero@chnm.gmu.edu.description", "chrome://zotero/locale/zoter
pref("extensions.zotero.useDataDir", false);
pref("extensions.zotero.dataDir", '');
pref("extensions.zotero.lastDataDir", '');
-pref("extensions.zotero.dbLockExclusive", true);
pref("extensions.zotero.debug.log",false);
pref("extensions.zotero.debug.stackTrace", false);
pref("extensions.zotero.debug.store",false);