Changeset 7614
- Timestamp:
- 02/26/08 18:38:26 (4 months ago)
- Files:
-
- branches/1.1/UPGRADE (modified) (3 diffs)
- branches/1.1/lib/action/sfAction.class.php (modified) (1 diff)
- branches/1.1/lib/autoload/sfAutoload.class.php (modified) (2 diffs)
- branches/1.1/lib/autoload/sfCoreAutoload.class.php (modified) (5 diffs)
- branches/1.1/lib/command/sfSymfonyCommandApplication.class.php (modified) (4 diffs)
- branches/1.1/lib/config/config/core_compile.yml (modified) (2 diffs)
- branches/1.1/lib/config/sfApplicationConfiguration.class.php (added)
- branches/1.1/lib/config/sfCompileConfigHandler.class.php (modified) (2 diffs)
- branches/1.1/lib/config/sfConfigCache.class.php (modified) (4 diffs)
- branches/1.1/lib/config/sfFactoryConfigHandler.class.php (modified) (1 diff)
- branches/1.1/lib/config/sfGeneratorConfigHandler.class.php (modified) (1 diff)
- branches/1.1/lib/config/sfLoader.class.php (modified) (2 diffs)
- branches/1.1/lib/config/sfProjectConfiguration.class.php (added)
- branches/1.1/lib/controller/default/templates/moduleSuccess.php (modified) (1 diff)
- branches/1.1/lib/controller/sfController.class.php (modified) (3 diffs)
- branches/1.1/lib/database/sfDatabaseManager.class.php (modified) (4 diffs)
- branches/1.1/lib/filter/sfFilterChain.class.php (modified) (1 diff)
- branches/1.1/lib/generator/sfCrudGenerator.class.php (modified) (1 diff)
- branches/1.1/lib/generator/sfGenerator.class.php (modified) (1 diff)
- branches/1.1/lib/generator/sfGeneratorManager.class.php (modified) (1 diff)
- branches/1.1/lib/i18n/extract/sfI18nModuleExtract.class.php (modified) (1 diff)
- branches/1.1/lib/i18n/sfI18N.class.php (modified) (6 diffs)
- branches/1.1/lib/plugins/sfCompat10Plugin/config/config.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfCompat10Plugin/lib/filter/sfValidationExecutionFilter.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfCompat10Plugin/lib/helper/PartialHelper.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfCompat10Plugin/lib/view/sfMailView.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/bootstrap/functional.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/apps/frontend/config/config.php (deleted)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/config/config.php (deleted)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/lib/ProjectConfiguration.class.php (added)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/lib/frontendConfiguration.class.php (added)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/symfony (modified) (1 diff)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/test/bootstrap/functional.php (modified) (2 diffs)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/test/bootstrap/unit.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/web/frontend_dev.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/web/index.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/config/config.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelCrudGenerator.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/sfPropelAutoload.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/sfPropelData.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/sfPropelManyToMany.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBaseTask.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildFormsTask.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataDumpTask.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataLoadTask.class.php (modified) (2 diffs)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelGenerateCrudTask.class.php (modified) (2 diffs)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelInitAdminTask.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/bootstrap/functional.php (modified) (2 diffs)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/backendTestBrowser.class.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/backend/config/config.php (deleted)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/crud/config/config.php (deleted)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/config/config.php (deleted)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/ProjectConfiguration.class.php (added)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/backendConfiguration.class.php (added)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/crudConfiguration.class.php (added)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/symfony (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/test/bootstrap/functional.php (modified) (2 diffs)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/test/bootstrap/unit.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/backend_dev.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/crud.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/crud_dev.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/index.php (modified) (1 diff)
- branches/1.1/lib/routing/sfPatternRouting.class.php (modified) (1 diff)
- branches/1.1/lib/task/generator/sfGenerateAppTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/generator/sfGenerateProjectTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/generator/skeleton/app/app/config/config.php (deleted)
- branches/1.1/lib/task/generator/skeleton/app/lib (added)
- branches/1.1/lib/task/generator/skeleton/app/lib/ApplicationConfiguration.class.php (added)
- branches/1.1/lib/task/generator/skeleton/app/web/index.php (modified) (1 diff)
- branches/1.1/lib/task/generator/skeleton/project/config/config.php (deleted)
- branches/1.1/lib/task/generator/skeleton/project/lib/ProjectConfiguration.class.php (added)
- branches/1.1/lib/task/generator/skeleton/project/symfony (modified) (1 diff)
- branches/1.1/lib/task/generator/skeleton/project/test/bootstrap/functional.php (modified) (1 diff)
- branches/1.1/lib/task/generator/skeleton/project/test/bootstrap/unit.php (modified) (1 diff)
- branches/1.1/lib/task/i18n/sfI18nExtractTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/i18n/sfI18nFindTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/project/sfProjectClearControllersTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/project/sfProjectFreezeTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/project/sfProjectUnfreezeTask.class.php (modified) (2 diffs)
- branches/1.1/lib/task/project/upgrade1.1/sfAutoloadingUpgrade.class.php (deleted)
- branches/1.1/lib/task/project/upgrade1.1/sfConfigUpgrade.class.php (modified) (1 diff)
- branches/1.1/lib/task/project/upgrade1.1/sfTestUpgrade.class.php (added)
- branches/1.1/lib/task/project/upgrade1.1/sfUpgrade.class.php (modified) (1 diff)
- branches/1.1/lib/task/sfBaseTask.class.php (modified) (3 diffs)
- branches/1.1/lib/util/sfBrowser.class.php (modified) (3 diffs)
- branches/1.1/lib/util/sfContext.class.php (modified) (7 diffs)
- branches/1.1/lib/util/sfCore.class.php (deleted)
- branches/1.1/lib/view/sfPHPView.class.php (modified) (2 diffs)
- branches/1.1/lib/view/sfPartialView.class.php (modified) (1 diff)
- branches/1.1/lib/view/sfViewCacheManager.class.php (modified) (1 diff)
- branches/1.1/test/bin/loc.php (modified) (1 diff)
- branches/1.1/test/bootstrap/functional.php (modified) (1 diff)
- branches/1.1/test/functional/configTest.php (deleted)
- branches/1.1/test/functional/fixtures/project/apps/cache/config/config.php (deleted)
- branches/1.1/test/functional/fixtures/project/apps/frontend/config/config.php (deleted)
- branches/1.1/test/functional/fixtures/project/apps/i18n/config/config.php (deleted)
- branches/1.1/test/functional/fixtures/project/config/config.php (deleted)
- branches/1.1/test/functional/fixtures/project/lib/ProjectConfiguration.class.php (added)
- branches/1.1/test/functional/fixtures/project/lib/cacheConfiguration.class.php (added)
- branches/1.1/test/functional/fixtures/project/lib/frontendConfiguration.class.php (added)
- branches/1.1/test/functional/fixtures/project/lib/i18nConfiguration.class.php (added)
- branches/1.1/test/functional/fixtures/project/symfony (modified) (1 diff)
- branches/1.1/test/functional/fixtures/project/test/bootstrap/functional.php (modified) (2 diffs)
- branches/1.1/test/functional/fixtures/project/test/bootstrap/unit.php (modified) (1 diff)
- branches/1.1/test/functional/fixtures/project/web/cache.php (modified) (1 diff)
- branches/1.1/test/functional/fixtures/project/web/cache_dev.php (modified) (1 diff)
- branches/1.1/test/functional/fixtures/project/web/frontend_dev.php (modified) (1 diff)
- branches/1.1/test/functional/fixtures/project/web/i18n.php (modified) (1 diff)
- branches/1.1/test/functional/fixtures/project/web/i18n_dev.php (modified) (1 diff)
- branches/1.1/test/functional/fixtures/project/web/index.php (modified) (1 diff)
- branches/1.1/test/other/tasksTest.php (modified) (1 diff)
- branches/1.1/test/unit/config/sfConfigCacheTest.php (modified) (1 diff)
- branches/1.1/test/unit/generator/sfGeneratorTest.php (modified) (1 diff)
- branches/1.1/test/unit/i18n/extract/sfI18nExtractTest.php (modified) (2 diffs)
- branches/1.1/test/unit/i18n/sfI18NTest.php (modified) (7 diffs)
- branches/1.1/test/unit/task/cache/sfCacheClearTaskTest.php (modified) (2 diffs)
- branches/1.1/test/unit/util/sfContextTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/UPGRADE
r7518 r7614 12 12 To upgrade a project: 13 13 14 * Upgrade symfony via PEAR or change your `config/config.php` 15 to update the symfony directory. 14 * If you don't use a SCM tool, please make a backup of your project. 15 As symfony replaces some files during the upgrade 16 (front controllers for example), you need a way to merge your 17 customizations after the upgrade. 16 18 17 19 * Update the `symfony` file located in the project root directory 18 by changing the line: 19 20 by changing those three lines: 21 22 [php] 23 chdir(dirname(__FILE__)); 24 include('config/config.php'); 20 25 include($sf_symfony_data_dir.'/bin/symfony.php'); 21 26 22 27 to 23 28 24 include($sf_symfony_lib_dir.'/command/cli.php'); 29 [php] 30 chdir(dirname(__FILE__)); 31 require_once(dirname(__FILE__).'/lib/ProjectConfiguration.class.php'); 32 $configuration = new ProjectConfiguration(); 33 include($configuration->getSymfonyLibDir().'/command/cli.php'); 34 35 You can also copy the skeleton file from the symfony project skeleton directly: 36 37 $ cp /path/to/symfony/lib/task/generator/skeleton/project/symfony symfony 38 39 * Create a `lib/ProjectConfiguration.class.php` file with the following content: 40 41 [php] 42 <?php 43 44 require_once '##SYMFONY_LIB_DIR##/autoload/sfCoreAutoload.class.php'; 45 sfCoreAutoload::register(); 46 47 class ProjectConfiguration extends sfProjectConfiguration 48 { 49 public function setup() 50 { 51 } 52 } 53 54 Then, replace `##SYMFONY_LIB_DIR##` with the path to the symfony 1.1 55 `lib/` directory. This is the new way to change the symfony version used 56 for your project. 57 58 You can also copy the skeleton file from the symfony project skeleton directly: 59 60 $ cp /path/to/symfony/lib/task/generator/skeleton/project/lib/ProjectConfiguration.class.php lib/ProjectConfiguration.class.php 25 61 26 62 * Launch the `project:upgrade1.1` task from your project directory … … 213 249 214 250 The `autoloading_function` setting in `settings.yml` is not used anymore. 215 You can register autoloading callables in the application `config.php`. 216 Here is the new default `config.php`: 217 218 [php] 219 <?php 220 221 // include project configuration 222 include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'); 223 224 // symfony bootstraping 225 require_once($sf_symfony_lib_dir.'/util/sfCore.class.php'); 226 sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir); 227 228 // insert your own autoloading callables here 229 230 if (sfConfig::get('sf_debug')) 231 { 232 spl_autoload_register(array('sfAutoload', 'autoloadAgain')); 233 } 251 You can register autoloading callables in your application configuration class. 234 252 235 253 Thanks to the new `sfAutoload::autoloadAgain()` method, you won't need to clear 236 254 the cache when you add or move classes in your project. This method will 237 255 automatically find the changes and flush the autoloading cache. 238 239 The `project:upgrade1.1` task makes all those changes for you.240 256 241 257 VERSION … … 466 482 467 483 The symfony core has been upgraded to take these changes into account. 484 485 sfLoader 486 -------- 487 488 All `sfLoader` static methods (except `::getHelperDirs()` and `::loadHelpers()`) 489 have been moved to the `sfProjectConfiguration` and `sfApplicationConfiguration` 490 classes: 491 492 * `sfProjectConfiguration`: 493 * `->getGeneratorSkeletonDirs()` 494 * `->getGeneratorTemplate()` 495 * `->getGeneratorTemplateDirs()` 496 * `->getModelDirs()` 497 498 * `sfApplicationConfiguration`: 499 * `->getControllerDirs()` 500 * `->getTemplateDirs()` 501 * `->getTemplateDir()` 502 * `->getTemplatePath()` 503 * `->getI18NGlobalDirs()` 504 * `->getI18NDirs()` 505 * `->getConfigPaths()` 506 507 sfCore 508 ------ 509 510 The `sfCore` has been removed. The code has been moved to `sfProjectConfiguration`, 511 `sfApplicationConfiguration`, and `sfContext` classes. 512 513 Front Controllers 514 ----------------- 515 516 All front controllers have to be upgraded. The SF_DEBUG, SF_APP, SF_ENVIRONMENT, 517 and SF_ROOT_DIR constants are gone. If you use some of these constants in your 518 project, please use their sfConfig::get('') counterparts: 519 520 *Old* | *New* 521 ----------------- | --------------------------------- 522 `SF_ROOT_DIR` | `sfConfig::get('sf_root_dir')` 523 `SF_ENVIRONMENT` | `sfConfig::get('sf_environment')` 524 `SF_APP` | `sfConfig::get('sf_app')` 525 `SF_DEBUG` | `sfConfig::get('sf_debug')` 526 527 The `project:upgrade1.1` task upgrades all front controllers for you. 528 If you made some customizations, symfony will issue a warning and won't 529 upgrade them automatically. You can then copy the default skeleton from 530 symfony: /path/to/symfony/lib/task/generator/skeleton/app/web/index.php 531 532 config.php 533 ---------- 534 535 All `config.php` files have been removed. The are replaced by the `ProjectConfiguration` 536 class and the application configuration classes. 537 538 If you've added some cutomizations in `config.php` files, you will have to migrate them 539 to those new classes. branches/1.1/lib/action/sfAction.class.php
r6668 r7614 36 36 37 37 // include security configuration 38 if ($file = sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name').'/'.$this->getModuleName().'/'.sfConfig::get('sf_app_module_config_dir_name').'/security.yml', true))38 if ($file = $context->getConfigCache()->checkConfig(sfConfig::get('sf_app_module_dir_name').'/'.$this->getModuleName().'/'.sfConfig::get('sf_app_module_config_dir_name').'/security.yml', true)) 39 39 { 40 40 require($file); branches/1.1/lib/autoload/sfAutoload.class.php
r7247 r7614 87 87 public function reloadClasses($force = false) 88 88 { 89 if ($force) 89 $configuration = sfProjectConfiguration::getActive(); 90 if (!$configuration || !$configuration instanceof sfApplicationConfiguration) 90 91 { 91 @unlink(sfConfigCache::getInstance()->getCacheName(sfConfig::get('sf_app_config_dir_name').'/autoload.yml'));92 return; 92 93 } 93 94 94 $file = sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_config_dir_name').'/autoload.yml'); 95 if ($force && file_exists($configuration->getConfigCache()->getCacheName('config/autoload.yml'))) 96 { 97 unlink($configuration->getConfigCache()->getCacheName('config/autoload.yml')); 98 } 99 100 $file = $configuration->getConfigCache()->checkConfig('config/autoload.yml'); 95 101 96 102 $this->classes = include($file); … … 125 131 } 126 132 127 function autoloadAgain($class)133 public function autoloadAgain($class) 128 134 { 129 135 self::reloadClasses(true); branches/1.1/lib/autoload/sfCoreAutoload.class.php
r7452 r7614 158 158 'sfFormatter' => 'command', 159 159 'sfSymfonyCommandApplication' => 'command', 160 'sfApplicationConfiguration' => 'config', 160 161 'sfAutoloadConfigHandler' => 'config', 161 162 'sfCacheConfigHandler' => 'config', … … 170 171 'sfGeneratorConfigHandler' => 'config', 171 172 'sfLoader' => 'config', 173 'sfProjectConfiguration' => 'config', 172 174 'sfRootConfigHandler' => 'config', 173 175 'sfRoutingConfigHandler' => 'config', … … 315 317 'sfProjectUnfreezeTask' => 'task/project', 316 318 'sfUpgradeTo11Task' => 'task/project', 317 'sfAutoloadingUpgrade' => 'task/project/upgrade1.1',318 319 'sfComponentUpgrade' => 'task/project/upgrade1.1', 319 320 'sfConfigFileUpgrade' => 'task/project/upgrade1.1', … … 325 326 'sfPropelUpgrade' => 'task/project/upgrade1.1', 326 327 'sfSingletonUpgrade' => 'task/project/upgrade1.1', 328 'sfTestUpgrade' => 'task/project/upgrade1.1', 327 329 'sfUpgrade' => 'task/project/upgrade1.1', 328 330 'sfWebDebugUpgrade' => 'task/project/upgrade1.1', … … 341 343 'sfCallable' => 'util', 342 344 'sfContext' => 'util', 343 'sfCore' => 'util',344 345 'sfDomCssSelector' => 'util', 345 346 'sfFinder' => 'util', branches/1.1/lib/command/sfSymfonyCommandApplication.class.php
r7467 r7614 31 31 } 32 32 33 // initialize symfony core autoloading 34 require_once($this->options['symfony_lib_dir'].'/autoload/sfCoreAutoload.class.php'); 35 sfCoreAutoload::getInstance()->register(); 33 $configuration = new sfProjectConfiguration(getcwd()); 36 34 37 35 // application … … 39 37 $this->setVersion(SYMFONY_VERSION); 40 38 41 $this->initializeEnvironment($this->options['symfony_lib_dir']);42 39 $this->initializeTasks(); 43 40 } … … 74 71 75 72 /** 76 * Initializes the environment variables and include path.77 *78 * @param string The symfony lib directory79 */80 protected function initializeEnvironment($symfonyLibDir)81 {82 sfConfig::set('sf_symfony_lib_dir', $symfonyLibDir);83 84 // directory layout85 sfCore::initDirectoryLayout(getcwd());86 87 // include path88 set_include_path(89 sfConfig::get('sf_lib_dir').PATH_SEPARATOR.90 sfConfig::get('sf_app_lib_dir').PATH_SEPARATOR.91 sfConfig::get('sf_model_dir').PATH_SEPARATOR.92 get_include_path()93 );94 }95 96 /**97 73 * Loads all available tasks. 98 74 * … … 102 78 { 103 79 $dirs = array( 104 sfConfig::get('sf_symfony_lib_dir').'/task', // symfony tasks105 sfConfig::get('sf_symfony_lib_dir').'/plugins/*/lib/task', // bundled plugin tasks106 sfConfig::get('sf_plugins_dir').'/*/lib/task', // plugin tasks107 sfConfig::get('sf_lib_dir').'/task', // project tasks80 sfConfig::get('sf_symfony_lib_dir').'/task', // symfony tasks 81 sfConfig::get('sf_symfony_lib_dir').'/plugins/*/lib/task', // bundled plugin tasks 82 sfConfig::get('sf_plugins_dir').'/*/lib/task', // plugin tasks 83 sfConfig::get('sf_lib_dir').'/task', // project tasks 108 84 ); 109 85 $finder = sfFinder::type('file')->name('*Task.class.php'); 86 110 87 foreach ($dirs as $globDir) 111 88 { branches/1.1/lib/config/config/core_compile.yml
r5320 r7614 4 4 - %SF_SYMFONY_LIB_DIR%/action/sfActionStack.class.php 5 5 - %SF_SYMFONY_LIB_DIR%/action/sfActionStackEntry.class.php 6 #- %SF_SYMFONY_LIB_DIR%/config/sfLoader.class.php7 6 - %SF_SYMFONY_LIB_DIR%/controller/sfController.class.php 8 7 - %SF_SYMFONY_LIB_DIR%/database/sfDatabaseManager.class.php 9 - %SF_SYMFONY_LIB_DIR%/event/sfEvent.class.php10 - %SF_SYMFONY_LIB_DIR%/event/sfEventDispatcher.class.php11 8 - %SF_SYMFONY_LIB_DIR%/filter/sfFilter.class.php 12 9 - %SF_SYMFONY_LIB_DIR%/filter/sfCommonFilter.class.php … … 18 15 - %SF_SYMFONY_LIB_DIR%/storage/sfStorage.class.php 19 16 - %SF_SYMFONY_LIB_DIR%/user/sfUser.class.php 20 #- %SF_SYMFONY_LIB_DIR%/util/sfContext.class.php21 #- %SF_SYMFONY_LIB_DIR%/validator/sfValidatorManager.class.php22 #- %SF_SYMFONY_LIB_DIR%/util/sfParameterHolder.class.php23 17 - %SF_SYMFONY_LIB_DIR%/view/sfView.class.php 24 18 25 19 # these classes are optionals but very likely to be used (in web context) 26 #- %SF_SYMFONY_LIB_DIR%/controller/sfRouting.class.php27 20 - %SF_SYMFONY_LIB_DIR%/controller/sfWebController.class.php 28 21 - %SF_SYMFONY_LIB_DIR%/controller/sfFrontWebController.class.php branches/1.1/lib/config/sfCompileConfigHandler.class.php
r7370 r7614 65 65 66 66 // insert configuration files 67 $contents = preg_replace_callback(array('#(require|include)(_once)?\((sfConfigCache::getInstance\(\)|\$configCache)->checkConfig\([^_]+sf_app_config_dir_name[^\.]*\.\'/([^\']+)\'\)\);#m',68 '#()()(sfCon figCache::getInstance\(\)|\$configCache)->import\(.sf_app_config_dir_name\.\'/([^\']+)\'(, false)?\);#m'),67 /* $contents = preg_replace_callback(array('#(require|include)(_once)?\((sfContext::getInstance\(\)\->getConfigCache\(\)|\$configCache)->checkConfig\(\'config/([^\']+)\'\)\);#m', 68 '#()()(sfContext::getInstance\(\)\->getConfigCache\(\)|\$configCache)->import\(\'config/([^\']+)\'(, false)?\);#m'), 69 69 array($this, 'insertConfigFileCallback'), $contents); 70 70 */ 71 71 // strip php tags 72 72 $contents = sfToolkit::pregtr($contents, array('/^\s*<\?(php)?/m' => '', … … 103 103 $configFile = sfConfig::get('sf_app_config_dir_name').'/'.$matches[4]; 104 104 105 sfConfigCache::getInstance()->checkConfig($configFile); 105 $configCache = sfContext::getInstance()->getConfigCache(); 106 $configCache->checkConfig($configFile); 106 107 107 $config = "// '$configFile' config file\n". 108 file_get_contents(sfConfigCache::getInstance()->getCacheName($configFile)); 108 $config = "// '$configFile' config file\n".file_get_contents($configCache->getCacheName($configFile)); 109 109 110 110 return $config; branches/1.1/lib/config/sfConfigCache.class.php
r7436 r7614 24 24 { 25 25 protected 26 $handlers = array(), 27 $userHandlers = array(); 28 29 protected static 30 $instance = null; 31 32 /** 33 * Retrieves the singleton instance of this class. 34 * 35 * @return sfConfigCache A sfConfigCache instance 36 */ 37 public static function getInstance() 38 { 39 if (!self::$instance) 40 { 41 self::$instance = new sfConfigCache(); 42 } 43 44 return self::$instance; 26 $configuration = null, 27 $handlers = array(), 28 $userHandlers = array(); 29 30 /** 31 * Constructor 32 * 33 * @param sfApplicationConfiguration A sfApplicationConfiguration instance 34 */ 35 public function __construct(sfApplicationConfiguration $configuration) 36 { 37 $this->configuration = $configuration; 45 38 } 46 39 … … 140 133 * 141 134 * If the configuration file path is relative, symfony will look in directories 142 * defined in the sf Loader::getConfigPaths() method.135 * defined in the sfConfiguration::getConfigPaths() method. 143 136 * 144 137 * @param string A filesystem path to a configuration file … … 148 141 * @throws <b>sfConfigurationException</b> If a requested configuration file does not exist 149 142 * 150 * @see sf Loader::getConfigPaths()143 * @see sfConfiguration::getConfigPaths() 151 144 */ 152 145 public function checkConfig($configPath, $optional = false) … … 167 160 if (!sfToolkit::isPathAbsolute($configPath)) 168 161 { 169 $files = sfLoader::getConfigPaths($configPath);162 $files = $this->configuration->getConfigPaths($configPath); 170 163 } 171 164 else branches/1.1/lib/config/sfFactoryConfigHandler.class.php
r7518 r7614 155 155 " \$class = sfConfig::get('sf_factory_i18n', '%s');\n". 156 156 "%s". 157 " \$this->factories['i18n'] = new \$class(\$this-> dispatcher, \$cache, %s);\n".157 " \$this->factories['i18n'] = new \$class(\$this->configuration, \$cache, %s);\n". 158 158 " }\n" 159 159 , $class, $cache, var_export($parameters, true) branches/1.1/lib/config/sfGeneratorConfigHandler.class.php
r6457 r7614 60 60 61 61 // generate class and add a reference to it 62 $generatorManager = new sfGeneratorManager( );62 $generatorManager = new sfGeneratorManager(sfContext::getInstance()->getConfiguration()); 63 63 64 64 // generator parameters branches/1.1/lib/config/sfLoader.class.php
r7302 r7614 19 19 class sfLoader 20 20 { 21 /**22 * Gets directories where model classes are stored.23 *24 * @return array An array of directories25 */26 static public function getModelDirs()27 {28 $dirs = array(sfConfig::get('sf_lib_dir').'/model' ? sfConfig::get('sf_lib_dir').'/model' : 'lib/model'); // project29 if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/lib/model'))30 {31 $dirs = array_merge($dirs, $pluginDirs); // plugins32 }33 34 return $dirs;35 }36 37 /**38 * Gets directories where controller classes are stored for a given module.39 *40 * @param string The module name41 *42 * @return array An array of directories43 */44 static public function getControllerDirs($moduleName)45 {46 $suffix = $moduleName.'/'.sfConfig::get('sf_app_module_action_dir_name');47 48 $dirs = array();49 foreach (sfConfig::get('sf_module_dirs', array()) as $key => $value)50 {51 $dirs[$key.'/'.$suffix] = $value;52 }53 54 $dirs[sfConfig::get('sf_app_module_dir').'/'.$suffix] = false; // application55 56 if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/modules/'.$suffix))57 {58 $dirs = array_merge($dirs, array_combine($pluginDirs, array_fill(0, count($pluginDirs), true))); // plugins59 }60 61 $dirs[sfConfig::get('sf_symfony_lib_dir').'/controller/'.$suffix] = true; // core modules62 63 return $dirs;64 }65 66 /**67 * Gets directories where template files are stored for a given module.68 *69 * @param string The module name70 *71 * @return array An array of directories72 */73 static public function getTemplateDirs($moduleName)74 {75 $suffix = $moduleName.'/'.sfConfig::get('sf_app_module_template_dir_name');76 77 $dirs = array();78 foreach (sfConfig::get('sf_module_dirs', array()) as $key => $value)79 {80 $dirs[] = $key.'/'.$suffix;81 }82 83 $dirs[] = sfConfig::get('sf_app_module_dir').'/'.$suffix; // application84 85 if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/modules/'.$suffix))86 {87 $dirs = array_merge($dirs, $pluginDirs); // plugins88 }89 90 $dirs[] = sfConfig::get('sf_symfony_lib_dir').'/controller/'.$suffix; // core modules91 $dirs[] = sfConfig::get('sf_module_cache_dir').'/auto'.ucfirst($suffix); // generated templates in cache92 93 return $dirs;94 }95 96 /**97 * Gets the template directory to use for a given module and template file.98 *99 * @param string The module name100 * @param string The template file101 *102 * @return string A template directory103 */104 static public function getTemplateDir($moduleName, $templateFile)105 {106 $dirs = self::getTemplateDirs($moduleName);107 foreach ($dirs as $dir)108 {109 if (is_readable($dir.'/'.$templateFile))110 {111 return $dir;112 }113 }114 115 return null;116 }117 118 /**119 * Gets the template to use for a given module and template file.120 *121 * @param string The module name122 * @param string The template file123 *124 * @return string A template path125 */126 static public function getTemplatePath($moduleName, $templateFile)127 {128 $dir = self::getTemplateDir($moduleName, $templateFile);129 130 return $dir ? $dir.'/'.$templateFile : null;131 }132 133 /**134 * Gets the i18n directories to use globally.135 *136 * @return array An array of i18n directories137 */138 static public function getI18NGlobalDirs()139 {140 $dirs = array();141 142 // application143 if (is_dir($dir = sfConfig::get('sf_app_dir').'/'.sfConfig::get('sf_app_module_i18n_dir_name')))144 {145 $dirs[] = $dir;146 }147 148 // plugins149 $pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/'.sfConfig::get('sf_app_module_i18n_dir_name'));150 if (isset($pluginDirs[0]))151 {152 $dirs[] = $pluginDirs[0];153 }154 155 return $dirs;156 }157 158 /**159 * Gets the i18n directories to use for a given module.160 *161 * @param string The module name162 *163 * @return array An array of i18n directories164 */165 static public function getI18NDirs($moduleName)166 {167 $dirs = array();168 169 // module170 if (is_dir($dir = sfConfig::get('sf_app_module_dir').'/'.$moduleName.'/'.sfConfig::get('sf_app_module_i18n_dir_name')))171 {172 $dirs[] = $dir;173 }174 175 // application176 if (is_dir($dir = sfConfig::get('sf_app_dir').'/'.sfConfig::get('sf_app_module_i18n_dir_name')))177 {178 $dirs[] = $dir;179 }180 181 // module in plugins182 $pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/modules/'.$moduleName.'/'.sfConfig::get('sf_app_module_i18n_dir_name'));183 if (isset($pluginDirs[0]))184 {185 $dirs[] = $pluginDirs[0];186 }187 188 // plugins189 $pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/'.sfConfig::get('sf_app_module_i18n_dir_name'));190 if (isset($pluginDirs[0]))191 {192 $dirs[] = $pluginDirs[0];193 }194 195 return $dirs;196 }197 198 /**199 * Gets directories where template files are stored for a generator class and a specific theme.200 *201 * @param string The generator class name202 * @param string The theme name203 *204 * @return array An array of directories205 */206 static public function getGeneratorTemplateDirs($class, $theme)207 {208 $dirs = array(sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/template'); // project209 210 if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/data/generator/'.$class.'/'.$theme.'/template'))211 {212 $dirs = array_merge($dirs, $pluginDirs); // plugin213 }214 215 if ($bundledPluginDirs = glob(sfConfig::get('sf_symfony_lib_dir').'/plugins/*/data/generator/'.$class.'/'.$theme.'/template'))216 {217 $dirs = array_merge($dirs, $bundledPluginDirs); // bundled plugin218 }219 220 return $dirs;221 }222 223 /**224 * Gets directories where the skeleton is stored for a generator class and a specific theme.225 *226 * @param string The generator class name227 * @param string The theme name228 *229 * @return array An array of directories230 */231 static public function getGeneratorSkeletonDirs($class, $theme)232 {233 $dirs = array(sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/skeleton'); // project234 235 if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/data/generator/'.$class.'/'.$theme.'/skeleton'))236 {237 $dirs = array_merge($dirs, $pluginDirs); // plugin238 }239 240 if ($bundledPluginDirs = glob(sfConfig::get('sf_symfony_lib_dir').'/plugins/*/data/generator/'.$class.'/'.$theme.'/skeleton'))241 {242 $dirs = array_merge($dirs, $bundledPluginDirs); // bundled plugin243 }244 245 return $dirs;246 }247 248 /**249 * Gets the template to use for a generator class.250 *251 * @param string The generator class name252 * @param string The theme name253 * @param string The template path254 *255 * @return string A template path256 *257 * @throws sfException258 */259 static public function getGeneratorTemplate($class, $theme, $path)260 {261 $dirs = self::getGeneratorTemplateDirs($class, $theme);262 foreach ($dirs as $dir)263 {264 if (is_readable($dir.'/'.$path))265 {266 return $dir.'/'.$path;267 }268 }269 270 throw new sfException(sprintf('Unable to load "%s" generator template in: %s.', $path, implode(', ', $dirs)));271