Changeset View
Changeset View
Standalone View
Standalone View
lib/ext/Syncroton/Backend/SyncState.php
Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | public function validate($deviceId, $folderId, $syncKey) | ||||
->where($this->_db->quoteIdentifier('type') . ' = ?', $folderId); | ->where($this->_db->quoteIdentifier('type') . ' = ?', $folderId); | ||||
$stmt = $this->_db->query($select); | $stmt = $this->_db->query($select); | ||||
$moreRecentStateData = $stmt->fetch(); | $moreRecentStateData = $stmt->fetch(); | ||||
$stmt = null; # see https://bugs.php.net/bug.php?id=44081 | $stmt = null; # see https://bugs.php.net/bug.php?id=44081 | ||||
// found more recent synckey => the last sync repsone got not received by the client | // found more recent synckey => the last sync repsone got not received by the client | ||||
if ($moreRecentStateData !== false) { | if ($moreRecentStateData !== false) { | ||||
// undelete entries marked as deleted in Syncroton_content table | return false; | ||||
$this->_db->update($this->_tablePrefix . 'content', array( | |||||
'is_deleted' => 0, | |||||
), array( | |||||
'device_id = ?' => $deviceId, | |||||
'folder_id = ?' => $folderId, | |||||
'creation_synckey = ?' => $state->counter, | |||||
'is_deleted = ?' => 1 | |||||
)); | |||||
} else { | } else { | ||||
// finally delete all entries marked for removal in Syncroton_content table | // finally delete all entries marked for removal in Syncroton_content table | ||||
$this->_db->delete($this->_tablePrefix . 'content', array( | $this->_db->delete($this->_tablePrefix . 'content', array( | ||||
'device_id = ?' => $deviceId, | 'device_id = ?' => $deviceId, | ||||
'folder_id = ?' => $folderId, | 'folder_id = ?' => $folderId, | ||||
'is_deleted = ?' => 1 | 'is_deleted = ?' => 1 | ||||
)); | )); | ||||
} | } | ||||
Show All 14 Lines |