Upgraded SabreDAV
This commit is contained in:
parent
519237b553
commit
27d8a79613
3 changed files with 137 additions and 2 deletions
|
@ -24,5 +24,5 @@
|
|||
# This copyright notice MUST APPEAR in all copies of the script!
|
||||
#################################################################
|
||||
|
||||
define("BAIKAL_VERSION", "0.5.0");
|
||||
define("BAIKAL_VERSION", "0.5.1");
|
||||
define("BAIKAL_HOMEPAGE", "http://sabre.io/baikal/");
|
||||
|
|
|
@ -377,6 +377,141 @@ CREATE TABLE addressbooks (
|
|||
}
|
||||
|
||||
}
|
||||
if (version_compare($sVersionFrom, '0.5.1', '<')) {
|
||||
if (!defined("PROJECT_DB_MYSQL") || PROJECT_DB_MYSQL === false) {
|
||||
$pdo->exec(<<<SQL
|
||||
CREATE TABLE calendarinstances (
|
||||
id integer primary key asc NOT NULL,
|
||||
calendarid integer,
|
||||
principaluri text,
|
||||
access integer COMMENT '1 = owner, 2 = read, 3 = readwrite' NOT NULL DEFAULT '1',
|
||||
displayname text,
|
||||
uri text NOT NULL,
|
||||
description text,
|
||||
calendarorder integer,
|
||||
calendarcolor text,
|
||||
timezone text,
|
||||
transparent bool,
|
||||
share_href text,
|
||||
share_displayname text,
|
||||
share_invitestatus integer DEFAULT '2',
|
||||
UNIQUE (principaluri, uri),
|
||||
UNIQUE (calendarid, principaluri),
|
||||
UNIQUE (calendarid, share_href)
|
||||
);
|
||||
SQL
|
||||
);
|
||||
$this->aSuccess[] = 'Created calendarinstances table';
|
||||
$pdo->exec('
|
||||
INSERT INTO calendarinstances
|
||||
(
|
||||
calendarid,
|
||||
principaluri,
|
||||
access,
|
||||
displayname,
|
||||
uri,
|
||||
description,
|
||||
calendarorder,
|
||||
calendarcolor,
|
||||
transparent
|
||||
)
|
||||
SELECT
|
||||
id,
|
||||
principaluri,
|
||||
1,
|
||||
displayname,
|
||||
uri,
|
||||
description,
|
||||
calendarorder,
|
||||
calendarcolor,
|
||||
transparent
|
||||
FROM calendars
|
||||
');
|
||||
$this->aSuccess[] = 'Migrated calendarinstances table';
|
||||
$calendarBackup = 'calendars_3_1';
|
||||
$pdo->exec('ALTER TABLE calendars RENAME TO '.$calendarBackup);
|
||||
$this->aSuccess[] = 'Did calendars backup';
|
||||
|
||||
$pdo->exec(<<<SQL
|
||||
CREATE TABLE calendars (
|
||||
id integer primary key asc NOT NULL,
|
||||
synctoken integer DEFAULT 1 NOT NULL,
|
||||
components text NOT NULL
|
||||
);
|
||||
SQL
|
||||
);
|
||||
$this->aSuccess[] = 'Created new calendars table';
|
||||
} else { // mysql
|
||||
$pdo->exec(<<<SQL
|
||||
CREATE TABLE calendarinstances (
|
||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
calendarid INTEGER UNSIGNED NOT NULL,
|
||||
principaluri VARBINARY(100),
|
||||
access TINYINT(1) NOT NULL DEFAULT '1' COMMENT '1 = owner, 2 = read, 3 = readwrite',
|
||||
displayname VARCHAR(100),
|
||||
uri VARBINARY(200),
|
||||
description TEXT,
|
||||
calendarorder INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
calendarcolor VARBINARY(10),
|
||||
timezone TEXT,
|
||||
transparent TINYINT(1) NOT NULL DEFAULT '0',
|
||||
share_href VARBINARY(100),
|
||||
share_displayname VARCHAR(100),
|
||||
share_invitestatus TINYINT(1) NOT NULL DEFAULT '2' COMMENT '1 = noresponse, 2 = accepted, 3 = declined, 4 = invalid',
|
||||
UNIQUE(principaluri, uri),
|
||||
UNIQUE(calendarid, principaluri),
|
||||
UNIQUE(calendarid, share_href)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
SQL
|
||||
);
|
||||
$this->aSuccess[] = 'Created calendarinstances table';
|
||||
$pdo->exec('
|
||||
INSERT INTO calendarinstances
|
||||
(
|
||||
calendarid,
|
||||
principaluri,
|
||||
access,
|
||||
displayname,
|
||||
uri,
|
||||
description,
|
||||
calendarorder,
|
||||
calendarcolor,
|
||||
transparent
|
||||
)
|
||||
SELECT
|
||||
id,
|
||||
principaluri,
|
||||
1,
|
||||
displayname,
|
||||
uri,
|
||||
description,
|
||||
calendarorder,
|
||||
calendarcolor,
|
||||
transparent
|
||||
FROM calendars
|
||||
');
|
||||
$this->aSuccess[] = 'Migrated calendarinstances table';
|
||||
$calendarBackup = 'calendars_3_1';
|
||||
$pdo->exec('RENAME TABLE calendars TO '.$calendarBackup);
|
||||
$this->aSuccess[] = 'Did calendars backup';
|
||||
|
||||
$pdo->exec(<<<SQL
|
||||
CREATE TABLE calendars (
|
||||
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
synctoken INTEGER UNSIGNED NOT NULL DEFAULT '1',
|
||||
components VARBINARY(21)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
SQL
|
||||
);
|
||||
$this->aSuccess[] = 'Created new calendars table';
|
||||
}
|
||||
|
||||
$pdo->exec(<<<SQL
|
||||
INSERT INTO calendars (id, synctoken, components) SELECT id, synctoken, COALESCE(components,"VEVENT,VTODO,VJOURNAL") as components FROM $calendarBackup
|
||||
SQL
|
||||
);
|
||||
$this->aSuccess[] = 'Migrated calendars table';
|
||||
}
|
||||
|
||||
|
||||
$this->updateConfiguredVersion($sVersionTo);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
],
|
||||
"require": {
|
||||
"php" : ">=5.5",
|
||||
"sabre/dav" : "~3.1.2",
|
||||
"sabre/dav" : "~3.2.3",
|
||||
"twig/twig" : "~1.8.0"
|
||||
},
|
||||
"require-dev" : {
|
||||
|
|
Loading…
Reference in a new issue