/** * * @return void */ protected function _initializeConfig() { $configFiles = $this->configuration->getConfigPaths('config/notify.yml'); $config = sfDefineEnvironmentConfigHandler::getConfiguration($configFiles); foreach ($config as $name => $value) { sfConfig::set("sf_notify_{$name}", $value); } }
public function initialize() { $configFiles = $this->configuration->getConfigPaths('config/phpunit.yml'); $config = sfDefineEnvironmentConfigHandler::getConfiguration($configFiles); foreach ($config as $name => $value) { sfConfig::set("sf_phpunit_{$name}", $value); } $this->_getProjectConfiguration()->getEventDispatcher()->connect('plugin.post_install', array($this, 'postInstall')); }
protected function getValues($prefix, $category, $keys) { if ('enabled' == $category) { $this->enabled = $this->replaceConstants($keys); } else { if ('loggers' == $category) { $this->loggers = $this->replaceConstants($keys); return array(); } } return parent::getValues($prefix, $category, $keys); }
/** * @param sfProjectConfiguration $configuration * * @return fpErrorNotifier */ public static function initialize(sfProjectConfiguration $configuration) { if (empty(self::$instance)) { $configFiles = $configuration->getConfigPaths('config/notify.yml'); $config = sfDefineEnvironmentConfigHandler::getConfiguration($configFiles); foreach ($config as $name => $value) { sfConfig::set("sf_notify_{$name}", $value); } self::$instance = new self($configuration->getEventDispatcher()); self::getInstance()->handler()->initialize(); } return self::$instance; }
<?php $configFiles = $this->getConfigPaths('config/notify.yml'); $config = sfDefineEnvironmentConfigHandler::getConfiguration($configFiles); foreach ($config as $name => $value) { sfConfig::set("sf_notify_{$name}", $value); } fpErrorNotifier::setInstance(new fpErrorNotifier($this->getEventDispatcher())); fpErrorNotifier::getInstance()->handler()->initialize();
protected function getAppRouting($application) { if (isset($this->appRoutings[$application])) { return $this->appRoutings[$application]; } $context = sfContext::getInstance(); $configuration = $context->getConfiguration(); $config = new opRoutingConfigHandler(); $currentApp = sfConfig::get('sf_app'); sfConfig::set('sf_app', $application); $configuration->setAppDir(sfConfig::get('sf_apps_dir') . DIRECTORY_SEPARATOR . $application); $settings = sfDefineEnvironmentConfigHandler::getConfiguration($configuration->getConfigPaths('config/settings.yml')); $isNoScriptName = !empty($settings['.settings']['no_script_name']); $options = $context->getRouting()->getOptions(); $url = sfConfig::get('op_base_url'); if ('http://example.com' !== $url) { $parts = parse_url($url); $parts['path'] = isset($parts['path']) ? $parts['path'] : '/'; $parts['host'] = isset($parts['host']) ? $parts['host'] : ''; $options['context'] = array('prefix' => $this->getAppScriptName($application, sfConfig::get('sf_environment'), $parts['path'], $isNoScriptName), 'host' => $parts['host']); } $routing = new sfPatternRouting($context->getEventDispatcher(), null, $options); $routing->setRoutes($config->evaluate($configuration->getConfigPaths('config/routing.yml'))); $context->getEventDispatcher()->notify(new sfEvent($routing, 'routing.load_configuration')); sfConfig::set('sf_app', $currentApp); $configuration->setAppDir(sfConfig::get('sf_apps_dir') . DIRECTORY_SEPARATOR . $currentApp); $this->appRoutings[$application] = $routing; return $this->appRoutings[$application]; }
protected function getAppRouting($application) { if (isset($this->appRoutings[$application])) { return $this->appRoutings[$application]; } $context = sfContext::getInstance(); $configuration = $context->getConfiguration(); $config = new opRoutingConfigHandler(); $currentApp = sfConfig::get('sf_app'); sfConfig::set('sf_app', $application); $configuration->setAppDir(sfConfig::get('sf_apps_dir') . DIRECTORY_SEPARATOR . $application); $settings = sfDefineEnvironmentConfigHandler::getConfiguration($configuration->getConfigPaths('config/settings.yml')); $isNoScriptName = !empty($settings['.settings']['no_script_name']); $options = $context->getRouting()->getOptions(); if ($options['context']['is_secure']) { $sslBaseUrls = sfConfig::get('op_ssl_base_url'); $url = $sslBaseUrls[$application]; $isDefault = 'https://example.com' === $url; } else { $url = sfConfig::get('op_base_url'); $isDefault = 'http://example.com' === $url; } if (!$isDefault) { $parts = parse_url($url); $parts['path'] = isset($parts['path']) ? $parts['path'] : ''; $options['context']['prefix'] = $this->getAppScriptName($application, sfConfig::get('sf_environment'), $parts['path'], $isNoScriptName); if (isset($parts['host'])) { $options['context']['host'] = $parts['host']; if (isset($parts['port'])) { $options['context']['host'] .= ':' . $parts['port']; } } } else { $path = preg_replace('#/[^/]+\\.php$#', '', $options['context']['prefix']); $options['context']['prefix'] = $this->getAppScriptName($application, sfConfig::get('sf_environment'), $path, $isNoScriptName); } $routing = new sfPatternRouting($context->getEventDispatcher(), null, $options); $routing->setRoutes($config->evaluate($configuration->getConfigPaths('config/routing.yml'))); $context->getEventDispatcher()->notify(new sfEvent($routing, 'routing.load_configuration')); sfConfig::set('sf_app', $currentApp); $configuration->setAppDir(sfConfig::get('sf_apps_dir') . DIRECTORY_SEPARATOR . $currentApp); $this->appRoutings[$application] = $routing; return $this->appRoutings[$application]; }
/* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); sfConfig::set('sf_symfony_lib_dir', realpath(dirname(__FILE__).'/../../../lib')); $t = new lime_test(1); // prefix $handler = new sfDefineEnvironmentConfigHandler(); $handler->initialize(array('prefix' => 'sf_')); $dir = dirname(__FILE__).DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'sfDefineEnvironmentConfigHandler'.DIRECTORY_SEPARATOR; $files = array( $dir.'prefix_default.yml', $dir.'prefix_all.yml', ); sfConfig::set('sf_environment', 'prod'); $data = $handler->execute($files); $data = preg_replace('#date\: \d+/\d+/\d+ \d+\:\d+\:\d+#', '', $data); $t->is($data, str_replace("\r\n", "\n", file_get_contents($dir.'prefix_result.php')));