/**
  * testComposeConfigDir
  *
  * @see 0010988: load additional config from conf.d
  */
 public function testComposeConfigDir()
 {
     $confdfolder = Tinebase_Config::getInstance()->get(Tinebase_Config::CONFD_FOLDER);
     if (empty($confdfolder) || !is_readable($confdfolder)) {
         $this->markTestSkipped('no confdfolder configured/readable');
     }
     $configValues = array('config1' => 'value1', 'config2' => 'value2');
     foreach ($configValues as $configName => $expectedValue) {
         $configValue = Tinebase_Config::getInstance()->get($configName);
         $this->assertEquals($expectedValue, $configValue);
     }
     $cachedConfigFilename = Tinebase_Core::guessTempDir() . DIRECTORY_SEPARATOR . 'cachedConfig.inc.php';
     $this->assertTrue(file_exists($cachedConfigFilename), 'cached config file does not exist: ' . $cachedConfigFilename);
 }
コード例 #2
0
 /**
  * clear the cache
  * @param   array $appFilter
  */
 public function clearCache($appFilter = null)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Clearing config cache');
     }
     if (Tinebase_Core::get(Tinebase_Core::SHAREDCACHE)) {
         if (isset($appFilter)) {
             list($key, $value) = each($appFilter);
             $appName = $key === 'name' ? $value : Tinebase_Application::getInstance()->getApplicationById($value)->name;
         } else {
             $appName = $this->_appName;
         }
         Tinebase_Core::getCache()->remove('cachedAppConfig_' . $appName);
     }
     Tinebase_Cache_PerRequest::getInstance()->reset('Tinebase_Config_Abstract');
     $cachedConfigFile = Tinebase_Core::guessTempDir() . DIRECTORY_SEPARATOR . 'cachedConfig.inc.php';
     if (file_exists($cachedConfigFile)) {
         unlink($cachedConfigFile);
     }
     // reset class caches last because they would be filled again by Tinebase_Core::guessTempDir()
     self::$_configFileData = null;
     $this->_cachedApplicationConfig = null;
 }
コード例 #3
0
 /**
  * get session dir string (without PATH_SEP at the end)
  *
  * @return string
  */
 public static function getSessionDir()
 {
     $config = Tinebase_Core::getConfig();
     $sessionDir = $config->session && $config->session->path ? $config->session->path : null;
     #####################################
     # LEGACY/COMPATIBILITY:
     # (1) had to rename session.save_path key to sessiondir because otherwise the
     # generic save config method would interpret the "_" as array key/value seperator
     # (2) moved session config to subgroup 'session'
     if (empty($sessionDir)) {
         foreach (array('session.save_path', 'sessiondir') as $deprecatedSessionDir) {
             $sessionDir = $config->get($deprecatedSessionDir, null);
             if ($sessionDir) {
                 Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . " config.inc.php key '{$deprecatedSessionDir}' should be renamed to 'path' and moved to 'session' group.");
             }
         }
     }
     #####################################
     if (empty($sessionDir) || !@is_writable($sessionDir)) {
         $sessionDir = session_save_path();
         if (empty($sessionDir) || !@is_writable($sessionDir)) {
             $sessionDir = Tinebase_Core::guessTempDir();
         }
         $sessionDirName = self::SESSION_DIR_NAME;
         $sessionDir .= DIRECTORY_SEPARATOR . $sessionDirName;
     }
     Tinebase_Core::getLogger()->DEBUG(__METHOD__ . '::' . __LINE__ . " Using session dir: " . $sessionDir);
     return $sessionDir;
 }
コード例 #4
0
 /**
  * create new excel document
  *
  * @return void
  */
 protected function _createDocument()
 {
     // this looks stupid, but the PHPDoc library is beta, so this is needed. otherwise the lib would create temp files in the template folder ;(
     $templateFile = $this->_getTemplateFilename();
     $tempTemplateFile = Tinebase_Core::guessTempDir() . DIRECTORY_SEPARATOR . Tinebase_Record_Abstract::generateUID() . '.docx';
     copy($templateFile, $tempTemplateFile);
     $this->_docObject = new PHPWord();
     if ($templateFile !== NULL) {
         $this->_docTemplate = $this->_docObject->loadTemplate($tempTemplateFile);
     }
     unlink($tempTemplateFile);
 }