function loadApplicationConfig() { require_once 'Zend/Config/Ini.php'; $default = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV, array('allowModifications' => true)); $options = $default->toArray(); return $options; }
/** * Initialize module config options * * @return void */ protected function _initConfig() { // load ini file $config = new Zend_Config_Ini(MODULES_PATH . '/' . $this->_module['folder'] . '/configs/module.ini', APPLICATION_ENV); $this->setOptions($config->toArray()); Zend_Registry::set($this->_module['folder'] . 'Config', $this->_config = $config); }
private function __construct() { $pathToFile = APPLICATION_PATH . '/configs/xhprof.ini'; if (file_exists($pathToFile)) { $xhprofIni = new Zend_Config_Ini($pathToFile); if (null == ($config = $xhprofIni->get(APPLICATION_ENV)) && null == ($config = $xhprofIni->get('default'))) { require_once 'Zend/Application/Exception.php'; throw new Zend_Application_Exception("Błędne ustawienia dla XHprof w pliku xhprof.ini"); } $this->_xhprofConfigData = $config; if (null !== $this->_xhprofConfigData && $this->_xhprofConfigData->count() >= 1) { $dbAdapter = new Zend_Db_Adapter_Pdo_Pgsql(array( 'host' => $this->_xhprofConfigData->get('xhprof')->db->host, 'username' => $this->_xhprofConfigData->get('xhprof')->db->username, 'password' => $this->_xhprofConfigData->get('xhprof')->db->password, 'dbname' => $this->_xhprofConfigData->get('xhprof')->db->dbname, 'port' => $this->_xhprofConfigData->get('xhprof')->db->port )); $this->_dbAdapter = $dbAdapter; } } }
/** Post database upgrade. */ public function postUpgrade() { /** @var SettingModel $settingModel */ $settingModel = MidasLoader::loadModel('Setting'); $configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini'; if (file_exists($configPath)) { $config = new Zend_Config_Ini($configPath, 'global'); $settingModel->setConfig(DICOMEXTRACTOR_DCM2XML_COMMAND_KEY, $config->get('dcm2xml', DICOMEXTRACTOR_DCM2XML_COMMAND_DEFAULT_VALUE), $this->moduleName); $settingModel->setConfig(DICOMEXTRACTOR_DCMJ2PNM_COMMAND_KEY, $config->get('dcmj2pnm', DICOMEXTRACTOR_DCMJ2PNM_COMMAND_DEFAULT_VALUE), $this->moduleName); $settingModel->setConfig(DICOMEXTRACTOR_DCMFTEST_COMMAND_KEY, $config->get('dcmftest', DICOMEXTRACTOR_DCMFTEST_COMMAND_DEFAULT_VALUE), $this->moduleName); $settingModel->setConfig(DICOMEXTRACTOR_DCMDICTPATH_KEY, $config->get('dcmdictpath', DICOMEXTRACTOR_DCMDICTPATH_DEFAULT_VALUE), $this->moduleName); $config = new Zend_Config_Ini($configPath, null, true); unset($config->global->dcm2xml); unset($config->global->dcmj2pnm); unset($config->global->dcmftest); unset($config->global->dcmdictpath); $writer = new Zend_Config_Writer_Ini(); $writer->setConfig($config); $writer->setFilename($configPath); $writer->write(); } else { $settingModel->setConfig(DICOMEXTRACTOR_DCM2XML_COMMAND_KEY, DICOMEXTRACTOR_DCM2XML_COMMAND_DEFAULT_VALUE, $this->moduleName); $settingModel->setConfig(DICOMEXTRACTOR_DCMJ2PNM_COMMAND_KEY, DICOMEXTRACTOR_DCMJ2PNM_COMMAND_DEFAULT_VALUE, $this->moduleName); $settingModel->setConfig(DICOMEXTRACTOR_DCMFTEST_COMMAND_KEY, DICOMEXTRACTOR_DCMFTEST_COMMAND_DEFAULT_VALUE, $this->moduleName); $settingModel->setConfig(DICOMEXTRACTOR_DCMDICTPATH_KEY, DICOMEXTRACTOR_DCMDICTPATH_DEFAULT_VALUE, $this->moduleName); } }
/** Post database upgrade. */ public function postUpgrade() { /** @var RandomComponent $randomComponent */ $randomComponent = MidasLoader::loadComponent('Random'); $securityKey = $randomComponent->generateString(32); /** @var SettingModel $settingModel */ $settingModel = MidasLoader::loadModel('Setting'); $configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini'; if (file_exists($configPath)) { $config = new Zend_Config_Ini($configPath, 'global'); $settingModel->setConfig(MIDAS_REMOTEPROCESSING_SECURITY_KEY_KEY, $config->get('securitykey', $securityKey), $this->moduleName); $showButton = $config->get('showbutton'); if ($showButton === 'true') { $showButton = 1; } elseif ($showButton === 'false') { $showButton = 0; } else { $showButton = MIDAS_REMOTEPROCESSING_SHOW_BUTTON_DEFAULT_VALUE; } $settingModel->setConfig(MIDAS_REMOTEPROCESSING_SHOW_BUTTON_KEY, $showButton, $this->moduleName); $config = new Zend_Config_Ini($configPath, null, true); unset($config->securitykey->securitykey); unset($config->showbutton->showbutton); $writer = new Zend_Config_Writer_Ini(); $writer->setConfig($config); $writer->setFilename($configPath); $writer->write(); } else { $settingModel->setConfig(MIDAS_REMOTEPROCESSING_SECURITY_KEY_KEY, $securityKey, $this->moduleName); $settingModel->setConfig(MIDAS_REMOTEPROCESSING_SHOW_BUTTON_KEY, MIDAS_REMOTEPROCESSING_SHOW_BUTTON_DEFAULT_VALUE, $this->moduleName); } }
/** * Initialize plugins hook system */ function init_plugins() { include APPPATH . 'config/cache.php'; $feEngine = $config['plugins_frontend_engine']; $feOptions = $config['plugins_frontend']; $beEngine = $config['plugins_backend_engine']; $beOptions = $config['plugins_backend']; if (isset($beOptions['cache_dir']) && !file_exists($beOptions['cache_dir'])) { mkdir($beOptions['cache_dir']); chmod($beOptions['cache_dir'], 0777); } $cache = Zend_Cache::factory($feEngine, $beEngine, $feOptions, $beOptions); $pluginsConfigArray = $cache->load('pluginsConfig'); if (!$pluginsConfigArray) { $pluginsConfigArray = array(); $pluginConfDirHandler = opendir(APPPATH . 'config/plugins'); while (false !== ($pluginConfigFile = readdir($pluginConfDirHandler))) { if (preg_match('~^.*?\\.ini$~si', $pluginConfigFile)) { try { $pluginConfig = new Zend_Config_Ini(APPPATH . 'config/plugins/' . $pluginConfigFile, 'plugins'); $pluginsConfigArray = array_merge_recursive($pluginsConfigArray, $pluginConfig->toArray()); } catch (Exception $e) { } } } closedir($pluginConfDirHandler); $cache->save($pluginsConfigArray, 'pluginsConfig'); } Zend_Registry::getInstance()->set('pluginsConfig', new Zend_Config($pluginsConfigArray)); }
protected static function loadErrors() { if (!is_array(self::$errors)) { $config = new \Zend_Config_Ini(APPLICATION_PATH . '/configs/errors.ini'); self::$errors = $config->get('errors')->toArray(); } }
/** Post database upgrade. */ public function postUpgrade() { /** @var SettingModel $settingModel */ $settingModel = MidasLoader::loadModel('Setting'); $configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini'; if (file_exists($configPath)) { $config = new Zend_Config_Ini($configPath, 'global'); $settingModel->setConfig(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY, MIDAS_THUMBNAILCREATOR_PROVIDER_PHMAGICK, $this->moduleName); $settingModel->setConfig(MIDAS_THUMBNAILCREATOR_FORMAT_KEY, MIDAS_THUMBNAILCREATOR_FORMAT_JPG, $this->moduleName); $settingModel->setConfig(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY, $config->get('imagemagick', MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_DEFAULT_VALUE), $this->moduleName); $settingModel->setConfig(MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY, $config->get('useThumbnailer', MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_DEFAULT_VALUE), $this->moduleName); $settingModel->setConfig(MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY, $config->get('thumbnailer', MIDAS_THUMBNAILCREATOR_THUMBNAILER_DEFAULT_VALUE), $this->moduleName); $config = new Zend_Config_Ini($configPath, null, true); unset($config->global->imageFormats); unset($config->global->imagemagick); unset($config->global->thumbnailer); unset($config->global->useThumbnailer); $writer = new Zend_Config_Writer_Ini(); $writer->setConfig($config); $writer->setFilename($configPath); $writer->write(); } else { $settingModel->setConfig(MIDAS_THUMBNAILCREATOR_PROVIDER_KEY, MIDAS_THUMBNAILCREATOR_PROVIDER_DEFAULT_VALUE, $this->moduleName); $settingModel->setConfig(MIDAS_THUMBNAILCREATOR_FORMAT_KEY, MIDAS_THUMBNAILCREATOR_FORMAT_DEFAULT_VALUE, $this->moduleName); $settingModel->setConfig(MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_KEY, MIDAS_THUMBNAILCREATOR_IMAGE_MAGICK_DEFAULT_VALUE, $this->moduleName); $settingModel->setConfig(MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_KEY, MIDAS_THUMBNAILCREATOR_USE_THUMBNAILER_DEFAULT_VALUE, $this->moduleName); $settingModel->setConfig(MIDAS_THUMBNAILCREATOR_THUMBNAILER_KEY, MIDAS_THUMBNAILCREATOR_THUMBNAILER_DEFAULT_VALUE, $this->moduleName); } }
protected function _initSession() { $configSession = new Zend_Config_Ini(APPLICATION_PATH . '/configs/session.ini', APPLICATION_ENV); if (!$this->_request->isInstalling()) { $config = array('name' => 'session', 'primary' => 'session_id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime', 'lifetime' => $configSession->gc_maxlifetime); Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config)); } if (!$this->_request->isInstalling() or is_writable(Core_Model_Directory::getSessionDirectory(true))) { $types = array(); $options = $configSession->toArray(); if (isset($options['types'])) { $types = $options['types']; unset($options['types']); } Zend_Session::start($options); $session_type = $this->_request->isApplication() ? 'mobile' : 'front'; $session = new Core_Model_Session($session_type); foreach ($types as $type => $class) { $session->addType($type, $class); } $language_session = new Core_Model_Session('language'); if (!$language_session->current_language) { $language_session->current_language = null; } Core_Model_Language::setSession($language_session); Core_View_Default::setSession($session); Core_Controller_Default::setSession($session); } }
/** Post database upgrade. */ public function postUpgrade() { /** @var SettingModel $settingModel */ $settingModel = MidasLoader::loadModel('Setting'); $configPath = LOCAL_CONFIGS_PATH . DIRECTORY_SEPARATOR . $this->moduleName . '.local.ini'; if (file_exists($configPath)) { $config = new Zend_Config_Ini($configPath, 'global'); $piwikUrl = isset($config->piwik->url) ? $config->piwik->url : STATISTICS_PIWIK_URL_DEFAULT_VALUE; $settingModel->setConfig(STATISTICS_PIWIK_URL_KEY, $piwikUrl, $this->moduleName); $piwikId = isset($config->piwik->id) ? $config->piwik->id : STATISTICS_PIWIK_SITE_ID_DEFAULT_VALUE; $settingModel->setConfig(STATISTICS_PIWIK_SITE_ID_KEY, $piwikId, $this->moduleName); $piwikApiKey = isset($config->piwik->apikey) ? $config->piwik->apikey : STATISTICS_PIWIK_API_KEY_DEFAULT_VALUE; $settingModel->setConfig(STATISTICS_PIWIK_API_KEY_KEY, $piwikApiKey, $this->moduleName); $ipInfoDbApiKey = isset($config->ipinfodb->apikey) ? $config->ipinfodb->apikey : STATISTICS_IP_INFO_DB_API_KEY_DEFAULT_VALUE; $settingModel->setConfig(STATISTICS_IP_INFO_DB_API_KEY_KEY, $ipInfoDbApiKey, $this->moduleName); $settingModel->setConfig(STATISTICS_SEND_DAILY_REPORTS_KEY, $config->get('report', STATISTICS_SEND_DAILY_REPORTS_DEFAULT_VALUE), $this->moduleName); $config = new Zend_Config_Ini($configPath, null, true); unset($config->global->piwik->url); unset($config->global->piwik->id); unset($config->global->piwik->pikey); unset($config->global->ipinfodb->apikey); unset($config->global->report); $writer = new Zend_Config_Writer_Ini(); $writer->setConfig($config); $writer->setFilename($configPath); $writer->write(); } else { $settingModel->setConfig(STATISTICS_PIWIK_URL_KEY, STATISTICS_PIWIK_URL_DEFAULT_VALUE, $this->moduleName); $settingModel->setConfig(STATISTICS_PIWIK_SITE_ID_KEY, STATISTICS_PIWIK_SITE_ID_DEFAULT_VALUE, $this->moduleName); $settingModel->setConfig(STATISTICS_PIWIK_API_KEY_KEY, STATISTICS_PIWIK_API_KEY_DEFAULT_VALUE, $this->moduleName); $settingModel->setConfig(STATISTICS_IP_INFO_DB_API_KEY_KEY, STATISTICS_IP_INFO_DB_API_KEY_DEFAULT_VALUE, $this->moduleName); $settingModel->setConfig(STATISTICS_SEND_DAILY_REPORTS_KEY, STATISTICS_SEND_DAILY_REPORTS_DEFAULT_VALUE, $this->moduleName); } }
/** * * @return Zend_Application */ public static function getApplication() { $application = new Zend_Application(APPLICATION_ENV); $applicationini = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", APPLICATION_ENV); $options = $applicationini->toArray(); foreach (self::$_ini as $value) { $iniFile = APPLICATION_PATH . self::$_pathConfig . $value; if (is_readable($iniFile)) { $config = new Zend_Config_Ini($iniFile); $options = $application->mergeOptions($options, $config->toArray()); } else { throw new Zend_Exception('error en la configuracion de los .ini'); } } // foreach (self::$_ini as $value) { // $iniFile = APPLICATION_PATH . self::$_pathConfig . $value; // // if (is_readable($iniFile)) { // $config = new Zend_Config_Ini($iniFile); // $options = $application->mergeOptions($options, // $config->toArray()); // } else { // throw new Zend_Exception('error en la configuracion de los .ini'); // } // } Zend_Registry::set('config', $options); $a = $application->setOptions($options); return $application; }
protected function _initSession() { $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/sessions.ini', 'development'); Zend_Session::setOptions($config->toArray()); // start session Zend_Session::start(); }
/** Post database upgrade. */ public function postUpgrade() { /** @var SettingModel $settingModel */ $settingModel = MidasLoader::loadModel('Setting'); $config = new Zend_Config_Ini(APPLICATION_CONFIG, 'global'); $settingModel->setConfig('address_verification', $config->get('verifyemail', 0), 'mail'); if ($config->get('smtpfromaddress')) { $fromAddress = $config->get('smtpfromaddress'); } elseif (ini_get('sendmail_from')) { $fromAddress = ini_get('sendmail_from'); } else { $fromAddress = '*****@*****.**'; // RFC2606 } $settingModel->setConfig('from_address', $fromAddress, 'mail'); if ($config->get('smtpserver')) { $components = parse_url($config->get('smtpserver')); if (isset($components['host'])) { $settingModel->setConfig('smtp_host', $components['host'], 'mail'); } if (isset($components['port'])) { $settingModel->setConfig('smtp_port', $components['port'], 'mail'); if ($components['port'] === 587) { $settingModel->setConfig('smtp_use_ssl', 1, 'mail'); } } if (isset($components['user'])) { $settingModel->setConfig('smtp_username', $components['user'], 'mail'); } if (isset($components['pass'])) { $settingModel->setConfig('smtp_password', $components['pass'], 'mail'); } } if ($config->get('smtpuser')) { $settingModel->setConfig('smtp_username', $config->get('smtpuser'), 'mail'); } if ($config->get('smtppassword')) { $settingModel->setConfig('smtp_password', $config->get('smtppassword'), 'mail'); } if ($settingModel->getValueByName('smtp_host', 'mail')) { $provider = 'smtp'; } else { $provider = 'mail'; } $settingModel->setConfig('provider', $provider, 'mail'); /** @var UtilityComponent $utilityComponent */ $utilityComponent = MidasLoader::loadComponent('Utility'); $utilityComponent->installModule('mail'); $config = new Zend_Config_Ini(APPLICATION_CONFIG, null, true); unset($config->global->smtpfromaddress); unset($config->global->smtpserver); unset($config->global->smtpuser); unset($config->global->smtppassword); unset($config->global->verifyemail); $writer = new Zend_Config_Writer_Ini(); $writer->setConfig($config); $writer->setFilename(APPLICATION_CONFIG); $writer->write(); }
public function setUp() { parent::setUp(); $config = new Zend_Config_Ini(dirname(__FILE__) . "/KAsyncCaptureThumbTest.ini"); $testConfig = $config->get('config'); $this->outputFolder = dirname(__FILE__) . '/' . $testConfig->outputFolder; $this->testsConfig = $config->get('tests'); }
private static function getRecipients($docid, $rec_num = -1) { $db = Zend_Db_Table_Abstract::getDefaultAdapter(); $sql = "select AV.VAL\r\nfrom V_ADD_VALUES AV\r\nwhere AV.NODEID = ?\r\nand AV.FIELDNAME = '_ADD_RECIPIENTS'"; $rec = $db->fetchOne($sql, $docid); $rec = new Zend_Config_Ini('data://,' . $rec); return $rec->toArray(); }
/** * * @return Zend_Config_Ini */ public function getConfig() { $this->config = new Zend_Config_Ini(array_shift($this->configFiles), $this->section, true); foreach ($this->configFiles as $file) { $this->config->merge(new Zend_Config_Ini($file, $this->section, true)); } return $this->config; }
/** * Load configuration file of options * * @param string $file * @return array */ protected function _loadConfig($file, $environment) { $configCommon = new Zend_Config_Ini($file, $environment, true); $configCustom = new Zend_Config_Ini(str_replace('.common.ini', '.ini', $file), $environment); $configCommon->merge($configCustom); $configCommon->path->root = getcwd(); $config = new System_Config_Placeholder($configCommon); return $config->toArray(); }
protected function _initConfig() { $config = new Zend_Config($this->getOptions(), true); Zend_Registry::set('config', $config); // TODO faut-il utiliser les sessions ou les registres ? $configSession = new Zend_Config_Ini(__DIR__ . '/configs/session.ini', APPLICATION_ENV); Zend_Session::setOptions($configSession->toArray()); return $config; }
/** * Save all values from config to ZendRegistry */ protected function _initLocalConfigs() { $allconfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/config.ini'); $envconfig = $allconfig->toArray(); $registry = new Zend_Registry($envconfig[APPLICATION_ENV], ArrayObject::ARRAY_AS_PROPS); foreach ($registry as $key => $value) { Zend_Registry::set($key, $value); } }
public function addNewsAction() { $options = $this->getInvokeArg('bootstrap')->getOptions(); $configDir = $options['path']['configs']; $config = new Zend_Config_Ini($configDir . '/agregator.ini', 'korespondent'); $data = $config->toArray(); $news = new Spider_News($data); $news->setLogger($this->getLog()); $news->process(); }
function __construct() { $config = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini"); $class = $config->get(APPLICATION_ENV)->toArray(); $conf = $class['mail']['conf']; $smtp = $class['mail']['smtpServer']; $this->_transport = new Zend_Mail_Transport_Smtp($smtp, $conf); $this->setFrom($class['mail']['from']['email'], $class['mail']['from']['nameEmail']); $this->_destinatario = array(); }
public function load($file, $type = null) { $file = $this->locator->locate($file); $type = $type ?: pathinfo($file, PATHINFO_EXTENSION); switch ($type) { case 'php': $data = (require $file); $config = new \Zend_Config($data); break; case 'xml': $config = new \Zend_Config_Xml($file); break; case 'ini': $config = new \Zend_Config_Ini($file, "routes"); break; } $data = $config->toArray(); if (isset($data['routes'])) { $data = $data['routes']; } $collection = new RouteCollection(); foreach ($data as $routeName => $config) { if (isset($config['type']) && $config['type'] == "Zend_Controller_Router_Route_Regex") { throw new \InvalidArgumentException("Not supported"); } if (!isset($config['reqs'])) { $config['reqs'] = array(); } if (!isset($config['defaults'])) { $config['defaults'] = array(); } if (!isset($config['options'])) { $config['options'] = array(); } if (!isset($config['defaults']['module'])) { // TODO: DefaultModule config $config['defaults']['module'] = 'Default'; } if (!isset($config['defaults']['controller'])) { $config['defaults']['controller'] = 'Index'; } if (!isset($config['defaults']['action'])) { $config['defaults']['action'] = 'index'; } $config['defaults']['_controller'] = sprintf('%sBundle:%s:%s', $config['defaults']['module'], $config['defaults']['controller'], $config['defaults']['action']); if (preg_match_all('(:([^/]+)+)', $config['route'], $matches)) { for ($i = 0; $i < count($matches[0]); $i++) { $config['route'] = str_replace($matches[0][$i], "{" . $matches[1][$i] . "}", $config['route']); } } $route = new Route($config['route'], $config['defaults'], $config['reqs'], $config['options']); $collection->add($routeName, $route); } return $collection; }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->db = \Zend_Db::factory('pdo_sqlite', array('dbname' => ':memory:')); \Zend_Registry::set('db', $this->db); $settings = new \Zend_Config_Ini(GEMS_ROOT_DIR . '/configs/application.example.ini', APPLICATION_ENV); $sa = $settings->toArray(); $this->loader = new \Gems_Loader(\Zend_Registry::getInstance(), $sa['loaderDirs']); \Zend_Registry::set('loader', $this->loader); $this->tracker = $this->loader->getTracker(); \Zend_Registry::set('tracker', $this->tracker); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); $this->db = $this->getConnection()->getConnection(); \Zend_Registry::set('db', $this->db); \Zend_Db_Table::setDefaultAdapter($this->db); $settings = new \Zend_Config_Ini(GEMS_ROOT_DIR . '/configs/application.example.ini', APPLICATION_ENV); $sa = $settings->toArray(); $this->loader = new \Gems_Loader(\Zend_Registry::getInstance(), $sa['loaderDirs']); \Zend_Registry::set('loader', $this->loader); }
private function getModuleConfig($moduleName) { $aConfig = array(); try { $config = new Zend_Config_Ini(APPLICATION_PATH . DS . 'configs' . DS . $moduleName . DS . 'view.ini', APPLICATION_ENV); $aConfig = $config->toArray(); } catch (Zend_Config_Exception $e) { Zend_Debug::dump($e->getMessage()); } return $aConfig; }
/** * * @throws ZendT_Exception */ private function _init() { $_config = new Zend_Config_Ini($this->_configIni, APPLICATION_ENV); $this->_configs = $_config->toArray(); if ($this->_documentRoot == '') { throw new ZendT_Exception('"documentRoot" não configurado!'); } if ($this->_object == '') { throw new ZendT_Exception('"object" não informado!'); } }
protected function _bootstrap() { //Now let's parse the module specific configuration //Path might change however this is probably the one you won't ever need to change... //And also don't forget to use the current staging environment by sending the APP_ENV parameter to the Zend_Config $_conf = new Zend_Config_Ini(APPLICATION_PATH . "/modules/" . strtolower($this->getModuleName()) . "/config/application.ini", APPLICATION_ENV); $this->_options = array_merge($this->_options, $_conf->toArray()); //Let's merge the both arrays so that we can use them together... parent::_bootstrap(); //Well our custom bootstrap logic should end with the actual bootstrapping, now that we have merged both configs, we can go on... }
protected function parseFrameworkConfig() { if (!$this->isValidFrameworkFiles()) { return; } $frameworkIni = $this->getFrameworkIni(); require_once 'Zend/Config/Ini.php'; $objConfig = new \Zend_Config_Ini(realpath($frameworkIni), $this->getEnvironment()); $arrConfig = $objConfig->toArray(); if (isset($arrConfig['resources']['db'])) { $this->config = $arrConfig['resources']['db']; } }
public function _initDoctrine() { $conn = new Zend_Config_Ini(APPLICATION_PATH . '/configs/doctrine.ini'); $config = new Configuration(); $cache = new Cache(); $config->setMetadataCacheImpl($cache); AnnotationRegistry::registerFile('Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'); $driver = new Doctrine\ORM\Mapping\Driver\AnnotationDriver(new Doctrine\Common\Annotations\AnnotationReader(), array(APPLICATION_PATH . '/models/entities')); $config->setMetadataDriverImpl($driver); $config->setProxyDir(APPLICATION_PATH . '/models/entities/proxies'); $config->setProxyNamespace('Application\\Models\\Proxies'); $this->_entityManager = EntityManager::create($conn->toArray(), $config); }
protected function _initLog() { $this->bootstrap('config'); $this->bootstrap('autoloaders'); $this->bootstrap('timezone'); $loggerConfigPath = realpath(APPLICATION_PATH . '/../configurations/logger.ini'); $loggerConfig = new Zend_Config_Ini($loggerConfigPath); $configSettings = Zend_Registry::get('config')->settings; $loggerName = $configSettings->loggerName; $appLogger = $loggerConfig->get($loggerName); KalturaLog::initLog($appLogger); KalturaLog::debug('starting request'); }