[Pkg-owncloud-commits] [php-sabredav] 37/42: Several issues fixed in the migration process.

David Prévot taffit at moszumanska.debian.org
Fri Nov 28 22:47:52 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabredav.

commit 8e7b5666a4e2e9e2bdbfdb1814d208301793e469
Author: Evert Pot <me at evertpot.com>
Date:   Sat Nov 22 15:16:23 2014 -0500

    Several issues fixed in the migration process.
    
    Fixes #566
---
 bin/migrateto21.php | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/bin/migrateto21.php b/bin/migrateto21.php
index f6cac91..d5e85f0 100755
--- a/bin/migrateto21.php
+++ b/bin/migrateto21.php
@@ -89,7 +89,7 @@ try {
         echo "No data in table. Going to try to add the uid field anyway.\n";
         $addUid = true;
     } elseif (array_key_exists('uid', $row)) {
-        echo "uid field eixsts. Assuming that this part of the migration has\n";
+        echo "uid field exists. Assuming that this part of the migration has\n";
         echo "Already been completed.\n";
     } else {
         echo "2.0 schema detected.\n";
@@ -113,7 +113,7 @@ if ($addUid) {
     }
 
     $result = $pdo->query('SELECT id, calendardata FROM calendarobjects');
-    $stmt = $pdo->query('UPDATE calendarobjects SET uid = ? WHERE id = ?');
+    $stmt = $pdo->prepare('UPDATE calendarobjects SET uid = ? WHERE id = ?');
     $counter = 0;
 
     while($row = $result->fetch(\PDO::FETCH_ASSOC)) {
@@ -127,20 +127,13 @@ if ($addUid) {
             goto yoyo;
         }
         $uid = null;
-        foreach($vobj->select() as $item) {
-            if ($item instanceof \Sabre\VObject\Component) {
-                if ($item->name === 'VTIMEZONE') {
-                    continue;
-                }
-                if (!isset($item->UID)) {
-                    echo "Warning! Item with id $item[id] does NOT have a UID property and this is required.\n";
-                    goto yoyo;
-                }
-                $uid = (string)$uid;
-
-            }
+        $item = $vobj->getBaseComponent();
+        if (!isset($item->UID)) {
+            echo "Warning! Item with id $item[id] does NOT have a UID property and this is required.\n";
+            goto yoyo;
         }
-        $stmt->exec(array($uid, $row['id']));
+        $uid = (string)$uid;
+        $stmt->execute([$uid, $row['id']]);
         $counter++;
 
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list