mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-09 23:11:57 +01:00
Improve chunked item handling
This commit is contained in:
parent
f7e70b5feb
commit
5329baab76
@ -26,6 +26,7 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
|||||||
var $_status = RESPONSE_OK;
|
var $_status = RESPONSE_OK;
|
||||||
var $_curItem;
|
var $_curItem;
|
||||||
var $_items = array();
|
var $_items = array();
|
||||||
|
var $_failed = array();
|
||||||
var $_moreData = false;
|
var $_moreData = false;
|
||||||
var $_command = false;
|
var $_command = false;
|
||||||
|
|
||||||
@ -101,8 +102,16 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
|||||||
$state->curSyncItem = &$this->_curItem;
|
$state->curSyncItem = &$this->_curItem;
|
||||||
Horde::logMessage('SyncML: moreData item saved for LocURI ' . $this->_curItem->_luid, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
Horde::logMessage('SyncML: moreData item saved for LocURI ' . $this->_curItem->_luid, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
} else {
|
} else {
|
||||||
if (strtolower($this->_curItem->getContentFormat()) == 'b64') {
|
|
||||||
$content = $this->_curItem->getContent();
|
$content = $this->_curItem->getContent();
|
||||||
|
$contentSize = strlen($content);
|
||||||
|
if ((($size = $this->_curItem->getContentSize()) !== false) &&
|
||||||
|
abs($contentSize - $size) > 3) {
|
||||||
|
Horde::logMessage('SyncML: content size mismatch for LocURI ' . $this->_luid .
|
||||||
|
": $contentSize ($size) : " . $content,
|
||||||
|
__FILE__, __LINE__, PEAR_LOG_WARNING);
|
||||||
|
$this->_failed[$this->_luid] = $this->_curItem;
|
||||||
|
} else {
|
||||||
|
if (strtolower($this->_curItem->getContentFormat()) == 'b64') {
|
||||||
$content = ($content ? base64_decode($content) : '');
|
$content = ($content ? base64_decode($content) : '');
|
||||||
$this->_curItem->setContent($content);
|
$this->_curItem->setContent($content);
|
||||||
#Horde::logMessage('SyncML: BASE64 encoded item for LocURI '
|
#Horde::logMessage('SyncML: BASE64 encoded item for LocURI '
|
||||||
@ -112,6 +121,7 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
|||||||
$this->_items[$this->_luid] = $this->_curItem;
|
$this->_items[$this->_luid] = $this->_curItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
unset($this->_contentSize);
|
unset($this->_contentSize);
|
||||||
unset($this->_luid);
|
unset($this->_luid);
|
||||||
}
|
}
|
||||||
@ -168,6 +178,10 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
|||||||
return (array)$this->_items;
|
return (array)$this->_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSyncElementFailures() {
|
||||||
|
return (array)$this->_failed;
|
||||||
|
}
|
||||||
|
|
||||||
function getLocURI()
|
function getLocURI()
|
||||||
{
|
{
|
||||||
return $this->_luid;
|
return $this->_luid;
|
||||||
|
@ -209,16 +209,6 @@ class Horde_SyncML_Sync {
|
|||||||
|
|
||||||
$guid = false;
|
$guid = false;
|
||||||
|
|
||||||
$contentSize = strlen($syncItem->_content);
|
|
||||||
if ((($size = $syncItem->getContentSize()) !== false) &&
|
|
||||||
abs($contentSize - $size) > 3) {
|
|
||||||
Horde::logMessage('SyncML: content size mismatch for LocURI ' . $syncItem->_luid .
|
|
||||||
": $contentSize ($size) : " . $syncItem->_content,
|
|
||||||
__FILE__, __LINE__, PEAR_LOG_WARNING);
|
|
||||||
//$command->setStatus(RESPONSE_SIZE_MISMATCH);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_a($command, 'Horde_SyncML_Command_Sync_Add')) {
|
if (is_a($command, 'Horde_SyncML_Command_Sync_Add')) {
|
||||||
if ($sync_conflicts > CONFLICT_RESOLVED_WITH_DUPLICATE) {
|
if ($sync_conflicts > CONFLICT_RESOLVED_WITH_DUPLICATE) {
|
||||||
// We enforce the client not to change anything
|
// We enforce the client not to change anything
|
||||||
|
@ -217,16 +217,6 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
|
|
||||||
foreach($syncElementItems as $syncItem) {
|
foreach($syncElementItems as $syncItem) {
|
||||||
|
|
||||||
$contentSize = strlen($syncItem->_content);
|
|
||||||
if ((($size = $syncItem->getContentSize()) !== false) &&
|
|
||||||
abs($contentSize - $size) > 3) {
|
|
||||||
Horde::logMessage('SyncML: content size mismatch for LocURI ' . $syncItem->_luid .
|
|
||||||
": $contentSize ($size) : " . $syncItem->_content,
|
|
||||||
__FILE__, __LINE__, PEAR_LOG_WARNING);
|
|
||||||
//$command->setStatus(RESPONSE_SIZE_MISMATCH);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$contentType = $syncItem->getContentType()) {
|
if(!$contentType = $syncItem->getContentType()) {
|
||||||
$contentType = $state->getPreferedContentType($type);
|
$contentType = $state->getPreferedContentType($type);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user