mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 17:04:14 +01:00
Improve chunked item handling
This commit is contained in:
parent
82d0348940
commit
c1c11ca1df
@ -26,6 +26,7 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
||||
var $_status = RESPONSE_OK;
|
||||
var $_curItem;
|
||||
var $_items = array();
|
||||
var $_failed = array();
|
||||
var $_moreData = false;
|
||||
var $_command = false;
|
||||
|
||||
@ -101,15 +102,24 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
||||
$state->curSyncItem = &$this->_curItem;
|
||||
Horde::logMessage('SyncML: moreData item saved for LocURI ' . $this->_curItem->_luid, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
} else {
|
||||
if (strtolower($this->_curItem->getContentFormat()) == 'b64') {
|
||||
$content = $this->_curItem->getContent();
|
||||
$content = ($content ? base64_decode($content) : '');
|
||||
$this->_curItem->setContent($content);
|
||||
#Horde::logMessage('SyncML: BASE64 encoded item for LocURI '
|
||||
# . $this->_curItem->_luid . ":\n $content", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
$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) : '');
|
||||
$this->_curItem->setContent($content);
|
||||
#Horde::logMessage('SyncML: BASE64 encoded item for LocURI '
|
||||
# . $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;
|
||||
}
|
||||
#Horde::logMessage('SyncML: Data for ' . $this->_luid . ': ' . $this->_curItem->getContent(), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
$this->_items[$this->_luid] = $this->_curItem;
|
||||
}
|
||||
}
|
||||
unset($this->_contentSize);
|
||||
@ -167,6 +177,10 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
||||
function getSyncElementItems() {
|
||||
return (array)$this->_items;
|
||||
}
|
||||
|
||||
function getSyncElementFailures() {
|
||||
return (array)$this->_failed;
|
||||
}
|
||||
|
||||
function getLocURI()
|
||||
{
|
||||
|
@ -209,16 +209,6 @@ class Horde_SyncML_Sync {
|
||||
|
||||
$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 ($sync_conflicts > CONFLICT_RESOLVED_WITH_DUPLICATE) {
|
||||
// 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) {
|
||||
|
||||
$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()) {
|
||||
$contentType = $state->getPreferedContentType($type);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user