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.
This commit is contained in:
parent
9652b9f553
commit
ac7c22a7c6
4 changed files with 18 additions and 5 deletions
|
@ -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);
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- 95
|
||||
-- 96
|
||||
|
||||
-- Copyright (c) 2009 Center for History and New Media
|
||||
-- George Mason University, Fairfax, Virginia, USA
|
||||
|
|
Loading…
Reference in a new issue