/**
  * Makes an API call given a call name and arguments checkout
  * http://developers.sugarcrm.com/documentation.php for documentation on the
  * specific API calls
  *
  * @param string $call_name the API call name
  * @param array $call_arguments the arguments for the API call
  * @return array
  */
 private function rest_request($call_name, $call_arguments)
 {
     if (!$this->logged_in && $call_name != 'login') {
         try {
             if (!$this->connect()) {
                 return array();
             }
         } catch (\Exception $e) {
             throw $e;
         }
         $call_arguments['session'] = $this->session;
     }
     $request = $this->getCurl();
     $request->addData(array('method' => $call_name, 'input_type' => 'JSON', 'response_type' => 'JSON', 'rest_data' => json_encode($call_arguments)));
     if ($call_name == 'set_entry') {
         $request->addHeaders(array('Expect' => ' '));
     }
     $output = $request->post();
     $response_data = json_decode(html_entity_decode($output['body']), true);
     if (isset($response_data['number']) && $response_data['number'] == 11 && $this->cache) {
         $this->cache->remove('suiteSession');
         $this->logged_in = FALSE;
         $response_data = $this->rest_request($call_name, $call_arguments);
     }
     return $response_data;
 }
Пример #2
0
 /**
  * Remove a cached item
  *
  * @param string $id Cache ID
  * @return boolean
  * @throws coding_exception
  */
 public function remove($id)
 {
     if ($this->cache === false) {
         return true;
     }
     try {
         return $this->cache->remove($id);
     } catch (Zend_Cache_Exception $e) {
         throw new coding_exception('Zend Cache Error: ' . $e->getMessage());
     }
 }
Пример #3
0
 /**
  * remove cache value by key & prefix
  * 
  * @param string  $key the key in the cache container
  * @param string  $prefix    the prefix used for grouping
  * 
  * @return mixed the value in the cache if success to unset, else false
  */
 public function remove($key, $prefix = null)
 {
     $value = $this->get($key, $prefix);
     if (!is_null($prefix)) {
         $prevPrefix = $this->addPrefix($prefix);
     }
     if ($this->cache->remove($key) !== FALSE) {
         return $value;
     }
     if (!is_null($prefix)) {
         $this->setPrefix($prevPrefix);
     }
     return FALSE;
 }
Пример #4
0
 /**
  * Delete a message from the queue
  *
  * @param  string  $handle
  * @return boolean
  */
 public function deleteMessage($handle)
 {
     return $this->_cache->remove($handle);
 }