From: Michael J. Rubinsky Date: Tue, 10 Aug 2010 23:59:00 +0000 (-0400) Subject: Make sure we record the user when updating the map table. Fixes Bug: 9168. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=580f432a92cc6058b01bc6c83cdc6236a6858f0c;p=horde.git Make sure we record the user when updating the map table. Fixes Bug: 9168. --- diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Connector/Importer.php b/framework/ActiveSync/lib/Horde/ActiveSync/Connector/Importer.php index 5a42a7355..78827607c 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/Connector/Importer.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/Connector/Importer.php @@ -114,7 +114,7 @@ class Horde_ActiveSync_Connector_Importer $change['id'] = $id; // mod is 0 to force a re-synch in the case of server failure. This // is updated after the change succeeds in the next updateState() - $change['mod'] = 0; + $change['mod'] = 0; $change['parent'] = $this->_folderId; $change['flags'] = (isset($message->read)) ? $message->read : 0; $this->_state->updateState('change', $change, Horde_ActiveSync::CHANGE_ORIGIN_NA); @@ -133,7 +133,7 @@ class Horde_ActiveSync_Connector_Importer } /* Record the state of the message */ - $this->_state->updateState('change', $stat, Horde_ActiveSync::CHANGE_ORIGIN_PIM); + $this->_state->updateState('change', $stat, Horde_ActiveSync::CHANGE_ORIGIN_PIM, $this->_backend->getUser()); return $stat['id']; } @@ -161,7 +161,7 @@ class Horde_ActiveSync_Connector_Importer $change['id'] = $id; $change['mod'] = time(); $change['parent'] = $this->_folderId; - $this->_state->updateState('delete', $change, Horde_ActiveSync::CHANGE_ORIGIN_PIM, $this->_folderId); + $this->_state->updateState('delete', $change, Horde_ActiveSync::CHANGE_ORIGIN_PIM, $this->_backend->getUser()); /* If server wins the conflict, don't import change - it will be * detected on next sync and sent back to PIM (since we updated the PIM diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/State/Base.php b/framework/ActiveSync/lib/Horde/ActiveSync/State/Base.php index 1f05d37ea..2c6e0e35c 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/State/Base.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/State/Base.php @@ -483,10 +483,11 @@ abstract class Horde_ActiveSync_State_Base * @param string $type The type of change (change, delete, flags) * @param array $change A stat/change hash describing the change * @param integer $origin Flag to indicate the origin of the change. + * @param string $user The current synch user * * @return void */ - abstract public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA); + abstract public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA, $user = null); /** * Save folder data for a specific device. This is needed for BC with older diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/State/File.php b/framework/ActiveSync/lib/Horde/ActiveSync/State/File.php index 3b2a778de..1b6777fea 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/State/File.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/State/File.php @@ -175,7 +175,7 @@ class Horde_ActiveSync_State_File extends Horde_ActiveSync_State_Base * * @return void */ - public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA) + public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA, $user = null) { if (empty($this->_stateCache)) { $this->_stateCache = array(); diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/State/History.php b/framework/ActiveSync/lib/Horde/ActiveSync/State/History.php index 66e54328d..4337fdf41 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/State/History.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/State/History.php @@ -243,15 +243,17 @@ class Horde_ActiveSync_State_History extends Horde_ActiveSync_State_Base * @param string $type The type of change (change, delete, flags) * @param array $change A stat/change hash describing the change * @param integer $origin Flag to indicate the origin of the change. + * @param string $user The current sync user, only needed if change + * origin is CHANGE_ORIGIN_PIM * * @return void */ - public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA) + public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA, $user = null) { if ($origin == Horde_ActiveSync::CHANGE_ORIGIN_PIM) { - $sql = 'INSERT INTO ' . $this->_syncMapTable . ' (message_uid, sync_modtime, sync_key, sync_devid, sync_folderid) VALUES (?, ?, ?, ?, ?)'; + $sql = 'INSERT INTO ' . $this->_syncMapTable . ' (message_uid, sync_modtime, sync_key, sync_devid, sync_folderid, sync_user) VALUES (?, ?, ?, ?, ?, ?)'; try { - $this->_db->insert($sql, array($change['id'], $change['mod'], $this->_syncKey, $this->_devId, $change['parent'])); + $this->_db->insert($sql, array($change['id'], $change['mod'], $this->_syncKey, $this->_devId, $change['parent'], $user)); } catch (Horde_Db_Exception $e) { $this->_logger->err($e->getMessage()); throw new Horde_ActiveSync_Exception($e);