www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 302f0105bff1c29d75e00837bfb8f8814f075d8f
parent 0f8c3e7669bb882a6a1c0b7ccf74193619a08087
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 20 Sep 2006 02:15:49 +0000

Fixes #311, after deleting database, no new database is created

Well that probably would've been mildly frustrating for new users.


Diffstat:
Mchrome/chromeFiles/content/scholar/xpcom/db.js | 15+++++++++++++++
Mchrome/chromeFiles/content/scholar/xpcom/schema.js | 19-------------------
2 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/xpcom/db.js b/chrome/chromeFiles/content/scholar/xpcom/db.js @@ -394,6 +394,21 @@ Scholar.DB = new function(){ var file = Scholar.getScholarDatabase(); var backupFile = Scholar.getScholarDatabase('bak'); + if (SCHOLAR_CONFIG['DB_REBUILD']){ + if (confirm('Erase all user data and recreate database from schema?')){ + // Delete existing Zotero database + if (file.exists()){ + file.remove(null); + } + + // Delete existing storage folder + var dir = Scholar.getStorageDirectory(); + if (dir.exists()){ + dir.remove(true); + } + } + } + // DEBUG: Temporary check // Test the backup file (to make sure the backup mechanism is working) if (backupFile.exists()){ diff --git a/chrome/chromeFiles/content/scholar/xpcom/schema.js b/chrome/chromeFiles/content/scholar/xpcom/schema.js @@ -11,13 +11,6 @@ Scholar.Schema = new function(){ * Checks if the DB schema exists and is up-to-date, updating if necessary */ function updateSchema(){ - if (SCHOLAR_CONFIG['DB_REBUILD']){ - if (confirm('Erase all user data and recreate database from schema?')){ - _initializeSchema(); - return; - } - } - var dbVersion = _getDBVersion('user'); // 'schema' check is for old (<= 1.0b1) schema system @@ -277,18 +270,6 @@ Scholar.Schema = new function(){ * Create new DB schema */ function _initializeSchema(){ - // Delete existing Zotero database - var file = Scholar.getScholarDatabase(); - if (file.exists()){ - file.remove(null); - } - - // Delete existing storage folder - var dir = Scholar.getStorageDirectory(); - if (dir.exists()){ - dir.remove(true); - } - Scholar.DB.beginTransaction(); try { Scholar.DB.query(_getSchemaSQL('user'));