From 0b02a6d123b2014705998c94ddf3d460948d3eac Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 10 May 2016 17:26:44 -0700 Subject: initial sabre upgrade (needs lots of work - to wit: authentication, redo the browser interface, and rework event export/import) --- vendor/sabre/dav/bin/migrateto17.php | 54 ++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'vendor/sabre/dav/bin/migrateto17.php') diff --git a/vendor/sabre/dav/bin/migrateto17.php b/vendor/sabre/dav/bin/migrateto17.php index 66a9ee564..a1173c584 100755 --- a/vendor/sabre/dav/bin/migrateto17.php +++ b/vendor/sabre/dav/bin/migrateto17.php @@ -3,7 +3,7 @@ echo "SabreDAV migrate script for version 1.7\n"; -if ($argc<2) { +if ($argc < 2) { echo <<getAttribute(PDO::ATTR_DRIVER_NAME)) { + switch ($pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'mysql' : @@ -150,7 +150,7 @@ $stmt = $pdo->prepare('UPDATE calendarobjects SET etag = ?, size = ?, componentt echo "Total records found: " . $result->rowCount() . "\n"; $done = 0; $total = $result->rowCount(); -while($row = $result->fetch()) { +while ($row = $result->fetch()) { try { $newData = getDenormalizedData($row['calendardata']); @@ -161,14 +161,14 @@ while($row = $result->fetch()) { echo "This record is ignored, you should inspect it to see if there's anything wrong.\n===\n"; continue; } - $stmt->execute(array( + $stmt->execute([ $newData['etag'], $newData['size'], $newData['componentType'], $newData['firstOccurence'], $newData['lastOccurence'], $row['id'], - )); + ]); $done++; if ($done % 500 === 0) { @@ -188,7 +188,7 @@ if (array_key_exists('transparent', $row)) { echo "Adding the 'transparent' field to the calendars table\n"; - switch($pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) { + switch ($pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) { case 'mysql' : $pdo->exec("ALTER TABLE calendars ADD transparent TINYINT(1) NOT NULL DEFAULT '0'"); @@ -229,8 +229,8 @@ function getDenormalizedData($calendarData) { $component = null; $firstOccurence = null; $lastOccurence = null; - foreach($vObject->getComponents() as $component) { - if ($component->name!=='VTIMEZONE') { + foreach ($vObject->getComponents() as $component) { + if ($component->name !== 'VTIMEZONE') { $componentType = $component->name; break; } @@ -256,13 +256,13 @@ function getDenormalizedData($calendarData) { $lastOccurence = $firstOccurence; } } else { - $it = new \Sabre\VObject\RecurrenceIterator($vObject, (string)$component->UID); + $it = new \Sabre\VObject\Recur\EventIterator($vObject, (string)$component->UID); $maxDate = new DateTime(\Sabre\CalDAV\Backend\PDO::MAX_DATE); if ($it->isInfinite()) { $lastOccurence = $maxDate->getTimeStamp(); } else { $end = $it->getDtEnd(); - while($it->valid() && $end < $maxDate) { + while ($it->valid() && $end < $maxDate) { $end = $it->getDtEnd(); $it->next(); @@ -273,12 +273,12 @@ function getDenormalizedData($calendarData) { } } - return array( - 'etag' => md5($calendarData), - 'size' => strlen($calendarData), - 'componentType' => $componentType, + return [ + 'etag' => md5($calendarData), + 'size' => strlen($calendarData), + 'componentType' => $componentType, 'firstOccurence' => $firstOccurence, 'lastOccurence' => $lastOccurence, - ); + ]; } -- cgit v1.2.3