Merge branch 'master' of http://git.syncroton.org/Syncroton into SyncrotonMerge
authorLars Kneschke <l.kneschke@metaways.de>
Fri, 4 Jan 2013 17:18:38 +0000 (18:18 +0100)
committerLars Kneschke <l.kneschke@metaways.de>
Fri, 4 Jan 2013 17:18:38 +0000 (18:18 +0100)
tine20/library/Syncroton/lib/Syncroton/Command/Ping.php
tine20/library/Syncroton/lib/Syncroton/Wbxml/Abstract.php

index 3fcea26..825ef2d 100644 (file)
@@ -102,10 +102,21 @@ class Syncroton_Command_Ping extends Syncroton_Command_Wbxml
                 $now = new DateTime('now', new DateTimeZone('utc'));
                 
                 foreach ((array) $folders as $folderId) {
-                    $folder = $this->_folderBackend->get($folderId);
-                    
-                    $dataController = Syncroton_Data_Factory::factory($folder->class, $this->_device, $this->_syncTimeStamp);
-                    
+                    try {
+                        $folder         = $this->_folderBackend->get($folderId);
+                        $dataController = Syncroton_Data_Factory::factory($folder->class, $this->_device, $this->_syncTimeStamp);
+                    } catch (Syncroton_Exception_NotFound $e) {
+                        if ($this->_logger instanceof Zend_Log)
+                            $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage());
+                        $status = self::STATUS_FOLDER_NOT_FOUND;
+                        break;
+                    } catch (Exception $e) {
+                        if ($this->_logger instanceof Zend_Log)
+                            $this->_logger->err(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage());
+                        // do nothing, maybe temporal issue, should we stop?
+                        continue;
+                    }
+
                     try {
                         $syncState = $this->_syncStateBackend->getSyncState($this->_device, $folder);
                         \r
@@ -137,7 +148,7 @@ class Syncroton_Command_Ping extends Syncroton_Command_Wbxml
                     }
                 }
                 
-                if ($status === self::STATUS_CHANGES_FOUND) {
+                if ($status != self::STATUS_NO_CHANGES_FOUND) {
                     break;
                 }
                 
@@ -162,7 +173,7 @@ class Syncroton_Command_Ping extends Syncroton_Command_Wbxml
                 if ($this->_logger instanceof Zend_Log) 
                     $this->_logger->info(__METHOD__ . '::' . __LINE__ . " DeviceId: " . $this->_device->deviceid . " changes in folder: " . $changedFolder->serverId);
             }
-        }                
+        }
     }
         
     /**
index 6c86806..7fdd653 100644 (file)
@@ -111,10 +111,12 @@ abstract class Syncroton_Wbxml_Abstract
      */
     public function getDPI($_uInt = 0)
     {
-        if(($dpi = @constant('Syncroton_Wbxml_Abstract::DPI_' . $_uInt)) === NULL) {
+        if(!defined('Syncroton_Wbxml_Abstract::DPI_' . $_uInt)) {
             throw new Syncroton_Wbxml_Exception('unknown wellknown identifier: ' . $_uInt);
         }
-
+        
+        $dpi = constant('Syncroton_Wbxml_Abstract::DPI_' . $_uInt);
+        
         return $dpi;
     }