Пример #1
0
 /**
  * init tine framework
  */
 protected function _initFramework()
 {
     $this->_setupCliConfig();
     Tinebase_Core::setupTempDir();
     Tinebase_Core::setupServerTimezone();
     Tinebase_Core::setupLogger();
     Tinebase_Core::setupStreamWrapper();
     Tinebase_Core::setupSession();
     Tinebase_Core::set(Tinebase_Core::LOCALE, new Zend_Locale('en_US'));
     Tinebase_Core::set(Tinebase_Core::USERTIMEZONE, 'UTC');
     Tinebase_Core::setupDatabaseConnection();
     Tinebase_Core::setupCache();
     Tinebase_Core::setupUserTimezone();
     Tinebase_Core::setupUserLocale();
 }
 /**
  * init the environment
  *
  */
 protected function _init()
 {
     // init environment
     Tinebase_Core::setupConfig();
     Tinebase_Core::setupLogger();
     Tinebase_Core::set('locale', new Zend_Locale('de_DE'));
     Tinebase_Core::set(Tinebase_Core::USERTIMEZONE, 'UTC');
     Tinebase_Core::setupDatabaseConnection();
     Tinebase_Core::setupCache();
 }
 /**
  * init tine framework
  */
 public static function initFramework()
 {
     // avoid autostart of sessions
     Zend_Session::setOptions(array('strict' => true));
     Tinebase_Core::setupTempDir();
     Tinebase_Core::setupStreamWrapper();
     //Cache must be setup before User Locale because otherwise Zend_Locale tries to setup
     //its own cache handler which might result in a open_basedir restriction depending on the php.ini settings
     Tinebase_Core::setupCache();
     Tinebase_Core::setupBuildConstants();
     // setup a temporary user locale. This will be overwritten later but we
     // need to handle exceptions during initialisation process such as session timeout
     // @todo add fallback locale to config file
     Tinebase_Core::set('locale', new Zend_Locale('en_US'));
     Tinebase_Core::setupUserLocale();
     Tinebase_Core::enableProfiling();
     if (PHP_SAPI !== 'cli') {
         header('X-API: http://www.tine20.org/apidocs/tine20/');
         if (isset($_SERVER['HTTP_X_TRANSACTIONID'])) {
             header('X-TransactionID: ' . substr($_SERVER['HTTP_X_TRANSACTIONID'], 1, -1) . ';' . $_SERVER['SERVER_NAME'] . ';16.4.5009.816;' . date('Y-m-d H:i:s') . ' UTC;265.1558 ms');
         }
     }
 }
 /**
  * setup the cache and add it to zend registry
  * 
  * Ignores {@param $_enabled} and always sets it to false
  *
  */
 public static function setupCache($_enabled = true)
 {
     // disable caching for setup
     parent::setupCache(false);
 }
 /**
  * clear cache
  *
  * @return void
  */
 protected function _clearCache()
 {
     // setup cache (via tinebase because it is disabled in setup by default)
     Tinebase_Core::setupCache(TRUE);
     Setup_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Clearing cache ...');
     // clear cache
     $cache = Setup_Core::getCache()->clean(Zend_Cache::CLEANING_MODE_ALL);
     // deactivate cache again
     Tinebase_Core::setupCache(FALSE);
 }
 /**
  * get cache from the registry
  *
  * @return Zend_Cache_Core the cache
  */
 public static function getCache()
 {
     if (!self::get(self::CACHE) instanceof Zend_Cache_Core) {
         self::$cacheStatus = null;
         Tinebase_Core::setupCache();
     }
     return self::get(self::CACHE);
 }
 /**
  * invalidate cache for this account
  *
  * @param Expressomail_Model_Account $_account
  * @return void
  */
 protected function _invalidateAccountCache(Expressomail_Model_Account $_account)
 {
     Tinebase_Core::setupCache();
     $cache = Tinebase_Core::getCache();
     $cacheId = Tinebase_Core::createCacheId(array(Tinebase_Core::getUser()->accountId, $_account->getId()));
     $_filter = new Expressomail_Model_AccountFilter(array());
     //Cleans cache generate in user login, when the method seach is called with a empty filter.
     $cacheSearch = Tinebase_Core::createCacheId(array('Expressomail_Controller_Account_search', Tinebase_Core::getUser()->accountId, $_filter->toArray()));
     $cache->remove($cacheId);
     $cache->remove($cacheSearch);
 }
 /**
  * fill class cache with all config records for this app
  */
 protected function _loadAllAppConfigsInCache()
 {
     if (empty($this->_appName)) {
         if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
             Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' appName not set');
         }
         $this->_cachedApplicationConfig = array();
     }
     if (!Tinebase_Application::getInstance()->getInstance()->isInstalled('Tinebase')) {
         $this->_cachedApplicationConfig = array();
         return;
     }
     $cache = Tinebase_Core::getCache();
     if (!is_object($cache)) {
         Tinebase_Core::setupCache();
         $cache = Tinebase_Core::getCache();
     }
     if (Tinebase_Core::get(Tinebase_Core::SHAREDCACHE)) {
         if ($cachedApplicationConfig = $cache->load('cachedAppConfig_' . $this->_appName)) {
             $this->_cachedApplicationConfig = $cachedApplicationConfig;
             return;
         }
     }
     try {
         $applicationId = Tinebase_Model_Application::convertApplicationIdToInt($this->_appName);
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Loading all configs for app ' . $this->_appName);
         }
         $filter = new Tinebase_Model_ConfigFilter(array(array('field' => 'application_id', 'operator' => 'equals', 'value' => $applicationId)));
         $allConfigs = $this->_getBackend()->search($filter);
     } catch (Zend_Db_Exception $zdae) {
         // DB might not exist or tables are not created, yet
         Tinebase_Exception::log($zdae);
         $this->_cachedApplicationConfig = array();
         return;
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Found ' . count($allConfigs) . ' configs.');
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($allConfigs->toArray(), TRUE));
     }
     foreach ($allConfigs as $config) {
         $this->_cachedApplicationConfig[$config->name] = $config;
     }
     if (Tinebase_Core::get(Tinebase_Core::SHAREDCACHE)) {
         $cache->save($this->_cachedApplicationConfig, 'cachedAppConfig_' . $this->_appName);
     }
 }
 /**
  * update one record
  *
  * @param   Tinebase_Record_Interface $_record
  * @param   boolean $_duplicateCheck
  * @return  Tinebase_Record_Interface
  * @throws  Tinebase_Exception_AccessDenied
  *
  */
 public function update(Tinebase_Record_Interface $_record, $_duplicateCheck = TRUE)
 {
     $sharedSeenValue = $_record->shared_seen;
     $updatedRecord = parent::update($_record, $_duplicateCheck);
     if ($this->_checkSharedSeenSupport($_record)) {
         $updatedRecord->shared_seen_support = TRUE;
         if ($this->_setSharedSeenValue($_record, $sharedSeenValue)) {
             $updatedRecord->shared_seen = $sharedSeenValue;
         } else {
             Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' Imap command failed when setting sharedseen value!');
             $translate = Tinebase_Translation::getTranslation('Expressomail');
             $message = $translate->_('Imap command failed when setting sharedseen value!');
             throw new Expressomail_Exception_IMAPCommandFailed($message);
         }
     }
     Tinebase_Core::setupCache();
     $cache = Tinebase_Core::getCache();
     $cache->save($updatedRecord, $this->_createExpressomailModelAccountCacheId($updatedRecord->id), array('expressomailAccount'));
     return $updatedRecord;
 }
