aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/bin
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/bin')
-rw-r--r--vendor/sabre/dav/bin/build.php88
-rw-r--r--vendor/sabre/dav/bin/migrateto20.php152
-rw-r--r--vendor/sabre/dav/bin/migrateto21.php36
-rw-r--r--vendor/sabre/dav/bin/migrateto30.php44
-rw-r--r--vendor/sabre/dav/bin/migrateto32.php54
-rw-r--r--vendor/sabre/dav/bin/sabredav.php26
6 files changed, 162 insertions, 238 deletions
diff --git a/vendor/sabre/dav/bin/build.php b/vendor/sabre/dav/bin/build.php
index c4ba20941..54174a777 100644
--- a/vendor/sabre/dav/bin/build.php
+++ b/vendor/sabre/dav/bin/build.php
@@ -2,7 +2,6 @@
<?php
$tasks = [
-
'buildzip' => [
'init', 'test', 'clean',
],
@@ -10,25 +9,29 @@ $tasks = [
'init', 'test', 'clean',
],
'clean' => [],
- 'test' => [
+ 'test' => [
'composerupdate',
],
- 'init' => [],
+ 'init' => [],
'composerupdate' => [],
];
$default = 'buildzip';
-$baseDir = __DIR__ . '/../';
+$baseDir = __DIR__.'/../';
chdir($baseDir);
$currentTask = $default;
-if ($argc > 1) $currentTask = $argv[1];
+if ($argc > 1) {
+ $currentTask = $argv[1];
+}
$version = null;
-if ($argc > 2) $version = $argv[2];
+if ($argc > 2) {
+ $version = $argv[2];
+}
if (!isset($tasks[$currentTask])) {
- echo "Task not found: ", $currentTask, "\n";
+ echo 'Task not found: ', $currentTask, "\n";
die(1);
}
@@ -37,11 +40,9 @@ $newTaskList = [];
$oldTaskList = [$currentTask => true];
while (count($oldTaskList) > 0) {
-
foreach ($oldTaskList as $task => $foo) {
-
if (!isset($tasks[$task])) {
- echo "Dependency not found: " . $task, "\n";
+ echo 'Dependency not found: '.$task, "\n";
die(1);
}
$dependencies = $tasks[$task];
@@ -55,82 +56,74 @@ while (count($oldTaskList) > 0) {
$oldTaskList[$dependency] = true;
$fullFilled = false;
}
-
}
if ($fullFilled) {
unset($oldTaskList[$task]);
$newTaskList[$task] = 1;
}
-
}
-
}
foreach (array_keys($newTaskList) as $task) {
-
- echo "task: " . $task, "\n";
+ echo 'task: '.$task, "\n";
call_user_func($task);
echo "\n";
-
}
-function init() {
-
+function init()
+{
global $version;
if (!$version) {
- include __DIR__ . '/../vendor/autoload.php';
+ include __DIR__.'/../vendor/autoload.php';
$version = Sabre\DAV\Version::VERSION;
}
- echo " Building sabre/dav " . $version, "\n";
-
+ echo ' Building sabre/dav '.$version, "\n";
}
-function clean() {
-
+function clean()
+{
global $baseDir;
echo " Removing build files\n";
- $outputDir = $baseDir . '/build/SabreDAV';
+ $outputDir = $baseDir.'/build/SabreDAV';
if (is_dir($outputDir)) {
- system('rm -r ' . $baseDir . '/build/SabreDAV');
+ system('rm -r '.$baseDir.'/build/SabreDAV');
}
-
}
-function composerupdate() {
-
+function composerupdate()
+{
global $baseDir;
echo " Updating composer packages to latest version\n\n";
- system('cd ' . $baseDir . '; composer update');
+ system('cd '.$baseDir.'; composer update');
}
-function test() {
-
+function test()
+{
global $baseDir;
echo " Running all unittests.\n";
echo " This may take a while.\n\n";
- system(__DIR__ . '/phpunit --configuration ' . $baseDir . '/tests/phpunit.xml.dist --stop-on-failure', $code);
- if ($code != 0) {
+ system(__DIR__.'/phpunit --configuration '.$baseDir.'/tests/phpunit.xml.dist --stop-on-failure', $code);
+ if (0 != $code) {
echo "PHPUnit reported error code $code\n";
die(1);
}
-
}
-function buildzip() {
-
+function buildzip()
+{
global $baseDir, $version;
echo " Generating composer.json\n";
- $input = json_decode(file_get_contents(__DIR__ . '/../composer.json'), true);
+ $input = json_decode(file_get_contents(__DIR__.'/../composer.json'), true);
$newComposer = [
- "require" => $input['require'],
- "config" => [
- "bin-dir" => "./bin",
+ 'require' => $input['require'],
+ 'config' => [
+ 'bin-dir' => './bin',
],
- "prefer-stable" => true,
- "minimum-stability" => "alpha",
+ 'prefer-stable' => true,
+ 'minimum-stability' => 'alpha',
];
unset(
$newComposer['require']['sabre/vobject'],
@@ -143,8 +136,8 @@ function buildzip() {
file_put_contents('build/SabreDAV/composer.json', json_encode($newComposer, JSON_PRETTY_PRINT));
echo " Downloading dependencies\n";
- system("cd build/SabreDAV; composer install -n", $code);
- if ($code !== 0) {
+ system('cd build/SabreDAV; composer install -n', $code);
+ if (0 !== $code) {
echo "Composer reported error code $code\n";
die(1);
}
@@ -163,15 +156,14 @@ function buildzip() {
];
foreach ($fileNames as $fileName) {
echo " $fileName\n";
- rename('build/SabreDAV/vendor/sabre/dav/' . $fileName, 'build/SabreDAV/' . $fileName);
+ rename('build/SabreDAV/vendor/sabre/dav/'.$fileName, 'build/SabreDAV/'.$fileName);
}
// <zip destfile="build/SabreDAV-${sabredav.version}.zip" basedir="build/SabreDAV" prefix="SabreDAV/" />
echo "\n";
echo "Zipping the sabredav distribution\n\n";
- system('cd build; zip -qr sabredav-' . $version . '.zip SabreDAV');
-
- echo "Done.";
+ system('cd build; zip -qr sabredav-'.$version.'.zip SabreDAV');
+ echo 'Done.';
}
diff --git a/vendor/sabre/dav/bin/migrateto20.php b/vendor/sabre/dav/bin/migrateto20.php
index 77236804f..c7a8d9e35 100644
--- a/vendor/sabre/dav/bin/migrateto20.php
+++ b/vendor/sabre/dav/bin/migrateto20.php
@@ -4,7 +4,6 @@
echo "SabreDAV migrate script for version 2.0\n";
if ($argc < 2) {
-
echo <<<HELLO
This script help you migrate from a pre-2.0 database to 2.0 and later
@@ -36,14 +35,13 @@ php {$argv[0]} sqlite:data/sabredav.db
HELLO;
exit();
-
}
// There's a bunch of places where the autoloader could be, so we'll try all of
// them.
$paths = [
- __DIR__ . '/../vendor/autoload.php',
- __DIR__ . '/../../../autoload.php',
+ __DIR__.'/../vendor/autoload.php',
+ __DIR__.'/../../../autoload.php',
];
foreach ($paths as $path) {
@@ -57,7 +55,7 @@ $dsn = $argv[1];
$user = isset($argv[2]) ? $argv[2] : null;
$pass = isset($argv[3]) ? $argv[3] : null;
-echo "Connecting to database: " . $dsn . "\n";
+echo 'Connecting to database: '.$dsn."\n";
$pdo = new PDO($dsn, $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@@ -66,23 +64,21 @@ $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$driver = $pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
switch ($driver) {
-
- case 'mysql' :
+ case 'mysql':
echo "Detected MySQL.\n";
break;
- case 'sqlite' :
+ case 'sqlite':
echo "Detected SQLite.\n";
break;
- default :
- echo "Error: unsupported driver: " . $driver . "\n";
+ default:
+ echo 'Error: unsupported driver: '.$driver."\n";
die(-1);
}
foreach (['calendar', 'addressbook'] as $itemType) {
-
- $tableName = $itemType . 's';
- $tableNameOld = $tableName . '_old';
- $changesTable = $itemType . 'changes';
+ $tableName = $itemType.'s';
+ $tableNameOld = $tableName.'_old';
+ $changesTable = $itemType.'changes';
echo "Upgrading '$tableName'\n";
@@ -90,18 +86,16 @@ foreach (['calendar', 'addressbook'] as $itemType) {
$row = $pdo->query("SELECT * FROM $tableName LIMIT 1")->fetch();
if (!$row) {
-
echo "No records were found in the '$tableName' table.\n";
echo "\n";
echo "We're going to rename the old table to $tableNameOld (just in case).\n";
echo "and re-create the new table.\n";
switch ($driver) {
-
- case 'mysql' :
+ case 'mysql':
$pdo->exec("RENAME TABLE $tableName TO $tableNameOld");
switch ($itemType) {
- case 'calendar' :
+ case 'calendar':
$pdo->exec("
CREATE TABLE calendars (
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
@@ -119,7 +113,7 @@ foreach (['calendar', 'addressbook'] as $itemType) {
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
");
break;
- case 'addressbook' :
+ case 'addressbook':
$pdo->exec("
CREATE TABLE addressbooks (
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
@@ -135,13 +129,13 @@ foreach (['calendar', 'addressbook'] as $itemType) {
}
break;
- case 'sqlite' :
+ case 'sqlite':
$pdo->exec("ALTER TABLE $tableName RENAME TO $tableNameOld");
switch ($itemType) {
- case 'calendar' :
- $pdo->exec("
+ case 'calendar':
+ $pdo->exec('
CREATE TABLE calendars (
id integer primary key asc,
principaluri text,
@@ -155,10 +149,10 @@ foreach (['calendar', 'addressbook'] as $itemType) {
components text,
transparent bool
);
- ");
+ ');
break;
- case 'addressbook' :
- $pdo->exec("
+ case 'addressbook':
+ $pdo->exec('
CREATE TABLE addressbooks (
id integer primary key asc,
principaluri text,
@@ -167,45 +161,37 @@ foreach (['calendar', 'addressbook'] as $itemType) {
description text,
synctoken integer
);
- ");
+ ');
break;
}
break;
-
}
echo "Creation of 2.0 $tableName table is complete\n";
-
} else {
-
// Checking if there's a synctoken field already.
if (array_key_exists('synctoken', $row)) {
echo "The 'synctoken' field already exists in the $tableName table.\n";
echo "It's likely you already upgraded, so we're simply leaving\n";
echo "the $tableName table alone\n";
} else {
-
echo "1.8 table schema detected\n";
switch ($driver) {
-
- case 'mysql' :
+ case 'mysql':
$pdo->exec("ALTER TABLE $tableName ADD synctoken INT(11) UNSIGNED NOT NULL DEFAULT '1'");
$pdo->exec("ALTER TABLE $tableName DROP ctag");
$pdo->exec("UPDATE $tableName SET synctoken = '1'");
break;
- case 'sqlite' :
+ case 'sqlite':
$pdo->exec("ALTER TABLE $tableName ADD synctoken integer");
$pdo->exec("UPDATE $tableName SET synctoken = '1'");
echo "Note: there's no easy way to remove fields in sqlite.\n";
echo "The ctag field is no longer used, but it's kept in place\n";
break;
-
}
echo "Upgraded '$tableName' to 2.0 schema.\n";
-
}
-
}
try {
@@ -213,13 +199,11 @@ foreach (['calendar', 'addressbook'] as $itemType) {
echo "'$changesTable' already exists. Assuming that this part of the\n";
echo "upgrade was already completed.\n";
-
} catch (Exception $e) {
echo "Creating '$changesTable' table.\n";
switch ($driver) {
-
- case 'mysql' :
+ case 'mysql':
$pdo->exec("
CREATE TABLE $changesTable (
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
@@ -232,7 +216,7 @@ foreach (['calendar', 'addressbook'] as $itemType) {
");
break;
- case 'sqlite' :
+ case 'sqlite':
$pdo->exec("
CREATE TABLE $changesTable (
@@ -246,25 +230,20 @@ foreach (['calendar', 'addressbook'] as $itemType) {
");
$pdo->exec("CREATE INDEX {$itemType}id_synctoken ON $changesTable ({$itemType}id, synctoken);");
break;
-
}
-
}
-
}
try {
- $pdo->query("SELECT * FROM calendarsubscriptions LIMIT 1");
+ $pdo->query('SELECT * FROM calendarsubscriptions LIMIT 1');
echo "'calendarsubscriptions' already exists. Assuming that this part of the\n";
echo "upgrade was already completed.\n";
-
} catch (Exception $e) {
echo "Creating calendarsubscriptions table.\n";
switch ($driver) {
-
- case 'mysql' :
+ case 'mysql':
$pdo->exec("
CREATE TABLE calendarsubscriptions (
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
@@ -283,8 +262,8 @@ CREATE TABLE calendarsubscriptions (
);
");
break;
- case 'sqlite' :
- $pdo->exec("
+ case 'sqlite':
+ $pdo->exec('
CREATE TABLE calendarsubscriptions (
id integer primary key asc,
@@ -300,64 +279,57 @@ CREATE TABLE calendarsubscriptions (
stripattachments bool,
lastmodified int
);
- ");
+ ');
- $pdo->exec("CREATE INDEX principaluri_uri ON calendarsubscriptions (principaluri, uri);");
+ $pdo->exec('CREATE INDEX principaluri_uri ON calendarsubscriptions (principaluri, uri);');
break;
-
}
-
}
try {
- $pdo->query("SELECT * FROM propertystorage LIMIT 1");
+ $pdo->query('SELECT * FROM propertystorage LIMIT 1');
echo "'propertystorage' already exists. Assuming that this part of the\n";
echo "upgrade was already completed.\n";
-
} catch (Exception $e) {
echo "Creating propertystorage table.\n";
switch ($driver) {
-
- case 'mysql' :
- $pdo->exec("
+ case 'mysql':
+ $pdo->exec('
CREATE TABLE propertystorage (
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
path VARBINARY(1024) NOT NULL,
name VARBINARY(100) NOT NULL,
value MEDIUMBLOB
);
- ");
- $pdo->exec("
+ ');
+ $pdo->exec('
CREATE UNIQUE INDEX path_property ON propertystorage (path(600), name(100));
- ");
+ ');
break;
- case 'sqlite' :
- $pdo->exec("
+ case 'sqlite':
+ $pdo->exec('
CREATE TABLE propertystorage (
id integer primary key asc,
path TEXT,
name TEXT,
value TEXT
);
- ");
- $pdo->exec("
+ ');
+ $pdo->exec('
CREATE UNIQUE INDEX path_property ON propertystorage (path, name);
- ");
+ ');
break;
-
}
-
}
echo "Upgrading cards table to 2.0 schema\n";
try {
-
$create = false;
- $row = $pdo->query("SELECT * FROM cards LIMIT 1")->fetch();
+ $row = $pdo->query('SELECT * FROM cards LIMIT 1')->fetch();
if (!$row) {
$random = mt_rand(1000, 9999);
echo "There was no data in the cards table, so we're re-creating it\n";
@@ -366,28 +338,24 @@ try {
$create = true;
switch ($driver) {
- case 'mysql' :
+ case 'mysql':
$pdo->exec("RENAME TABLE cards TO cards_old$random");
break;
- case 'sqlite' :
+ case 'sqlite':
$pdo->exec("ALTER TABLE cards RENAME TO cards_old$random");
break;
-
}
}
-
} catch (Exception $e) {
-
echo "Exception while checking cards table. Assuming that the table does not yet exist.\n";
- echo "Debug: ", $e->getMessage(), "\n";
+ echo 'Debug: ', $e->getMessage(), "\n";
$create = true;
-
}
if ($create) {
switch ($driver) {
- case 'mysql' :
- $pdo->exec("
+ case 'mysql':
+ $pdo->exec('
CREATE TABLE cards (
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
addressbookid INT(11) UNSIGNED NOT NULL,
@@ -398,12 +366,12 @@ CREATE TABLE cards (
size INT(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- ");
+ ');
break;
- case 'sqlite' :
+ case 'sqlite':
- $pdo->exec("
+ $pdo->exec('
CREATE TABLE cards (
id integer primary key asc,
addressbookid integer,
@@ -413,28 +381,26 @@ CREATE TABLE cards (
etag text,
size integer
);
- ");
+ ');
break;
-
}
} else {
switch ($driver) {
- case 'mysql' :
- $pdo->exec("
+ case 'mysql':
+ $pdo->exec('
ALTER TABLE cards
ADD etag VARBINARY(32),
ADD size INT(11) UNSIGNED NOT NULL;
- ");
+ ');
break;
- case 'sqlite' :
+ case 'sqlite':
- $pdo->exec("
+ $pdo->exec('
ALTER TABLE cards ADD etag text;
ALTER TABLE cards ADD size integer;
- ");
+ ');
break;
-
}
echo "Reading all old vcards and populating etag and size fields.\n";
$result = $pdo->query('SELECT id, carddata FROM cards');
@@ -443,11 +409,9 @@ CREATE TABLE cards (
$stmt->execute([
md5($row['carddata']),
strlen($row['carddata']),
- $row['id']
+ $row['id'],
]);
}
-
-
}
echo "Upgrade to 2.0 schema completed.\n";
diff --git a/vendor/sabre/dav/bin/migrateto21.php b/vendor/sabre/dav/bin/migrateto21.php
index c81ee5cca..909643583 100644
--- a/vendor/sabre/dav/bin/migrateto21.php
+++ b/vendor/sabre/dav/bin/migrateto21.php
@@ -4,7 +4,6 @@
echo "SabreDAV migrate script for version 2.1\n";
if ($argc < 2) {
-
echo <<<HELLO
This script help you migrate from a pre-2.1 database to 2.1.
@@ -37,14 +36,13 @@ php {$argv[0]} sqlite:data/sabredav.db
HELLO;
exit();
-
}
// There's a bunch of places where the autoloader could be, so we'll try all of
// them.
$paths = [
- __DIR__ . '/../vendor/autoload.php',
- __DIR__ . '/../../../autoload.php',
+ __DIR__.'/../vendor/autoload.php',
+ __DIR__.'/../../../autoload.php',
];
foreach ($paths as $path) {
@@ -58,7 +56,7 @@ $dsn = $argv[1];
$user = isset($argv[2]) ? $argv[2] : null;
$pass = isset($argv[3]) ? $argv[3] : null;
-echo "Connecting to database: " . $dsn . "\n";
+echo 'Connecting to database: '.$dsn."\n";
$pdo = new PDO($dsn, $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@@ -67,15 +65,14 @@ $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$driver = $pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
switch ($driver) {
-
- case 'mysql' :
+ case 'mysql':
echo "Detected MySQL.\n";
break;
- case 'sqlite' :
+ case 'sqlite':
echo "Detected SQLite.\n";
break;
- default :
- echo "Error: unsupported driver: " . $driver . "\n";
+ default:
+ echo 'Error: unsupported driver: '.$driver."\n";
die(-1);
}
@@ -95,19 +92,17 @@ try {
echo "2.0 schema detected.\n";
$addUid = true;
}
-
} catch (Exception $e) {
echo "Could not find a calendarobjects table. Skipping this part of the\n";
echo "upgrade.\n";
}
if ($addUid) {
-
switch ($driver) {
- case 'mysql' :
+ case 'mysql':
$pdo->exec('ALTER TABLE calendarobjects ADD uid VARCHAR(200)');
break;
- case 'sqlite' :
+ case 'sqlite':
$pdo->exec('ALTER TABLE calendarobjects ADD uid TEXT');
break;
}
@@ -117,7 +112,6 @@ if ($addUid) {
$counter = 0;
while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
-
try {
$vobj = \Sabre\VObject\Reader::read($row['calendardata']);
} catch (\Exception $e) {
@@ -130,19 +124,16 @@ if ($addUid) {
echo "Warning! Item with id $item[id] does NOT have a UID property and this is required.\n";
continue;
}
- $uid = (string)$item->UID;
+ $uid = (string) $item->UID;
$stmt->execute([$uid, $row['id']]);
- $counter++;
-
+ ++$counter;
}
-
}
echo "Creating 'schedulingobjects'\n";
switch ($driver) {
-
- case 'mysql' :
+ case 'mysql':
$pdo->exec('CREATE TABLE IF NOT EXISTS schedulingobjects
(
id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
@@ -156,8 +147,7 @@ switch ($driver) {
');
break;
-
- case 'sqlite' :
+ case 'sqlite':
$pdo->exec('CREATE TABLE IF NOT EXISTS schedulingobjects (
id integer primary key asc,
principaluri text,
diff --git a/vendor/sabre/dav/bin/migrateto30.php b/vendor/sabre/dav/bin/migrateto30.php
index 9ca77c13c..25e544c2a 100644
--- a/vendor/sabre/dav/bin/migrateto30.php
+++ b/vendor/sabre/dav/bin/migrateto30.php
@@ -4,7 +4,6 @@
echo "SabreDAV migrate script for version 3.0\n";
if ($argc < 2) {
-
echo <<<HELLO
This script help you migrate from a pre-3.0 database to 3.0 and later
@@ -36,14 +35,13 @@ php {$argv[0]} sqlite:data/sabredav.db
HELLO;
exit();
-
}
// There's a bunch of places where the autoloader could be, so we'll try all of
// them.
$paths = [
- __DIR__ . '/../vendor/autoload.php',
- __DIR__ . '/../../../autoload.php',
+ __DIR__.'/../vendor/autoload.php',
+ __DIR__.'/../../../autoload.php',
];
foreach ($paths as $path) {
@@ -57,7 +55,7 @@ $dsn = $argv[1];
$user = isset($argv[2]) ? $argv[2] : null;
$pass = isset($argv[3]) ? $argv[3] : null;
-echo "Connecting to database: " . $dsn . "\n";
+echo 'Connecting to database: '.$dsn."\n";
$pdo = new PDO($dsn, $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@@ -66,15 +64,14 @@ $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$driver = $pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
switch ($driver) {
-
- case 'mysql' :
+ case 'mysql':
echo "Detected MySQL.\n";
break;
- case 'sqlite' :
+ case 'sqlite':
echo "Detected SQLite.\n";
break;
- default :
- echo "Error: unsupported driver: " . $driver . "\n";
+ default:
+ echo 'Error: unsupported driver: '.$driver."\n";
die(-1);
}
@@ -90,9 +87,8 @@ try {
echo "Renaming propertystorage -> propertystorage_old$random and creating new table.\n";
switch ($driver) {
-
- case 'mysql' :
- $pdo->exec('RENAME TABLE propertystorage TO propertystorage_old' . $random);
+ case 'mysql':
+ $pdo->exec('RENAME TABLE propertystorage TO propertystorage_old'.$random);
$pdo->exec('
CREATE TABLE propertystorage (
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
@@ -102,10 +98,10 @@ try {
value MEDIUMBLOB
);
');
- $pdo->exec('CREATE UNIQUE INDEX path_property_' . $random . ' ON propertystorage (path(600), name(100));');
+ $pdo->exec('CREATE UNIQUE INDEX path_property_'.$random.' ON propertystorage (path(600), name(100));');
break;
- case 'sqlite' :
- $pdo->exec('ALTER TABLE propertystorage RENAME TO propertystorage_old' . $random);
+ case 'sqlite':
+ $pdo->exec('ALTER TABLE propertystorage RENAME TO propertystorage_old'.$random);
$pdo->exec('
CREATE TABLE propertystorage (
id integer primary key asc,
@@ -115,9 +111,8 @@ CREATE TABLE propertystorage (
value blob
);');
- $pdo->exec('CREATE UNIQUE INDEX path_property_' . $random . ' ON propertystorage (path, name);');
+ $pdo->exec('CREATE UNIQUE INDEX path_property_'.$random.' ON propertystorage (path, name);');
break;
-
}
} elseif (array_key_exists('valuetype', $row)) {
echo "valuetype field exists. Assuming that this part of the migration has\n";
@@ -126,7 +121,6 @@ CREATE TABLE propertystorage (
echo "2.1 schema detected. Going to perform upgrade.\n";
$addValueType = true;
}
-
} catch (Exception $e) {
echo "Could not find a propertystorage table. Skipping this part of the\n";
echo "upgrade.\n";
@@ -134,19 +128,17 @@ CREATE TABLE propertystorage (
}
if ($addValueType) {
-
switch ($driver) {
- case 'mysql' :
+ case 'mysql':
$pdo->exec('ALTER TABLE propertystorage ADD valuetype INT UNSIGNED');
break;
- case 'sqlite' :
+ case 'sqlite':
$pdo->exec('ALTER TABLE propertystorage ADD valuetype INT');
break;
}
$pdo->exec('UPDATE propertystorage SET valuetype = 1 WHERE valuetype IS NULL ');
-
}
echo "Migrating vcardurl\n";
@@ -155,16 +147,14 @@ $result = $pdo->query('SELECT id, uri, vcardurl FROM principals WHERE vcardurl I
$stmt1 = $pdo->prepare('INSERT INTO propertystorage (path, name, valuetype, value) VALUES (?, ?, 3, ?)');
while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
-
// Inserting the new record
$stmt1->execute([
- 'addressbooks/' . basename($row['uri']),
+ 'addressbooks/'.basename($row['uri']),
'{http://calendarserver.org/ns/}me-card',
- serialize(new Sabre\DAV\Xml\Property\Href($row['vcardurl']))
+ serialize(new Sabre\DAV\Xml\Property\Href($row['vcardurl'])),
]);
echo serialize(new Sabre\DAV\Xml\Property\Href($row['vcardurl']));
-
}
echo "Done.\n";
diff --git a/vendor/sabre/dav/bin/migrateto32.php b/vendor/sabre/dav/bin/migrateto32.php
index 7567aeb60..57fd35507 100644
--- a/vendor/sabre/dav/bin/migrateto32.php
+++ b/vendor/sabre/dav/bin/migrateto32.php
@@ -4,7 +4,6 @@
echo "SabreDAV migrate script for version 3.2\n";
if ($argc < 2) {
-
echo <<<HELLO
This script help you migrate from a 3.1 database to 3.2 and later
@@ -37,14 +36,13 @@ php {$argv[0]} sqlite:data/sabredav.db
HELLO;
exit();
-
}
// There's a bunch of places where the autoloader could be, so we'll try all of
// them.
$paths = [
- __DIR__ . '/../vendor/autoload.php',
- __DIR__ . '/../../../autoload.php',
+ __DIR__.'/../vendor/autoload.php',
+ __DIR__.'/../../../autoload.php',
];
foreach ($paths as $path) {
@@ -60,7 +58,7 @@ $pass = isset($argv[3]) ? $argv[3] : null;
$backupPostfix = time();
-echo "Connecting to database: " . $dsn . "\n";
+echo 'Connecting to database: '.$dsn."\n";
$pdo = new PDO($dsn, $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@@ -69,15 +67,14 @@ $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$driver = $pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
switch ($driver) {
-
- case 'mysql' :
+ case 'mysql':
echo "Detected MySQL.\n";
break;
- case 'sqlite' :
+ case 'sqlite':
echo "Detected SQLite.\n";
break;
- default :
- echo "Error: unsupported driver: " . $driver . "\n";
+ default:
+ echo 'Error: unsupported driver: '.$driver."\n";
die(-1);
}
@@ -91,7 +88,7 @@ try {
echo "calendarinstances does not yet exist. Creating table and migrating data.\n";
switch ($driver) {
- case 'mysql' :
+ case 'mysql':
$pdo->exec(<<<SQL
CREATE TABLE calendarinstances (
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
@@ -114,7 +111,7 @@ CREATE TABLE calendarinstances (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
SQL
);
- $pdo->exec("
+ $pdo->exec('
INSERT INTO calendarinstances
(
calendarid,
@@ -138,9 +135,9 @@ SELECT
calendarcolor,
transparent
FROM calendars
-");
+');
break;
- case 'sqlite' :
+ case 'sqlite':
$pdo->exec(<<<SQL
CREATE TABLE calendarinstances (
id integer primary key asc NOT NULL,
@@ -163,7 +160,7 @@ CREATE TABLE calendarinstances (
);
SQL
);
- $pdo->exec("
+ $pdo->exec('
INSERT INTO calendarinstances
(
calendarid,
@@ -187,10 +184,9 @@ SELECT
calendarcolor,
transparent
FROM calendars
-");
+');
break;
}
-
}
try {
$result = $pdo->query('SELECT * FROM calendars LIMIT 1');
@@ -202,37 +198,34 @@ try {
}
$columnCount = count($row);
- if ($columnCount === 3) {
+ if (3 === $columnCount) {
echo "The calendars table has 3 columns already. Assuming this part of the migration was already done.\n";
$migrateCalendars = false;
} else {
- echo "The calendars table has " . $columnCount . " columns.\n";
+ echo 'The calendars table has '.$columnCount." columns.\n";
$migrateCalendars = true;
}
-
} catch (Exception $e) {
echo "calendars table does not exist. This is a major problem. Exiting.\n";
exit(-1);
}
if ($migrateCalendars) {
-
- $calendarBackup = 'calendars_3_1_' . $backupPostfix;
+ $calendarBackup = 'calendars_3_1_'.$backupPostfix;
echo "Backing up 'calendars' to '", $calendarBackup, "'\n";
switch ($driver) {
- case 'mysql' :
- $pdo->exec('RENAME TABLE calendars TO ' . $calendarBackup);
+ case 'mysql':
+ $pdo->exec('RENAME TABLE calendars TO '.$calendarBackup);
break;
- case 'sqlite' :
- $pdo->exec('ALTER TABLE calendars RENAME TO ' . $calendarBackup);
+ case 'sqlite':
+ $pdo->exec('ALTER TABLE calendars RENAME TO '.$calendarBackup);
break;
-
}
echo "Creating new calendars table.\n";
switch ($driver) {
- case 'mysql' :
+ case 'mysql':
$pdo->exec(<<<SQL
CREATE TABLE calendars (
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
@@ -242,7 +235,7 @@ CREATE TABLE calendars (
SQL
);
break;
- case 'sqlite' :
+ case 'sqlite':
$pdo->exec(<<<SQL
CREATE TABLE calendars (
id integer primary key asc NOT NULL,
@@ -252,7 +245,6 @@ CREATE TABLE calendars (
SQL
);
break;
-
}
echo "Migrating data from old to new table\n";
@@ -261,8 +253,6 @@ SQL
INSERT INTO calendars (id, synctoken, components) SELECT id, synctoken, COALESCE(components,"VEVENT,VTODO,VJOURNAL") as components FROM $calendarBackup
SQL
);
-
}
-
echo "Upgrade to 3.2 schema completed.\n";
diff --git a/vendor/sabre/dav/bin/sabredav.php b/vendor/sabre/dav/bin/sabredav.php
index 950075d1a..28341b587 100644
--- a/vendor/sabre/dav/bin/sabredav.php
+++ b/vendor/sabre/dav/bin/sabredav.php
@@ -2,34 +2,32 @@
// SabreDAV test server.
-class CliLog {
-
+class CliLog
+{
protected $stream;
- function __construct() {
-
+ public function __construct()
+ {
$this->stream = fopen('php://stdout', 'w');
-
}
- function log($msg) {
- fwrite($this->stream, $msg . "\n");
+ public function log($msg)
+ {
+ fwrite($this->stream, $msg."\n");
}
-
}
$log = new CliLog();
-if (php_sapi_name() !== 'cli-server') {
- die("This script is intended to run on the built-in php webserver");
+if ('cli-server' !== php_sapi_name()) {
+ die('This script is intended to run on the built-in php webserver');
}
// Finding composer
-
$paths = [
- __DIR__ . '/../vendor/autoload.php',
- __DIR__ . '/../../../autoload.php',
+ __DIR__.'/../vendor/autoload.php',
+ __DIR__.'/../../../autoload.php',
];
foreach ($paths as $path) {
@@ -41,7 +39,7 @@ foreach ($paths as $path) {
use Sabre\DAV;
-// Root
+// Root
$root = new DAV\FS\Directory(getcwd());
// Setting up server.