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
|
@ -35,6 +35,10 @@ Zotero.Schema = new function(){
|
||||||
var _schemaUpdateDeferred = Zotero.Promise.defer();
|
var _schemaUpdateDeferred = Zotero.Promise.defer();
|
||||||
this.schemaUpdatePromise = _schemaUpdateDeferred.promise;
|
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 _dbVersions = [];
|
||||||
var _schemaVersions = [];
|
var _schemaVersions = [];
|
||||||
// Update when adding _updateCompatibility() line to schema update step
|
// Update when adding _updateCompatibility() line to schema update step
|
||||||
|
@ -131,9 +135,10 @@ Zotero.Schema = new function(){
|
||||||
);
|
);
|
||||||
|
|
||||||
var schemaVersion = yield _getSchemaSQLVersion('userdata');
|
var schemaVersion = yield _getSchemaSQLVersion('userdata');
|
||||||
|
options.minor = minorUpdateFrom && userdata >= minorUpdateFrom;
|
||||||
|
|
||||||
// If upgrading userdata, make backup of database first
|
// If non-minor userdata upgrade, make backup of database first
|
||||||
if (userdata < schemaVersion) {
|
if (userdata < schemaVersion && !options.minor) {
|
||||||
yield Zotero.DB.backupDatabase(userdata, true);
|
yield Zotero.DB.backupDatabase(userdata, true);
|
||||||
}
|
}
|
||||||
else if (integrityCheck) {
|
else if (integrityCheck) {
|
||||||
|
@ -1909,7 +1914,7 @@ Zotero.Schema = new function(){
|
||||||
Zotero.debug('Updating user data tables from version ' + fromVersion + ' to ' + toVersion);
|
Zotero.debug('Updating user data tables from version ' + fromVersion + ' to ' + toVersion);
|
||||||
|
|
||||||
if (options.onBeforeUpdate) {
|
if (options.onBeforeUpdate) {
|
||||||
let maybePromise = options.onBeforeUpdate()
|
let maybePromise = options.onBeforeUpdate({ minor: options.minor });
|
||||||
if (maybePromise && maybePromise.then) {
|
if (maybePromise && maybePromise.then) {
|
||||||
yield maybePromise;
|
yield maybePromise;
|
||||||
}
|
}
|
||||||
|
@ -2449,6 +2454,12 @@ Zotero.Schema = new function(){
|
||||||
else if (i == 95) {
|
else if (i == 95) {
|
||||||
yield Zotero.DB.queryAsync("DELETE FROM publicationsItems WHERE itemID NOT IN (SELECT itemID FROM items WHERE libraryID=1)");
|
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);
|
yield _updateDBVersion('userdata', toVersion);
|
||||||
|
|
|
@ -618,7 +618,8 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var updated = yield Zotero.Schema.updateSchema({
|
var updated = yield Zotero.Schema.updateSchema({
|
||||||
onBeforeUpdate: () => {
|
onBeforeUpdate: (options = {}) => {
|
||||||
|
if (options.minor) return;
|
||||||
try {
|
try {
|
||||||
Zotero.showZoteroPaneProgressMeter(
|
Zotero.showZoteroPaneProgressMeter(
|
||||||
Zotero.getString('upgrade.status')
|
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/powerpoint');
|
||||||
INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/vnd.oasis.opendocument.presentation');
|
INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/vnd.oasis.opendocument.presentation');
|
||||||
INSERT INTO "fileTypeMIMETypes" VALUES(7, 'application/x-kpresenter');
|
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(1, 'collection');
|
||||||
INSERT INTO "syncObjectTypes" VALUES(2, 'creator');
|
INSERT INTO "syncObjectTypes" VALUES(2, 'creator');
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- 95
|
-- 96
|
||||||
|
|
||||||
-- Copyright (c) 2009 Center for History and New Media
|
-- Copyright (c) 2009 Center for History and New Media
|
||||||
-- George Mason University, Fairfax, Virginia, USA
|
-- George Mason University, Fairfax, Virginia, USA
|
||||||
|
|
Loading…
Reference in New Issue
Block a user