Changeset View
Changeset View
Standalone View
Standalone View
lib/ext/Syncroton/Command/Sync.php
Show First 20 Lines • Show All 838 Lines • ▼ Show 20 Lines | public function getResponse() | ||||
break; | break; | ||||
} catch (Exception $e) { | } catch (Exception $e) { | ||||
if ($this->_logger instanceof Zend_Log) | if ($this->_logger instanceof Zend_Log) | ||||
$this->_logger->warn(__METHOD__ . '::' . __LINE__ . " unable to convert entry to xml: " . $e->getMessage()); | $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " unable to convert entry to xml: " . $e->getMessage()); | ||||
if ($this->_logger instanceof Zend_Log) | if ($this->_logger instanceof Zend_Log) | ||||
$this->_logger->debug(__METHOD__ . '::' . __LINE__ . " unable to convert entry to xml: " . $e->getTraceAsString()); | $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " unable to convert entry to xml: " . $e->getTraceAsString()); | ||||
// We bump collectionChanges anyways to make sure the windowSize still applies. | |||||
$collectionChanges++; | |||||
} | } | ||||
// mark as sent to the client, even the conversion to xml might have failed | // mark as sent to the client, even the conversion to xml might have failed | ||||
$newContentStates[] = new Syncroton_Model_Content(array( | $newContentStates[] = new Syncroton_Model_Content(array( | ||||
machniak: I think we could be smarter here. For 'added' entries that throw "not found" exception we… | |||||
mollekopfAuthorUnsubmitted Done Inline ActionsThat seems useless and potentially harmful indeed. mollekopf: That seems useless and potentially harmful indeed. | |||||
'device_id' => $this->_device, | 'device_id' => $this->_device, | ||||
'folder_id' => $collectionData->folder, | 'folder_id' => $collectionData->folder, | ||||
'contentid' => $serverId, | 'contentid' => $serverId, | ||||
'creation_time' => $this->_syncTimeStamp, | 'creation_time' => $this->_syncTimeStamp, | ||||
'creation_synckey' => $collectionData->syncState->counter + 1 | 'creation_synckey' => $collectionData->syncState->counter + 1 | ||||
)); | )); | ||||
unset($serverModifications['added'][$id]); | unset($serverModifications['added'][$id]); | ||||
} | } | ||||
Show All 26 Lines | public function getResponse() | ||||
if ($this->_logger instanceof Zend_Log) | if ($this->_logger instanceof Zend_Log) | ||||
$this->_logger->warn(__METHOD__ . '::' . __LINE__ . " memory exhausted for entry: " . $serverId); | $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " memory exhausted for entry: " . $serverId); | ||||
break; | break; | ||||
} catch (Exception $e) { | } catch (Exception $e) { | ||||
if ($this->_logger instanceof Zend_Log) | if ($this->_logger instanceof Zend_Log) | ||||
$this->_logger->warn(__METHOD__ . '::' . __LINE__ . " unable to convert entry to xml: " . $e->getMessage()); | $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " unable to convert entry to xml: " . $e->getMessage()); | ||||
// We bump collectionChanges anyways to make sure the windowSize still applies. | |||||
$collectionChanges++; | |||||
} | } | ||||
unset($serverModifications['changed'][$id]); | unset($serverModifications['changed'][$id]); | ||||
} | } | ||||
foreach($serverModifications['deleted'] as $id => $serverId) { | foreach($serverModifications['deleted'] as $id => $serverId) { | ||||
if($collectionChanges == $collectionData->windowSize || $totalChanges + $collectionChanges >= $this->_globalWindowSize) { | if($collectionChanges == $collectionData->windowSize || $totalChanges + $collectionChanges >= $this->_globalWindowSize) { | ||||
break; | break; | ||||
Show All 9 Lines | public function getResponse() | ||||
$deletedContentStates[] = $state; | $deletedContentStates[] = $state; | ||||
$commands->appendChild($delete); | $commands->appendChild($delete); | ||||
$collectionChanges++; | $collectionChanges++; | ||||
} catch (Exception $e) { | } catch (Exception $e) { | ||||
if ($this->_logger instanceof Zend_Log) | if ($this->_logger instanceof Zend_Log) | ||||
$this->_logger->warn(__METHOD__ . '::' . __LINE__ . " unable to convert entry to xml: " . $e->getMessage()); | $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " unable to convert entry to xml: " . $e->getMessage()); | ||||
// We bump collectionChanges anyways to make sure the windowSize still applies. | |||||
$collectionChanges++; | |||||
} | } | ||||
unset($serverModifications['deleted'][$id]); | unset($serverModifications['deleted'][$id]); | ||||
} | } | ||||
$countOfPendingChanges = (count($serverModifications['added']) + count($serverModifications['changed']) + count($serverModifications['deleted'])); | $countOfPendingChanges = (count($serverModifications['added']) + count($serverModifications['changed']) + count($serverModifications['deleted'])); | ||||
if ($countOfPendingChanges > 0) { | if ($countOfPendingChanges > 0) { | ||||
$collection->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'MoreAvailable')); | $collection->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'MoreAvailable')); | ||||
▲ Show 20 Lines • Show All 242 Lines • Show Last 20 Lines |
I think we could be smarter here. For 'added' entries that throw "not found" exception we should not add them to $newContentStates.