phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.49


From: nomail
Subject: [Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.49
Date: Sun, 20 Jun 2004 16:43:15 +0200

Update of /sync/inc
Modified Files:
        Branch: 
          class.bo_sync.inc.php

date: 2004/06/20 14:43:15;  author: mkaemmerer;  state: Exp;  lines: +33 -15

Log Message:
- added more error handling
- resolved some todo
- documentation updates
=====================================================================
Index: sync/inc/class.bo_sync.inc.php
diff -u sync/inc/class.bo_sync.inc.php:1.48 sync/inc/class.bo_sync.inc.php:1.49
--- sync/inc/class.bo_sync.inc.php:1.48 Sun Jun 20 13:10:37 2004
+++ sync/inc/class.bo_sync.inc.php      Sun Jun 20 14:43:15 2004
@@ -202,13 +202,17 @@
     *  array[2] itemdata - returns the Item binary data
     */
   
-    function getSyncItemFromId($deviceid, $source, $LUID) {
+    function getSyncItemFromId($deviceid, $source, $LUID) 
+    {
       // get the responsible IPC class
-      //TODO: error-handling!
       $this->GetIpcforSource($source);
+      if (!isset($this->ipc) or ($this->ipc == false)) 
+      {
+        error_log("Sync Module: Error: There is no source called '$source'. 
Can not synchronize");
+        return array(-1, $LUID, null);
+      }     
 
       // get the mapped GUID
-      //TODO: Errorhandling!
       $GUID = $this->so->getGUIDExt($deviceid, $source, $LUID);
       
       if ($GUID == -1)
@@ -268,7 +272,13 @@
   
     function setSyncItem($deviceid, $source, $LUID, $Itemdata) {
       // set the responsible IPC class of the responsible module
-      if ($this->GetIpcforSource($source) == false) return false;
+      
+      $this->GetIpcforSource($source);
+      if (!isset($this->ipc) or ($this->ipc == false)) 
+      {
+        error_log("Sync Module: Error: There is no source called '$source'. 
Can not synchronize");
+        return false;
+      }
   
       $session_data = 
$GLOBALS['phpgw']->session->appsession('session_data','sync');
       if (isset($session_data))
@@ -403,7 +413,6 @@
       // cache channelid for our $deviceid and $source
       $channelid = $this->so->GetChannelIDfromSourceAndDeviceID($deviceid, 
$source);
       
-      //TODO: error-handling!
       $this->GetIpcforSource($source);
       
       if (!isset($this->ipc) or ($this->ipc == false)) 
@@ -487,9 +496,14 @@
         $mappingidlist[] = $GLOBALS['phpgw']->db->f('mappingid');
       }
       
-      //TODO: error-handling!
       $this->GetIpcforSource($source);
 
+      if (!isset($this->ipc) or ($this->ipc == false)) 
+      {
+        error_log("Sync Module: Error: There is no source called '$source'. 
Can not synchronize");
+        return -1;
+      }     
+
       $result = array();
       for ($i = 0; $i < count($guidlist); $i++)
       {
@@ -502,9 +516,6 @@
       }
       
       return $result;
-      
-     // !! TODO: get all dead LUIDs, remove it from db and return the 
coresponding GUIDs as array
-     // $this->bo->removeLUID($GUID, $LUID);
     }
     
    /**
@@ -532,8 +543,7 @@
       return true;
     }
 
-  /**
-    *
+   /**
     * read client mappings from phpGW
     *
     * @param integer $deviceid is the deviceid of the device which whant to 
@@ -553,7 +563,7 @@
 //        $result[] = array((string) $LUID, (string) $LUID);
 //      }
 //      return $result;
-//   changed behaviour - to prevent sending redundant info through xmlrpc 
+//   changed behavior - to prevent sending redundant info through xmlrpc 
       return $LUIDs;
     }
 
@@ -567,8 +577,10 @@
     * @return boolean true if successful 
     */
     
-    function deleteMappingandItem($deviceid, $source, $LUID) {
+    function deleteMappingandItem($deviceid, $source, $LUID) 
+    {
       $result = false;
+      
       // cache channelid for our $deviceid and $source
       $channelid = $this->so->GetChannelIDfromSourceAndDeviceID($deviceid, 
$source);
       
@@ -582,8 +594,14 @@
         $this->so->deleteMapping($mappingid);
   
         //remove the item now
-        //TODO: error-handling!
         $this->GetIpcforSource($source);
+
+        if (!isset($this->ipc) or ($this->ipc == false)) 
+        {
+          error_log("Sync Module: Error: There is no source called '$source'. 
Can not synchronize");
+          return false;
+        }     
+    
         $this->ipc->removeData($GUID);
         $result = true;
       }      




reply via email to

[Prev in Thread] Current Thread [Next in Thread]