Пример #10
0
 /**
  * init tine framework
  */
 public static function initFramework()
 {
     Tinebase_Core::setupConfig();
     // Server Timezone must be setup before logger, as logger has timehandling!
     Tinebase_Core::setupServerTimezone();
     Tinebase_Core::setupLogger();
     // Database Connection must be setup before cache because setupCache uses constant "SQL_TABLE_PREFIX"
     Tinebase_Core::setupDatabaseConnection();
     Tinebase_Core::setupTempDir();
     Tinebase_Core::setupStreamWrapper();
     //Cache must be setup before User Locale because otherwise Zend_Locale tries to setup
     //its own cache handler which might result in a open_basedir restriction depending on the php.ini settings
     Tinebase_Core::setupCache();
     Tinebase_Core::setupSession();
     // setup a temporary user locale/timezone. This will be overwritten later but we
     // need to handle exceptions during initialisation process such as session timeout
     // @todo add fallback locale to config file
     Tinebase_Core::set('locale', new Zend_Locale('en_US'));
     Tinebase_Core::set('userTimeZone', 'UTC');
     //        Tinebase_Core::setupMailer();
     Tinebase_Core::setupUserCredentialCache();
     Tinebase_Core::setupUserTimezone();
     Tinebase_Core::setupUserLocale();
     header('X-API: http://www.tine20.org/apidocs/tine20/');
 }
Пример #11
0
 /**
  * init the environment
  *
  */
 protected function _init()
 {
     // init environment
     Tinebase_Core::setupConfig();
     Tinebase_Core::setupServerTimezone();
     Tinebase_Core::setupLogger();
     Tinebase_Core::set('locale', new Zend_Locale('de_DE'));
     Tinebase_Core::set('userTimeZone', 'UTC');
     Tinebase_Core::setupDatabaseConnection();
     Tinebase_Core::setupCache();
 }