Skip to content

Commit

Permalink
Improve logic, exit early if we don't have a change timestamp.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Oct 16, 2013
1 parent f7b75db commit fe52967
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions framework/ActiveSync/lib/Horde/ActiveSync/State/Sql.php
Expand Up @@ -977,20 +977,20 @@ public function getChanges(array $options = array())
default:
$pim_timestamps = $this->_getPIMChangeTS($changes);
foreach ($changes as $change) {
if (!empty($pim_timestamps[$change['id']]) &&
$change['type'] == Horde_ActiveSync::CHANGE_TYPE_DELETE) {
if (empty($pim_timestamps[$change['id']])) {
$this->_changes[] = $change;
continue;
}
if ($change['type'] == Horde_ActiveSync::CHANGE_TYPE_DELETE) {
// If we have a delete, don't bother stating the message,
// If we have a delete entry in the map table, the
// entry should already be deleted on the client, we
// should never, ever need to send a REMOVE to the client
// if we have a delete entry in the map table.
// the entry should already be deleted on the client.
$stat['mod'] = 0;
} elseif (!empty($pim_timestamps[$change['id']])) {
} else {
// stat only returns MODIFY times, not deletion times,
// so will return (int)0 for ADD or DELETE.
$stat = $this->_backend->statMessage($this->_folder->serverid(), $change['id']);
}
if (!empty($pim_timestamps[$change['id']]) && $pim_timestamps[$change['id']] >= $stat['mod']) {
if ($pim_timestamps[$change['id']] >= $stat['mod']) {
$this->_logger->info(sprintf(
'[%s] Ignoring PIM initiated change for %s (PIM TS: %s Stat TS: %s)',
$this->_procid,
Expand Down

0 comments on commit fe52967

Please sign in to comment.