From a341c421d2159a7d978cee04f7fe398766114ac5 Mon Sep 17 00:00:00 2001 From: Michael J Rubinsky Date: Thu, 14 Nov 2013 08:34:25 -0500 Subject: [PATCH] Revert "Catch Horde_Mongo_Exception" This reverts commit eaa3990898b6770e6a4f1c87b110ea90f8995d7c. --- .../lib/Horde/ActiveSync/State/Mongo.php | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/State/Mongo.php b/framework/ActiveSync/lib/Horde/ActiveSync/State/Mongo.php index 5c9d08d256c..450a98d2e73 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/State/Mongo.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/State/Mongo.php @@ -154,7 +154,7 @@ class Horde_ActiveSync_State_Mongo extends Horde_ActiveSync_State_Base implement * Const'r * * @param array $params Must contain: - * - connection: (Horde_Mongo_Client The Horde_Mongo instance. + * - connection: (Horde_Mongo_Client The Horde_Db instance. * * @return Horde_ActiveSync_State_Sql */ @@ -194,7 +194,7 @@ public function updateServerIdInState($uid, $serverid) try { $cursor = $this->_db->HAS_state->find($query, array('sync_data')); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -213,7 +213,7 @@ public function updateServerIdInState($uid, $serverid) array('$set' => array('sync_data' => $folder)), array('multiple' => true) ); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -239,7 +239,7 @@ protected function _loadState($type) $results = $this->_db->HAS_state->findOne( array('_id' => $this->_syncKey), array('sync_data', 'sync_devid', 'sync_mod', 'sync_pending')); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err('Error in loading state from DB: ' . $e->getMessage()); throw new Horde_ActiveSync_Exception($e); } @@ -334,7 +334,7 @@ public function save() serialize($document))); try { $this->_db->HAS_state->insert($document); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { // Might exist already if the last sync attempt failed. $this->_logger->notice( sprintf('[%s] Error saving state for synckey %s: %s - removing previous sync state and trying again.', @@ -344,7 +344,7 @@ public function save() try { $this->_db->HAS_state->remove(array('_id' => $this->_syncKey)); $this->_db->HAS_state->insert($document); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { throw new Horde_ActiveSync_Exception('Error saving state.'); } } @@ -441,7 +441,7 @@ public function updateState( } try { $this->_db->HAS_mailmap->insert($document); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { throw Horde_ActiveSync_Exception($e); } break; @@ -460,7 +460,7 @@ public function updateState( try { $this->_db->HAS_map->insert($document); - } catch (Horde_Mongo_Exception $e) { + } catch (Horde_Db_Exception $e) { throw new Horde_ActiveSync_Exception($e); } break; @@ -526,7 +526,7 @@ public function loadDeviceInfo($devId, $user = null) try { $device_data = $this->_db->HAS_device->findOne($query); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err($e->getMessage()); throw new Horde_ActiveSync_Exception($e); } @@ -582,7 +582,7 @@ public function setDeviceInfo(Horde_ActiveSync_Device $data, array $dirty = arra array('$set' => $device), array('upsert' => true) ); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err($e->getMessage()); throw new Horde_ActiveSync_Exception($e); } @@ -603,7 +603,7 @@ public function setDeviceInfo(Horde_ActiveSync_Device $data, array $dirty = arra array('_id' => $data->id), array('$addToSet' => array('users' => $user_data)) ); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err($e->getMessage()); throw new Horde_ActiveSync_Exception($e); } @@ -632,7 +632,7 @@ public function setDeviceProperties(array $data, $deviceId) ); try { $this->_db->HAS_device->update($query, $update); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err($e->getMessage()); throw new Horde_ActiveSync_Exception($e); } @@ -658,7 +658,7 @@ public function deviceExists($devId, $user = null) try { return $this->_db->HAS_device->find($query)->limit(1)->count(); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err($e->getMessage()); throw new Horde_ActiveSync_Exception($e); } @@ -681,7 +681,7 @@ public function listDevices($user = null) } try { $cursor = $this->_db->HAS_device->find($query); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err($e->getMessage()); throw new Horde_ActiveSync_Exception($e); } @@ -719,7 +719,7 @@ public function resetAllPolicyKeys() // array('$set' => array('users.device_policykey' => 0)), // array('multiple' => true) // ); - // } catch (Horde_Mongo_Exception $e) { + // } catch (Exception $e) { // $this->_logger->err($e->getMessage()); // throw new Horde_ActiveSync_Exception($e); // } @@ -753,7 +753,7 @@ public function setDeviceRWStatus($devId, $status) $update = array('$set' => $new_data); try { $this->_db->HAS_device->update($query, $update); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err($e->getMessage()); throw new Horde_ActiveSync_Exception($e); } @@ -786,7 +786,7 @@ protected function _resetDeviceState($id) $this->_db->HAS_state->remove($query); $this->_db->HAS_map->remove($query); $this->_db->HAS_mailmap->remove($query); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err($e->getMessage()); throw new Horde_ActiveSync_Exception($e); } @@ -835,7 +835,7 @@ public function getLastSyncTimestamp($id = null, $user = null) array('$match' => $match), array('$group' => array('_id' => '$sync_dev', 'max' => array('$max' => '$sync_timestamp'))) ); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -906,7 +906,7 @@ public function removeState(array $options) ); try { $results = $this->_db->HAS_device->findOne($query, array('_id')); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -948,7 +948,7 @@ public function removeState(array $options) array('_id' => $options['devId'], 'users.device_user' => $options['user']), array('$pull' => array('users' => array('device_user' => $options['user']))) ); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -969,7 +969,7 @@ public function removeState(array $options) // Remove device data. try { $this->_db->HAS_device->remove(array('_id' => $options['devId'])); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -993,7 +993,7 @@ public function removeState(array $options) array('users.device_user'), array('$pull' => array('users' => array('device_user' => $options['user']))) ); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err($e->getMessage()); throw new Horde_ActiveSync_Exception($e); } @@ -1014,7 +1014,7 @@ public function removeState(array $options) $this->_db->HAS_map->remove($query); $this->_db->HAS_mailmap->remove($query); $this->_db->HAS_device->remove(array('users' => array('$size' => 0))); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -1048,7 +1048,7 @@ public function isDuplicatePIMAddition($id) $query, array('message_uid') ); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -1099,7 +1099,7 @@ public function getSyncCache($devid, $user, array $fields = null) $query, $projection ); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -1167,7 +1167,7 @@ public function saveSyncCache(array $cache, $devid, $user, array $dirty = array( array('$set' => $update), array('upsert' => true) ); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -1201,7 +1201,7 @@ public function deleteSyncCache($devid, $user = null) try { $this->_db->HAS_cache->remove($params); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -1251,7 +1251,7 @@ protected function _getPIMChangeTS(array $changes) array('$group' => array('_id' => '$message_uid', 'max' => array('$max' => '$sync_modtime'))) ); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -1300,7 +1300,7 @@ protected function _havePIMChanges() ); try { return (bool)$c->find($query, array('_id'))->count(); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -1400,7 +1400,7 @@ function() { try { $this->_db->HAS_state->remove($query); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid, @@ -1431,7 +1431,7 @@ function() { ); try { $c->remove($query); - } catch (Horde_Mongo_Exception $e) { + } catch (Exception $e) { $this->_logger->err(sprintf( '[%s] %s', $this->_procid,