commit ac7c22a7c6ad2678feacc0c57171375b8bc3cbfc
parent 9652b9f553eb87acf027caa2fe7cbc0f9e0e856c
Author: Dan Stillman <dstillman@zotero.org>
Date: Sun, 30 Jul 2017 00:04:33 -0400
Fix searches for PowerPoint files
This also adds a mechanism for indicating that DB userdata upgrades
after a certain version are minor and shouldn't show "Upgrading
database…" or create a pre-upgrade backup.
Diffstat:
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js
@@ -35,6 +35,10 @@ Zotero.Schema = new function(){
var _schemaUpdateDeferred = Zotero.Promise.defer();
this.schemaUpdatePromise = _schemaUpdateDeferred.promise;
+ // If updating from this userdata version or later, don't show "Upgrading database…" and don't make
+ // DB backup first. This should be set to false when breaking compatibility or making major changes.
+ const minorUpdateFrom = 95;
+
var _dbVersions = [];
var _schemaVersions = [];
// Update when adding _updateCompatibility() line to schema update step
@@ -131,9 +135,10 @@ Zotero.Schema = new function(){
);
var schemaVersion = yield _getSchemaSQLVersion('userdata');
+ options.minor = minorUpdateFrom && userdata >= minorUpdateFrom;
- // If upgrading userdata, make backup of database first
- if (userdata < schemaVersion) {
+ // If non-minor userdata upgrade, make backup of database first
+ if (userdata < schemaVersion && !options.minor) {
yield Zotero.DB.backupDatabase(userdata, true);
}
else if (integrityCheck) {
@@ -1909,7 +1914,7 @@ Zotero.Schema = new function(){
Zotero.debug('Updating user data tables from version ' + fromVersion + ' to ' + toVersion);
if (options.onBeforeUpdate) {
- let maybePromise = options.onBeforeUpdate()
+ let maybePromise = options.onBeforeUpdate({ minor: options.minor });
if (maybePromise && maybePromise.then) {
yield maybePromise;
}
@@ -2449,6 +2454,12 @@ Zotero.Schema = new function(){
else if (i == 95) {
yield Zotero.DB.queryAsync("DELETE FROM publicationsItems WHERE itemID NOT IN (SELECT itemID FROM items WHERE libraryID=1)");
}
+
+ else if (i == 96) {
+ yield Zotero.DB.queryAsync("REPLACE INTO fileTypeMIMETypes VALUES(7, 'application/vnd.ms-powerpoint')");
+ }
+
+ // If breaking compatibility or doing anything dangerous, clear minorUpdateFrom
}
yield _updateDBVersion('userdata', toVersion);
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -618,7 +618,8 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
try {
var updated = yield Zotero.Schema.updateSchema({
- onBeforeUpdate: () => {
+ onBeforeUpdate: (options = {}) => {
+ if (options.minor) return;
try {
Zotero.showZoteroPaneProgressMeter(
Zotero.getString('upgrade.status')
diff --git a/resource/schema/system.sql b/resource/schema/system.sql
@@ -1223,6 +1223,7 @@ INSERT INTO "fileTypeMIMETypes" VALUES(6, 'application/vnd.oasis.opendocument.te
INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/powerpoint');
INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/vnd.oasis.opendocument.presentation');
INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/x-kpresenter');
+INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/vnd.ms-powerpoint');
INSERT INTO "syncObjectTypes" VALUES(1, 'collection');
INSERT INTO "syncObjectTypes" VALUES(2, 'creator');
diff --git a/resource/schema/userdata.sql b/resource/schema/userdata.sql
@@ -1,4 +1,4 @@
--- 95
+-- 96
-- Copyright (c) 2009 Center for History and New Media
-- George Mason University, Fairfax, Virginia, USA