diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a8a862..5b2668d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ ChangeLog ========= +0.4.0 (????-??-??) +------------------ + +* #472: If you were using Sqlite, Cal- CardDAV clients might have missed + updates from the server. + + 0.3.5 (2016-02-24) ------------------ diff --git a/Core/Distrib.php b/Core/Distrib.php index 0c45bef..47ce1d3 100644 --- a/Core/Distrib.php +++ b/Core/Distrib.php @@ -24,5 +24,5 @@ # This copyright notice MUST APPEAR in all copies of the script! ################################################################# -define("BAIKAL_VERSION", "0.3.5"); +define("BAIKAL_VERSION", "0.4.0"); define("BAIKAL_HOMEPAGE", "http://baikal-server.com"); diff --git a/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php b/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php index 230e71b..6978d35 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php @@ -151,9 +151,10 @@ HTML; } } + $pdo = $GLOBALS['DB']->getPDO(); if(version_compare($sVersionFrom, '0.3.0', '<')) { // Upgrading from sabre/dav 1.8 schema to 3.1 schema. - $pdo = $GLOBALS['DB']->getPDO(); + if(defined("PROJECT_DB_MYSQL") && PROJECT_DB_MYSQL === TRUE) { // MySQL upgrade @@ -377,6 +378,54 @@ HTML; $this->aSuccess[] = 'vcardurl was migrated to the propertystorage system'; } + if(version_compare($sVersionFrom, '0.4.0', '<')) { + + // The sqlite schema had issues with both the calendar and + // addressbooks tables. The tables didn't have a DEFAULT '1' for + // the synctoken column. So we're adding it now. + if(!defined("PROJECT_DB_MYSQL") || PROJECT_DB_MYSQL === FALSE) { + + $pdo->exec('UPDATE calendars SET synctoken = 1 WHERE synctoken IS NULL'); + $pdo->exec('UPDATE addressbooks SET synctoken = 1 WHERE synctoken IS NULL'); + + $tmpTable = '_' . time(); + $pdo->exec('ALTER TABLE calendars RENAME TO calendars' . $tmpTable); + $pdo->exec('ALTER TABLE addressbooks RENAME TO addressbooks' . $tmpTable); + + $pdo->exec(' +CREATE TABLE addressbooks ( + id integer primary key asc NOT NULL, + principaluri text NOT NULL, + displayname text, + uri text NOT NULL, + description text, + synctoken integer DEFAULT 1 NOT NULL +); + '); + + $pdo->exec(' +CREATE TABLE calendars ( + id integer primary key asc NOT NULL, + principaluri text NOT NULL, + displayname text, + uri text NOT NULL, + synctoken integer DEFAULT 1 NOT NULL, + description text, + calendarorder integer, + calendarcolor text, + timezone text, + components text NOT NULL, + transparent bool +);'); + + $pdo->exec('INSERT INTO calendars SELECT * FROM calendars' . $tmpTable); + $pdo->exec('INSERT INTO addressbooks SELECT * FROM addressbooks' . $tmpTable); + + $this->aSuccess[] = 'Updated calendars and addressbooks tables'; + + } + + } $this->updateConfiguredVersion($sVersionTo); return TRUE;