forked from extern/egroupware
Fix chunked item issue (bug#2576)
This commit is contained in:
parent
a91b9f2ebf
commit
fb3cc3f594
@ -20,7 +20,7 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
|||||||
|
|
||||||
var $_luid;
|
var $_luid;
|
||||||
var $_guid;
|
var $_guid;
|
||||||
var $_contentSize;
|
var $_contentSize = 0;
|
||||||
var $_contentType;
|
var $_contentType;
|
||||||
var $_contentFormat;
|
var $_contentFormat;
|
||||||
var $_status = RESPONSE_OK;
|
var $_status = RESPONSE_OK;
|
||||||
@ -108,6 +108,7 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
|||||||
#Horde::logMessage('SyncML: BASE64 encoded item for LocURI '
|
#Horde::logMessage('SyncML: BASE64 encoded item for LocURI '
|
||||||
# . $this->_curItem->_luid . ":\n $content", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
# . $this->_curItem->_luid . ":\n $content", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
}
|
}
|
||||||
|
#Horde::logMessage('SyncML: Data for ' . $this->_luid . ': ' . $this->_curItem->getContent(), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
$this->_items[$this->_luid] = $this->_curItem;
|
$this->_items[$this->_luid] = $this->_curItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +119,10 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
|||||||
case 3:
|
case 3:
|
||||||
switch ($element) {
|
switch ($element) {
|
||||||
case 'Data':
|
case 'Data':
|
||||||
$this->_curItem->_content .= $this->_chars;
|
$content = $this->_chars;
|
||||||
|
if ($this->_contentFormat == 'b64') $content = trim($content);
|
||||||
|
#Horde::logMessage('SyncML: Data for ' . $this->_luid . ': ' . $content, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
$this->_curItem->_content .= $content;
|
||||||
break;
|
break;
|
||||||
case 'MoreData':
|
case 'MoreData':
|
||||||
$this->_moreData = true;
|
$this->_moreData = true;
|
||||||
@ -132,7 +136,7 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
|||||||
$this->_contentFormat = strtolower(trim($this->_chars));
|
$this->_contentFormat = strtolower(trim($this->_chars));
|
||||||
break;
|
break;
|
||||||
case 'Size':
|
case 'Size':
|
||||||
$this->_contentSize = $this->_chars;
|
$this->_contentSize = trim($this->_chars);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -90,7 +90,11 @@ class Horde_SyncML_Sync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function nextSyncCommand($currentCmdID, &$syncCommand, &$output) {
|
function nextSyncCommand($currentCmdID, &$syncCommand, &$output) {
|
||||||
$result = $this->runSyncCommand($syncCommand);
|
$this->runSyncCommand($syncCommand);
|
||||||
|
if ($syncCommand->hasMoreData()) {
|
||||||
|
Horde::logMessage('SyncML: moreData: TRUE', __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
$syncCommand->setStatus(RESPONSE_CHUNKED_ITEM_ACCEPTED_AND_BUFFERED);
|
||||||
|
}
|
||||||
return $syncCommand->output($currentCmdID, $output);
|
return $syncCommand->output($currentCmdID, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,11 +161,6 @@ class Horde_SyncML_Sync {
|
|||||||
$history = $GLOBALS['egw']->contenthistory;
|
$history = $GLOBALS['egw']->contenthistory;
|
||||||
$state = &$_SESSION['SyncML.state'];
|
$state = &$_SESSION['SyncML.state'];
|
||||||
|
|
||||||
if ($command->hasMoreData()) {
|
|
||||||
Horde::logMessage('SyncML: moreData: TRUE', __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
$command->setStatus(RESPONSE_CHUNKED_ITEM_ACCEPTED_AND_BUFFERED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$type = $this->_targetLocURI;
|
$type = $this->_targetLocURI;
|
||||||
|
|
||||||
@ -213,11 +212,11 @@ class Horde_SyncML_Sync {
|
|||||||
$contentSize = strlen($syncItem->_content);
|
$contentSize = strlen($syncItem->_content);
|
||||||
if ((($size = $syncItem->getContentSize()) !== false) &&
|
if ((($size = $syncItem->getContentSize()) !== false) &&
|
||||||
abs($contentSize - $size) > 3) {
|
abs($contentSize - $size) > 3) {
|
||||||
Horde::logMessage('SyncML: content size mismatch for LocURI '
|
Horde::logMessage('SyncML: content size mismatch for LocURI ' . $syncItem->_luid .
|
||||||
. $syncItem->getLocURI() . ": $contentSize ($size)",
|
": $contentSize ($size) : " . $syncItem->_content,
|
||||||
__FILE__, __LINE__, PEAR_LOG_ERROR);
|
__FILE__, __LINE__, PEAR_LOG_WARNING);
|
||||||
$command->setStatus(RESPONSE_SIZE_MISMATCH);
|
//$command->setStatus(RESPONSE_SIZE_MISMATCH);
|
||||||
return false;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_a($command, 'Horde_SyncML_Command_Sync_Add')) {
|
if (is_a($command, 'Horde_SyncML_Command_Sync_Add')) {
|
||||||
@ -454,6 +453,5 @@ class Horde_SyncML_Sync {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $guid;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ class Horde_SyncML_Sync_RefreshFromServerSync extends Horde_SyncML_Sync_TwoWaySy
|
|||||||
if (!is_a($cmd, 'Horde_SyncML_Command_Sync_ContentSyncElement')) {
|
if (!is_a($cmd, 'Horde_SyncML_Command_Sync_ContentSyncElement')) {
|
||||||
// Conflict with other datastore
|
// Conflict with other datastore
|
||||||
Horde :: logMessage("SyncML: handleSync($currentCmdID, $hordeType, $syncType) moreData conflict found",
|
Horde :: logMessage("SyncML: handleSync($currentCmdID, $hordeType, $syncType) moreData conflict found",
|
||||||
__FILE__, __LINE__, PEAR_LOG_DEBUG);
|
__FILE__, __LINE__, PEAR_LOG_WARNING);
|
||||||
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
||||||
return $currentCmdID;
|
return $currentCmdID;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
if (!is_a($cmd, 'Horde_SyncML_Command_Sync_ContentSyncElement')) {
|
if (!is_a($cmd, 'Horde_SyncML_Command_Sync_ContentSyncElement')) {
|
||||||
// Conflict with other datastore
|
// Conflict with other datastore
|
||||||
Horde :: logMessage("SyncML: handleSync($currentCmdID, $hordeType, $syncType) moreData conflict found",
|
Horde :: logMessage("SyncML: handleSync($currentCmdID, $hordeType, $syncType) moreData conflict found",
|
||||||
__FILE__, __LINE__, PEAR_LOG_DEBUG);
|
__FILE__, __LINE__, PEAR_LOG_WARNING);
|
||||||
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
||||||
return $currentCmdID;
|
return $currentCmdID;
|
||||||
}
|
}
|
||||||
@ -202,12 +202,6 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
$history = $GLOBALS['egw']->contenthistory;
|
$history = $GLOBALS['egw']->contenthistory;
|
||||||
$state = &$_SESSION['SyncML.state'];
|
$state = &$_SESSION['SyncML.state'];
|
||||||
|
|
||||||
if ($command->hasMoreData()) {
|
|
||||||
Horde::logMessage('SyncML: moreData: TRUE', __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
$command->setStatus(RESPONSE_CHUNKED_ITEM_ACCEPTED_AND_BUFFERED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$type = $this->_targetLocURI;
|
$type = $this->_targetLocURI;
|
||||||
|
|
||||||
$syncml_prefs = $GLOBALS['egw_info']['user']['preferences']['syncml'];
|
$syncml_prefs = $GLOBALS['egw_info']['user']['preferences']['syncml'];
|
||||||
@ -227,9 +221,10 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
if ((($size = $syncItem->getContentSize()) !== false) &&
|
if ((($size = $syncItem->getContentSize()) !== false) &&
|
||||||
abs($contentSize - $size) > 3) {
|
abs($contentSize - $size) > 3) {
|
||||||
Horde::logMessage('SyncML: content size mismatch for LocURI ' . $syncItem->_luid .
|
Horde::logMessage('SyncML: content size mismatch for LocURI ' . $syncItem->_luid .
|
||||||
": $contentSize ($size)", __FILE__, __LINE__, PEAR_LOG_ERROR);
|
": $contentSize ($size) : " . $syncItem->_content,
|
||||||
$command->setStatus(RESPONSE_SIZE_MISMATCH);
|
__FILE__, __LINE__, PEAR_LOG_WARNING);
|
||||||
return;
|
//$command->setStatus(RESPONSE_SIZE_MISMATCH);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$contentType = $syncItem->getContentType()) {
|
if(!$contentType = $syncItem->getContentType()) {
|
||||||
@ -248,7 +243,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
$guid = $registry->call($hordeType . '/search',
|
$guid = $registry->call($hordeType . '/search',
|
||||||
array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType, $oguid, $type));
|
array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType, $oguid, $type));
|
||||||
|
|
||||||
if ($guid) {
|
if (!is_a($guid, 'PEAR_Error') && $guid) {
|
||||||
// Check if the found entry came from the client
|
// Check if the found entry came from the client
|
||||||
$guid_ts = $state->getSyncTSforAction($guid, 'add');
|
$guid_ts = $state->getSyncTSforAction($guid, 'add');
|
||||||
$sync_ts = $state->getChangeTS($type, $guid);
|
$sync_ts = $state->getChangeTS($type, $guid);
|
||||||
@ -292,7 +287,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
__FILE__, __LINE__, PEAR_LOG_DEBUG);
|
__FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
$guid = $registry->call($hordeType . '/import',
|
$guid = $registry->call($hordeType . '/import',
|
||||||
array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType));
|
array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType));
|
||||||
if (!is_a($guid, 'PEAR_Error') && $guid != false) {
|
if (!is_a($guid, 'PEAR_Error') && $guid) {
|
||||||
$state->setUID($type, $syncItem->getLocURI(), $guid);
|
$state->setUID($type, $syncItem->getLocURI(), $guid);
|
||||||
$state->log("Client-AddReplace");
|
$state->log("Client-AddReplace");
|
||||||
Horde::logMessage('SyncML: replaced/added client entry as ' . $guid,
|
Horde::logMessage('SyncML: replaced/added client entry as ' . $guid,
|
||||||
@ -303,8 +298,6 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
$state->log("Client-AddFailure");
|
$state->log("Client-AddFailure");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadData() {
|
function loadData() {
|
||||||
|
@ -65,7 +65,7 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
|
|||||||
if (!is_a($cmd, 'Horde_SyncML_Command_Sync_ContentSyncElement')) {
|
if (!is_a($cmd, 'Horde_SyncML_Command_Sync_ContentSyncElement')) {
|
||||||
// Conflict with other datastore
|
// Conflict with other datastore
|
||||||
Horde :: logMessage("SyncML: handleSync($currentCmdID, $hordeType, $syncType) moreData conflict found",
|
Horde :: logMessage("SyncML: handleSync($currentCmdID, $hordeType, $syncType) moreData conflict found",
|
||||||
__FILE__, __LINE__, PEAR_LOG_DEBUG);
|
__FILE__, __LINE__, PEAR_LOG_WARNING);
|
||||||
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
||||||
return $currentCmdID;
|
return $currentCmdID;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user