public function testArrayHash()
 {
     $hash = Tinebase_Helper::arrayHash(array('foo' => 'bar'));
     $this->assertEquals('37b51d194a7513e45b56f6524f2d51f2', $hash);
     $hash = Tinebase_Helper::arrayHash(array('foo' => 'bar'), true);
     $this->assertEquals('3858f62230ac3c915f300c664312c63f', $hash);
 }
コード例 #2
0
 /**
  * get hash of installed applications
  *
  * @param string $_sort optional the column name to sort by
  * @param string $_dir optional the sort direction can be ASC or DESC only
  * @param string $_filter optional search parameter
  * @param int $_limit optional how many applications to return
  * @param int $_start optional offset for applications
  * @return string
  */
 public function getApplicationsHash($_filter = NULL, $_sort = null, $_dir = 'ASC', $_start = NULL, $_limit = NULL)
 {
     $applications = $this->getApplications($_filter, $_sort, $_dir, $_start, $_limit);
     // create a hash of installed applications and their versions
     $applications = array_combine(Tinebase_Application::getInstance()->getApplications()->id, Tinebase_Application::getInstance()->getApplications()->version);
     ksort($applications);
     return Tinebase_Helper::arrayHash($applications, true);
 }
コード例 #3
0
 /**
  * get by id
  *
  * @param string $_id
  * @param int $_containerId
  * @return Expressomail_Model_Account
  */
 public function get($_id, $_containerId = NULL)
 {
     Tinebase_Core::setupCache();
     $cache = Tinebase_Core::getCache();
     $cacheId = Tinebase_Helper::arrayHash(array(Tinebase_Core::getUser()->accountId, $_id));
     $record = $cache->load($cacheId);
     if ($record === FALSE) {
         $record = parent::get($_id, $_containerId);
         if ($record->user_id !== Tinebase_Core::getUser()->accountId) {
             $record = new Expressomail_Model_Account();
         }
         if ($record->type == Expressomail_Model_Account::TYPE_SYSTEM) {
             $this->_addSystemAccountConfigValues($record);
         }
         $cache->save($record, $cacheId, array('expressomailAccount'));
     }
     return $record;
 }