[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] sync/inc/class.ipc_sync.inc.php, 1.37
From: |
nomail |
Subject: |
[Phpgroupware-cvs] sync/inc/class.ipc_sync.inc.php, 1.37 |
Date: |
Fri, 26 Nov 2004 13:34:57 +0100 |
Update of /sync/inc
Modified Files:
Branch:
class.ipc_sync.inc.php
date: 2004/11/26 12:34:57; author: fipsfuchs; state: Exp; lines: +116 -69
Log Message:
new version from internal CVS moved to original project
=====================================================================
Index: sync/inc/class.ipc_sync.inc.php
diff -u sync/inc/class.ipc_sync.inc.php:1.36
sync/inc/class.ipc_sync.inc.php:1.37
--- sync/inc/class.ipc_sync.inc.php:1.36 Mon Jul 12 19:35:27 2004
+++ sync/inc/class.ipc_sync.inc.php Fri Nov 26 12:34:57 2004
@@ -79,8 +79,8 @@
*/
function authenticate($username, $password, $deviceid) {
- if ($this->debug)
- error_log("authenticate device: '$deviceid' with username '$username'");
+
+ $this->debugLog("authenticate device: '$deviceid' with username
'$username'", 2 );
if(is_object($GLOBALS['phpgw']->log))
{
@@ -110,12 +110,11 @@
* @return integer channelid of newly added channel entry or existing one or
-1 in case of error
*/
- function authorize($deviceid, $source) {
- if ($this->debug)
- error_log("authorize source for device: [$deviceid] [$source]");
-
- return (integer) $this->bo->AuthenticateSyncSource($deviceid, $source);
- }
+ function authorize($deviceid, $source)
+ {
+ $this->debugLog("authorize source for device: [$deviceid]
[$source]", 2 );
+ return (integer) $this->bo->AuthenticateSyncSource($deviceid,
$source);
+ }
/**
* Get all sources actually supported by the phpgw syncmodule
@@ -126,9 +125,9 @@
*
*/
- function getSupportedSources() {
- if ($this->debug)
- error_log("get list of all supported sources");
+ function getSupportedSources()
+ {
+ $this->debugLog('get list of all supported sources', 1);
return $this->so->getSupportedSources();
}
@@ -144,10 +143,9 @@
*
*/
- function getDataForSource($uri) {
- if ($this->debug)
- error_log("get data for source '$uri'");
-
+ function getDataForSource($uri)
+ {
+ $this->debugLog("get data for source '$uri'", 3 );
return $this->so->getSourceInfo($uri);
}
@@ -165,13 +163,17 @@
* in case of error only id is set
*/
- function readPrincipalByID($deviceid) {
- if ($this->debug)
- error_log("readPrincipalByID device: [$deviceid]");
-
+ function readPrincipalByID($deviceid)
+ {
+ $this->debugLog("readPrincipalByID device: [$deviceid]", 1);
return $this->bo->readDeviceInfoByID($deviceid);
}
+ // cawgod:
+ function readPrincipalByData($username, $deviceid) {
+ return $this->readPrincipalByID($deviceid);
+ }
+
/**
* get one SyncItem from phpGW.
*
@@ -187,8 +189,7 @@
function getSyncItemFromId($deviceid, $source, $LUID)
{
- if ($this->debug)
- error_log("getSyncItemFromId: '$deviceid', '$source', '$LUID'");
+ $this->debugLog("getSyncItemFromId: '$deviceid', '$source',
'$LUID'", 1);
return $this->bo->getSyncItemFromId($deviceid, $source, $LUID);
}
@@ -211,17 +212,18 @@
function setSyncItem($deviceid, $source, $LUID, $mimetype, $Itemdata)
{
// distinguish between encoded data from XML-RPC and data from internal
classes
- if (is_array($Itemdata))
+ if (is_array($Itemdata))
{
- if ($this->debug)
- error_log("setSyncItem: $deviceid, $source, $LUID, $mimetype |" .
serialize($Itemdata));
- return $this->bo->setSyncItem($deviceid, $source, $LUID, $mimetype,
$Itemdata);
- } else
+ $content = serialize($Itemdata);
+ $return = $this->bo->setSyncItem($deviceid, $source, $LUID, $mimetype,
$Itemdata);
+ }
+ else
{
- if ($this->debug)
- error_log("setSyncItem: $deviceid, $source, $LUID, $mimetype |" .
base64_decode($Itemdata));
- return $this->bo->setSyncItem($deviceid, $source, $LUID, $mimetype,
base64_decode($Itemdata));
+ $content = base64_decode($Itemdata);
+ $return = $this->bo->setSyncItem($deviceid, $source, $LUID, $mimetype,
base64_decode($Itemdata));
}
+ $this->debugLog("setSyncItem: $deviceid, $source, $LUID, $mimetype:
$return |\n" . $content, 1);
+ return $return;
}
@@ -237,24 +239,21 @@
*
*/
- function setSyncItems($deviceid, $source, $count, $Items) {
- if ($this->debug)
- error_log("setSyncItems: $deviceid, $source, $count, Items");
-
+ function setSyncItems($deviceid, $source, $count, $Items)
+ {
+ $this->debugLog("setSyncItems: $deviceid, $source, $count,
Items", 1);
+
$result = array();
$fieldcount = 2;
for ($i = 0; $i < $count; $i++)
{
$arraypointer = $i * $fieldcount;
- array_push($result,
- $this->setSyncItem(
- $deviceid,
- $source,
- $Items[$arraypointer], // LUID
- '',
- $Items[$arraypointer+1] // Data
- )
- );
+ $result[] = $this->setSyncItem($deviceid,
+ $source,
+ $Items[$arraypointer], // LUID
+ '',
+ $Items[$arraypointer+1] // Data
+ );
}
return $result;
}
@@ -268,13 +267,13 @@
* @return array returns an integer array of all IDs
*/
- function getAllSyncItemIds($deviceid, $source) {
- if ($this->debug)
- error_log("getAllSyncItemIds: $deviceid, $source");
-
+ function getAllSyncItemIds($deviceid, $source)
+ {
+ $this->debugLog("getAllSyncItemIds: $deviceid, $source:", 0);
set_time_limit(0);
-
- return $this->bo->GetIDList($deviceid, $source, 1);
+ $return = $this->bo->GetIDList($deviceid, $source, 1);
+ $this->debugLog(serialize(array_keys($return)), 0);
+ return $return;
}
/**
@@ -288,9 +287,9 @@
* @return array returns a linear array of all Items (ID => Data)
*/
- function getSyncItemsbyID($deviceid, $source, $Ids) {
- if ($this->debug)
- error_log("getSyncItemsbyID: $deviceid, $source, " . serialize($Ids));
+ function getSyncItemsbyID($deviceid, $source, $Ids)
+ {
+ $this->debugLog("getSyncItemsbyID: $deviceid, $source, " .
serialize($Ids), 1);
set_time_limit(0);
@@ -312,9 +311,9 @@
* @return array returns an integer array of all deleted IDs
*/
- function getDeletedSyncItemIds($deviceid, $source, $since) {
- if ($this->debug)
- error_log("getDeletedSyncItems: $deviceid, $source, $since");
+ function getDeletedSyncItemIds($deviceid, $source, $since)
+ {
+ $this->debugLog("getDeletedSyncItems: $deviceid, $source,
$since", 1);
set_time_limit(0);
@@ -331,13 +330,13 @@
* @return array returns an integer-array of all new IDs
*/
- function getNewSyncItemIds($deviceid, $source, $since) {
- if ($this->debug)
- error_log("getNewSyncItemIds: $deviceid, $source, $since");
-
+ function getNewSyncItemIds($deviceid, $source, $since)
+ {
+ $this->debugLog("getNewSyncItemIds: $deviceid, $source, $since", 0);
set_time_limit(0);
-
- return $this->bo->GetIDList($deviceid, $source, 2, $since);
+ $return = $this->bo->GetIDList($deviceid, $source, 2, $since);
+ $this->debugLog(serialize(array_keys($return)), 0);
+ return $return;
}
/**
@@ -350,9 +349,9 @@
* @return array returns an integer array of all updated LUIDs
*/
- function getUpdatedSyncItemIds($deviceid, $source, $since) {
- if ($this->debug)
- error_log("getUpdatedSyncItemIds: $deviceid, $source, $since");
+ function getUpdatedSyncItemIds($deviceid, $source, $since)
+ {
+ $this->debugLog("getUpdatedSyncItemIds: $deviceid, $source,
$since", 1);
set_time_limit(0);
@@ -401,6 +400,12 @@
$result["tag"] = (string) $timestamp[0];
$result["start"] = (string) $timestamp[1];
$result["end"] = (string) $timestamp[2];
+ // cawgod
+ // special hack only for offline-client-sources
+ if (strpos($source, "ocl_") == 0) {
+ $result["start"] = $result["end"];
+ error_log("ocl-replace start-time with end-time");
+ }
if ($syncstart == 0)
{
@@ -431,11 +436,10 @@
* @return integer dbID of the stored stamp or -1 in case of error
*/
- function storeLastTimestamp($deviceid, $source, $lastanchor, $startsync,
$stopsync) {
- if ($this->debug)
- error_log("storeLastTimestamp: $deviceid, $source, $lastanchor,
$startsync, $stopsync");
-
- return $this->so->SetTimestamp($deviceid, $source, $lastanchor,
$startsync, $stopsync);
+ function storeLastTimestamp($deviceid, $source, $lastanchor,
$startsync, $stopsync)
+ {
+ $this->debugLog("storeLastTimestamp: $deviceid, $source,
$lastanchor, $startsync, $stopsync", 3);
+ return $this->so->SetTimestamp($deviceid, $source, $lastanchor,
$startsync, $stopsync);
}
/**
@@ -545,5 +549,48 @@
return 1;
}
+ /**
+ * Call this, to obtain the mapped guid (server-id) for a
+ * given luid (client-id).
+ *
+ * @param $deviceid the deviceid as given through ipc#setCurrentDeviceID
+ * @param $source the source-uri of the id to get
+ * @param $luid the luid for which the guid should obtained
+ * @return the mapped guid or -1 if there is no such mapping
+ */
+ function getGUID($deviceid, $source, $luid) {
+ $channelid =
$this->so->GetChannelIDfromSourceAndDeviceID($deviceid, $source);
+ return $this->so->GetGUID($channelid, $luid);
+ }
+
+ /**
+ * Call this, to obtain the mapped luid (client-id) for a
+ * given guid (server-id).
+ *
+ * @param $deviceid the deviceid as given through ipc#setCurrentDeviceID
+ * @param $source the source-uri of the id to get
+ * @param $guid the guid for which the luid should obtained
+ * @return the mapped guid or -1 if there is no such mapping, but this
+ * function should never return -1.
+ */
+ function getLUID($deviceid, $source, $guid) {
+ $channelid =
$this->so->GetChannelIDfromSourceAndDeviceID($deviceid, $source);
+ return $this->so->GetLUID($channelid, $guid);
+ }
+
+ /**
+ * If a mapping cannot be resolved during a set-operation (i.e. add,
replace),
+ * call this, to store an entry for delayed resolvement.
+ *
+ * @param $deviceid the deviceid as given through ipc#setCurrentDeviceID
+ * @param $reqsourceuri the source-uri of this ipc-implementation
+ * @param $id the (gu)id of the record, which need further resolvement
+ * @param $fkluid the luid, not be resolved
+ * @param $fksource the source-uri of the luid, not be resolved
+ * @param $tag an identifier to uniquely mark this type of resolvement
+ */
+ function putUnresolvedMapping($deviceid, $reqsourceuri, $id, $fkluid,
$fksourceuri, $tag) {
+ $this->so->addResolveEntry($deviceid, $reqsourceuri, $id,
$fkluid, $fksourceuri, $tag);
+ }
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] sync/inc/class.ipc_sync.inc.php, 1.37,
nomail <=