public function unRegister() { $db = Zend_Registry::get('my_db'); $agentsR = new AgentRegistered($db); $where = 'agent_id = ' . $this->agentId . ' and unregister_timestamp is null and context_id = ' . $_SESSION['CONTEXT_ID'] . ' and zone_id =' . $_SESSION['ZONE_ID']; $data = array(DBConvertor::convertCase('unregister_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime())); $n = $agentsR->update($data, $where); if ($n == 1) { $where = 'agent_id = ' . $this->agentId . ' and context_id = ' . $_SESSION['CONTEXT_ID'] . ' and zone_id = ' . $_SESSION['ZONE_ID']; $agentPro = new AgentProvisions($db); $agentPro->delete($where); $agentSub = new AgentSubscriptions($db); $agentSub->delete($where); switch (DB_TYPE) { case 'mysql': $where = 'zone_id = ' . $_SESSION['ZONE_ID'] . ' and context_id = ' . $_SESSION['CONTEXT_ID'] . ' and agt_id_out = ' . $this->agentId; $queue = new MessageQueues($db); $queue->delete($where); break; case 'oci8': null; break; } return true; } else { return false; } }