Changeset 7962
- Timestamp:
- 03/19/08 11:21:16 (1 year ago)
- Files:
-
- branches/1.1/UPGRADE (modified) (6 diffs)
- branches/1.1/lib/config/sfApplicationConfiguration.class.php (modified) (1 diff)
- branches/1.1/lib/config/sfProjectConfiguration.class.php (modified) (2 diffs)
- 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/frontendConfiguration.class.php (moved) (moved from branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/lib/frontendConfiguration.class.php) (1 diff)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/config/ProjectConfiguration.class.php (moved) (moved from branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/lib/ProjectConfiguration.class.php)
- branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/test/bootstrap/functional.php (modified) (1 diff)
- 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/lib/task/sfPropelBuildAllLoadTask.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) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/bootstrap/functional.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/backend/config/backendConfiguration.class.php (moved) (moved from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/backendConfiguration.class.php) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/crud/config/crudConfiguration.class.php (moved) (moved from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/crudConfiguration.class.php) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/config/ProjectConfiguration.class.php (moved) (moved from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/ProjectConfiguration.class.php)
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/test/bootstrap/functional.php (modified) (1 diff)
- 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/task/cache/sfCacheClearTask.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/ApplicationConfiguration.class.php (moved) (moved from branches/1.1/lib/task/generator/skeleton/app/lib/ApplicationConfiguration.class.php) (1 diff)
- branches/1.1/lib/task/generator/skeleton/app/web/index.php (modified) (1 diff)
- branches/1.1/lib/task/generator/skeleton/project/config/ProjectConfiguration.class.php (moved) (moved from branches/1.1/lib/task/generator/skeleton/project/lib/ProjectConfiguration.class.php)
- 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/project/sfProjectFreezeTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/project/sfProjectUnfreezeTask.class.php (modified) (1 diff)
- branches/1.1/lib/task/project/upgrade1.1/sfConfigUpgrade.class.php (modified) (2 diffs)
- branches/1.1/lib/task/project/upgrade1.1/sfTestUpgrade.class.php (modified) (2 diffs)
- branches/1.1/lib/task/sfBaseTask.class.php (modified) (1 diff)
- branches/1.1/test/bootstrap/functional.php (modified) (1 diff)
- branches/1.1/test/functional/fixtures/project/apps/cache/config/cacheConfiguration.class.php (moved) (moved from branches/1.1/test/functional/fixtures/project/lib/cacheConfiguration.class.php) (1 diff)
- branches/1.1/test/functional/fixtures/project/apps/frontend/config/frontendConfiguration.class.php (moved) (moved from branches/1.1/test/functional/fixtures/project/lib/frontendConfiguration.class.php) (1 diff)
- branches/1.1/test/functional/fixtures/project/apps/i18n/config/i18nConfiguration.class.php (moved) (moved from branches/1.1/test/functional/fixtures/project/lib/i18nConfiguration.class.php) (1 diff)
- branches/1.1/test/functional/fixtures/project/config/ProjectConfiguration.class.php (moved) (moved from branches/1.1/test/functional/fixtures/project/lib/ProjectConfiguration.class.php)
- branches/1.1/test/functional/fixtures/project/test/bootstrap/functional.php (modified) (1 diff)
- 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/task/cache/sfCacheClearTaskTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/UPGRADE
r7908 r7962 29 29 [php] 30 30 chdir(dirname(__FILE__)); 31 require_once(dirname(__FILE__).'/ lib/ProjectConfiguration.class.php');31 require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php'); 32 32 $configuration = new ProjectConfiguration(); 33 33 include($configuration->getSymfonyLibDir().'/command/cli.php'); … … 37 37 $ cp /path/to/symfony/lib/task/generator/skeleton/project/symfony symfony 38 38 39 * Create a ` lib/ProjectConfiguration.class.php` file with the following content:39 * Create a `config/ProjectConfiguration.class.php` file with the following content: 40 40 41 41 [php] … … 58 58 You can also copy the skeleton file from the symfony project skeleton directly: 59 59 60 $ cp /path/to/symfony/lib/task/generator/skeleton/project/ lib/ProjectConfiguration.class.php lib/ProjectConfiguration.class.php60 $ cp /path/to/symfony/lib/task/generator/skeleton/project/config/ProjectConfiguration.class.php config/ProjectConfiguration.class.php 61 61 62 62 * Launch the `project:upgrade1.1` task from your project directory … … 394 394 395 395 [php] 396 $databaseManager = new sfDatabaseManager(); 396 $configuration = ProjectConfiguration::getApplicationConfiguration($application, $env, true); 397 $databaseManager = new sfDatabaseManager($configuration); 397 398 $databaseManager->loadConfiguration(); 398 399 … … 540 541 ---------- 541 542 542 The `sfViewCacheManager::removePattern()` and `sfToolkit::clearGlob()` don't work anymore for removing several cache parts at once. But the `sfViewCacheManager::remove()` now accepts internal URIs with wildcards. So you can replace: 543 The `sfViewCacheManager::removePattern()` and `sfToolkit::clearGlob()` don't work anymore 544 for removing several cache parts at once. But the `sfViewCacheManager::remove()` now 545 accepts internal URIs with wildcards. So you can replace: 543 546 544 547 $cacheManager->removePattern('*/all/user/show/id/*'); 545 548 546 549 By: 547 550 … … 556 559 $cacheManager->remove('@sf_cache_partial?module=user&action=_my_partial&sf_cache_key=*'); 557 560 558 And the biggets benefit is that it allows you to clear 'glob' URIs in *any* cache factory, noy only the `sfFileCache`. 561 And the biggets benefit is that it allows you to clear 'glob' URIs in *any* cache 562 factory, not only the `sfFileCache`. 563 564 NOTE to early adopters 565 ---------------------- 566 567 If you have upgraded your project and have a `lib/Projectconfiguratioun.class.php` file, 568 then you need to upgrade your project manually before being able to launch the 569 `project:upgrade1.1` task. 570 571 Here is how: 572 573 * Move `lib/ProjectConfiguration.class.php` to `config/ProjectConfiguration.class.php` 574 575 * Move all your application configuration classes (`lib/$APP_NAME$Configuration.class.php`) 576 to their respective `apps/$APP_NAME$/config/` directory. 577 578 * Remove the `require_once dirname(__FILE__).'/ProjectConfiguration.class.php';` in all 579 the application configuration classes. 580 581 * Change the location of `ProjectConfiguration.class.php` in the main `symfony` script to `config/` 582 583 * Change your front controllers so they look like this: 584 585 {{{ 586 <?php 587 588 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 589 590 $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true); 591 sfContext::createInstance($configuration)->dispatch(); 592 }}} 593 594 You can now launch the `project:upgrade1.1` script to finish the upgrade. branches/1.1/lib/config/sfApplicationConfiguration.class.php
r7846 r7962 76 76 77 77 /** 78 * Returns a sfApplicationConfiguration configuration for a given application.79 *80 * @param string An application name81 * @param string The environment name82 * @param Boolean true to enable debug mode83 * @param string The project root directory84 *85 * @return sfApplicationConfiguration A sfApplicationConfiguration instance86 */87 static public function getForApplication($application, $environment, $debug, $rootDir = null)88 {89 $class = $application.'Configuration';90 91 return new $class($environment, $debug, $rootDir);92 }93 94 /**95 78 * @see sfProjectConfiguration 96 79 */ branches/1.1/lib/config/sfProjectConfiguration.class.php
r7696 r7962 33 33 sfProjectConfiguration::$active = $this; 34 34 35 if (is_null($rootDir)) 36 { 37 $r = new ReflectionObject($this); 38 39 $this->rootDir = realpath(dirname($r->getFileName()).'/..'); 40 } 41 else 42 { 43 $this->rootDir = realpath($rootDir); 44 } 35 $this->rootDir = is_null($rootDir) ? self::guessRootDir() : realpath($rootDir); 45 36 46 37 $this->symfonyLibDir = realpath(dirname(__FILE__).'/..'); … … 262 253 return sfProjectConfiguration::$active; 263 254 } 255 256 static public function guessRootDir() 257 { 258 $r = new ReflectionClass('ProjectConfiguration'); 259 260 return realpath(dirname($r->getFileName()).'/..'); 261 } 262 263 /** 264 * Returns a sfApplicationConfiguration configuration for a given application. 265 * 266 * @param string An application name 267 * @param string The environment name 268 * @param Boolean true to enable debug mode 269 * @param string The project root directory 270 * 271 * @return sfApplicationConfiguration A sfApplicationConfiguration instance 272 */ 273 static public function getApplicationConfiguration($application, $environment, $debug, $rootDir = null) 274 { 275 $class = $application.'Configuration'; 276 277 if (is_null(sfProjectConfiguration::$active)) 278 { 279 // force initialization of sf_apps_dir config setting 280 new ProjectConfiguration(); 281 } 282 283 require_once sfConfig::get('sf_apps_dir').'/'.$application.'/config/'.$class.'.class.php'; 284 285 if (is_null($rootDir)) 286 { 287 $rootDir = self::guessRootDir(); 288 } 289 290 return new $class($environment, $debug, $rootDir); 291 } 264 292 } branches/1.1/lib/plugins/sfCompat10Plugin/test/bootstrap/functional.php
r7715 r7962 14 14 } 15 15 16 $class = $app.'Configuration'; 17 require $root_dir.'/lib/'.$class.'.class.php'; 18 $configuration = new $class('test', isset($debug) ? $debug : true); 16 require_once $root_dir.'/config/ProjectConfiguration.class.php'; 17 $configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 19 18 sfContext::createInstance($configuration); 20 19 branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/apps/frontend/config/frontendConfiguration.class.php
r7614 r7962 1 1 <?php 2 3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php';4 2 5 3 class frontendConfiguration extends sfApplicationConfiguration branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/test/bootstrap/functional.php
r7614 r7962 19 19 } 20 20 21 $class = $app.'Configuration'; 22 require_once(dirname(__FILE__).'/../../lib/'.$class.'.class.php'); 23 24 $configuration = new $class('test', true); 21 require_once dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'; 22 $configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 25 23 sfContext::createInstance($configuration); 26 24 branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/test/bootstrap/unit.php
r7614 r7962 11 11 $_test_dir = realpath(dirname(__FILE__).'/..'); 12 12 13 require_once(dirname(__FILE__).'/../../ lib/ProjectConfiguration.class.php');13 require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'); 14 14 $configuration = new ProjectConfiguration(realpath($_test_dir.'/..')); 15 15 include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php'); branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/web/frontend_dev.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/frontendConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new frontendConfiguration('dev', true);5 $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/web/index.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/frontendConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new frontendConfiguration('prod', false);5 $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildAllLoadTask.class.php
r7669 r7962 61 61 { 62 62 // load Propel configuration before Phing 63 $configuration = sfApplicationConfiguration::getForApplication($arguments['application'], $options['env'], true);63 $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true); 64 64 $databaseManager = new sfDatabaseManager($configuration); 65 65 require_once sfConfig::get('sf_symfony_lib_dir').'/plugins/sfPropelPlugin/lib/propel/sfPropelAutoload.php'; branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataDumpTask.class.php
r7892 r7962 69 69 protected function execute($arguments = array(), $options = array()) 70 70 { 71 $configuration = sfApplicationConfiguration::getForApplication($arguments['application'], $options['env'], true);71 $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true); 72 72 73 73 $databaseManager = new sfDatabaseManager($configuration); branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataLoadTask.class.php
r7614 r7962 84 84 } 85 85 86 $configuration = sfApplicationConfiguration::getForApplication($arguments['application'], $options['env'], true);86 $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true); 87 87 88 88 $databaseManager = new sfDatabaseManager($configuration); branches/1.1/lib/plugins/sfPropelPlugin/test/bootstrap/functional.php
r7715 r7962 20 20 } 21 21 22 $class = $app.'Configuration'; 23 require $root_dir.'/lib/'.$class.'.class.php'; 24 $configuration = new $class('test', isset($debug) ? $debug : true); 22 require_once $root_dir.'/config/ProjectConfiguration.class.php'; 23 $configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 25 24 sfContext::createInstance($configuration); 26 25 branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/backend/config/backendConfiguration.class.php
r7614 r7962 1 1 <?php 2 3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php';4 2 5 3 class backendConfiguration extends sfApplicationConfiguration branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/crud/config/crudConfiguration.class.php
r7614 r7962 1 1 <?php 2 3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php';4 2 5 3 class crudConfiguration extends sfApplicationConfiguration branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/test/bootstrap/functional.php
r7614 r7962 19 19 } 20 20 21 $class = $app.'Configuration'; 22 require_once(dirname(__FILE__).'/../../lib/'.$class.'.class.php'); 23 24 $configuration = new $class('test', true); 21 require_once dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'; 22 $configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 25 23 sfContext::createInstance($configuration); 26 24 branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/test/bootstrap/unit.php
r7614 r7962 11 11 $_test_dir = realpath(dirname(__FILE__).'/..'); 12 12 13 require_once(dirname(__FILE__).'/../../ lib/ProjectConfiguration.class.php');13 require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'); 14 14 $configuration = new ProjectConfiguration(realpath($_test_dir.'/..')); 15 15 include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php'); branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/backend_dev.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/backendConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new backendConfiguration('dev', true);5 $configuration = ProjectConfiguration::getApplicationConfiguration('backend', 'dev', true); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/crud.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/crudConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new crudConfiguration('prod', false);5 $configuration = ProjectConfiguration::getApplicationConfiguration('crud', 'prod', false); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/crud_dev.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/crudConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new crudConfiguration('dev', true);5 $configuration = ProjectConfiguration::getApplicationConfiguration('crud', 'dev', true); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/index.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/backendConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new backendConfiguration('prod', false);5 $configuration = ProjectConfiguration::getApplicationConfiguration('backend', 'prod', false); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/lib/task/cache/sfCacheClearTask.class.php
r7824 r7962 84 84 foreach ($apps as $app) 85 85 { 86 $class = $app.'Configuration'; 87 require_once sfConfig::get('sf_lib_dir').'/'.$class.'.class.php'; 88 $appConfiguration = new $class('cli', true); 86 $appConfiguration = ProjectConfiguration::getApplicationConfiguration($app, 'cli', true); 89 87 90 88 if (!is_dir(sfConfig::get('sf_cache_dir').'/'.$app)) branches/1.1/lib/task/generator/sfGenerateAppTask.class.php
r7691 r7962 113 113 )); 114 114 115 $this->getFilesystem()->copy(dirname(__FILE__).'/skeleton/app/ lib/ApplicationConfiguration.class.php', sfConfig::get('sf_lib_dir').'/'.$app.'Configuration.class.php');115 $this->getFilesystem()->copy(dirname(__FILE__).'/skeleton/app/app/config/ApplicationConfiguration.class.php', $appDir.'/config/'.$app.'Configuration.class.php'); 116 116 117 $this->getFilesystem()->replaceTokens( sfConfig::get('sf_lib_dir').'/'.$app.'Configuration.class.php', '##', '##', array('APP_NAME' => $app));117 $this->getFilesystem()->replaceTokens($appDir.'/config/'.$app.'Configuration.class.php', '##', '##', array('APP_NAME' => $app)); 118 118 119 119 $fixPerms = new sfProjectPermissionsTask($this->dispatcher, $this->formatter); branches/1.1/lib/task/generator/sfGenerateProjectTask.class.php
r7614 r7962 76 76 77 77 // update ProjectConfiguration class 78 $this->getFileSystem()->replaceTokens(sfConfig::get('sf_ lib_dir').'/ProjectConfiguration.class.php', '##', '##', array('SYMFONY_LIB_DIR' => sfConfig::get('sf_symfony_lib_dir')));78 $this->getFileSystem()->replaceTokens(sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php', '##', '##', array('SYMFONY_LIB_DIR' => sfConfig::get('sf_symfony_lib_dir'))); 79 79 80 80 $fixPerms = new sfProjectPermissionsTask($this->dispatcher, $this->formatter); branches/1.1/lib/task/generator/skeleton/app/app/config/ApplicationConfiguration.class.php
r7614 r7962 1 1 <?php 2 3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php';4 2 5 3 class ##APP_NAME##Configuration extends sfApplicationConfiguration branches/1.1/lib/task/generator/skeleton/app/web/index.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/##APP_NAME##Configuration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new ##APP_NAME##Configuration('##ENVIRONMENT##', ##IS_DEBUG##);5 $configuration = ProjectConfiguration::getApplicationConfiguration('##APP_NAME##', '##ENVIRONMENT##', ##IS_DEBUG##); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/lib/task/generator/skeleton/project/symfony
r7614 r7962 11 11 12 12 chdir(dirname(__FILE__)); 13 require_once(dirname(__FILE__).'/ lib/ProjectConfiguration.class.php');13 require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php'); 14 14 $configuration = new ProjectConfiguration(); 15 15 include($configuration->getSymfonyLibDir().'/command/cli.php'); branches/1.1/lib/task/generator/skeleton/project/test/bootstrap/functional.php
r7614 r7962 19 19 } 20 20 21 $class = $app.'Configuration'; 22 require_once(dirname(__FILE__).'/../../lib/'.$class.'.class.php'); 23 24 $configuration = new $class('test', true); 21 require_once dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'; 22 $configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 25 23 sfContext::createInstance($configuration); 26 24 branches/1.1/lib/task/generator/skeleton/project/test/bootstrap/unit.php
r7614 r7962 11 11 $_test_dir = realpath(dirname(__FILE__).'/..'); 12 12 13 require_once(dirname(__FILE__).'/../../ lib/ProjectConfiguration.class.php');13 require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'); 14 14 $configuration = new ProjectConfiguration(realpath($_test_dir.'/..')); 15 15 include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php'); branches/1.1/lib/task/project/sfProjectFreezeTask.class.php
r7614 r7962 85 85 86 86 // change symfony path in ProjectConfiguration.class.php 87 $config = sfConfig::get('sf_ lib_dir').'/ProjectConfiguration.class.php';87 $config = sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php'; 88 88 $content = file_get_contents($config); 89 89 $content = str_replace('<?php', "<?php\n\n# FROZEN_SF_LIB_DIR: $symfonyLibDir", $content); branches/1.1/lib/task/project/sfProjectUnfreezeTask.class.php
r7614 r7962 52 52 53 53 // change symfony path in ProjectConfiguration.class.php 54 $config = sfConfig::get('sf_ lib_dir').'/ProjectConfiguration.class.php';54 $config = sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php'; 55 55 $content = file_get_contents($config); 56 56 if (preg_match('/^# FROZEN_SF_LIB_DIR\: (.+?)$/m', $content, $match)) branches/1.1/lib/task/project/upgrade1.1/sfConfigUpgrade.class.php
r7614 r7962 21 21 public function upgrade() 22 22 { 23 if (file_exists(sfConfig::get('sf_lib_dir').'/ProjectConfiguration.class.php')) 24 { 25 throw new sfCommandException('Unable to upgrade your project automatically. Read the "NOTE to early adopters" at the end in the symfony UPGRADE file to upgrade your project manually.'); 26 } 27 23 28 $this->checkConfigFiles(); 24 29 $this->upgradeFrontControllers(); … … 115 120 foreach ($this->getApplications() as $application) 116 121 { 117 if (file_exists(sfConfig::get('sf_lib_dir').'/'.$application.'Configuration.class.php')) 122 $configPath = sfConfig::get('sf_apps_dir').'/'.$application.'/config/'.$application.'Configuration.class.php'; 123 124 if (file_exists($configPath)) 118 125 { 119 126 continue; 120 127 } 121 128 122 $this->getFilesystem()->copy(dirname(__FILE__).'/../../generator/skeleton/app/ lib/ApplicationConfiguration.class.php', sfConfig::get('sf_lib_dir').'/'.$application.'Configuration.class.php');129 $this->getFilesystem()->copy(dirname(__FILE__).'/../../generator/skeleton/app/app/config/ApplicationConfiguration.class.php', $configPath); 123 130 124 $this->getFilesystem()->replaceTokens( sfConfig::get('sf_lib_dir').'/'.$application.'Configuration.class.php', '##', '##', array('APP_NAME' => $application));131 $this->getFilesystem()->replaceTokens($configPath, '##', '##', array('APP_NAME' => $application)); 125 132 } 126 133 } branches/1.1/lib/task/project/upgrade1.1/sfTestUpgrade.class.php
r7614 r7962 26 26 { 27 27 $content = file_get_contents($unit); 28 if (false !== strpos($content, 'SF_ROOT_DIR') )28 if (false !== strpos($content, 'SF_ROOT_DIR') || false !== strpos($content, 'lib/ProjectConfiguration')) 29 29 { 30 30 $this->logSection('test', sprintf('Migrating %s', $unit)); … … 37 37 { 38 38 $content = file_get_contents($functional); 39 if (false !== strpos($content, 'SF_ROOT_DIR') )39 if (false !== strpos($content, 'SF_ROOT_DIR') || false !== strpos($content, 'new $class')) 40 40 { 41 41 $this->logSection('test', sprintf('Migrating %s', $functional)); branches/1.1/lib/task/sfBaseTask.class.php
r7813 r7962 35 35 { 36 36 $this->checkAppExists($application); 37 $class = $application.'Configuration'; 38 require_once sfConfig::get('sf_ lib_dir').'/'.$class.'.class.php';39 $this->configuration = new $class('test', true);37 38 require_once sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php'; 39 $this->configuration = ProjectConfiguration::getApplicationConfiguration($application, 'test', true); 40 40 } 41 41 else 42 42 { 43 if (file_exists(sfConfig::get('sf_ lib_dir').'/ProjectConfiguration.class.php'))43 if (file_exists(sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php')) 44 44 { 45 require_once sfConfig::get('sf_ lib_dir').'/ProjectConfiguration.class.php';45 require_once sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php'; 46 46 $this->configuration = new ProjectConfiguration(); 47 47 } branches/1.1/test/bootstrap/functional.php
r7715 r7962 22 22 } 23 23 24 $class = $app.'Configuration'; 25 require $root_dir.'/lib/'.$class.'.class.php'; 26 $configuration = new $class('test', isset($debug) ? $debug : true); 24 require_once $root_dir.'/config/ProjectConfiguration.class.php'; 25 $configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 27 26 sfContext::createInstance($configuration); 28 27 branches/1.1/test/functional/fixtures/project/apps/cache/config/cacheConfiguration.class.php
r7614 r7962 1 1 <?php 2 3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php';4 2 5 3 class cacheConfiguration extends sfApplicationConfiguration branches/1.1/test/functional/fixtures/project/apps/frontend/config/frontendConfiguration.class.php
r7614 r7962 1 1 <?php 2 3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php';4 2 5 3 class frontendConfiguration extends sfApplicationConfiguration branches/1.1/test/functional/fixtures/project/apps/i18n/config/i18nConfiguration.class.php
r7614 r7962 1 1 <?php 2 3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php';4 2 5 3 class i18nConfiguration extends sfApplicationConfiguration branches/1.1/test/functional/fixtures/project/test/bootstrap/functional.php
r7614 r7962 19 19 } 20 20 21 $class = $app.'Configuration'; 22 require_once(dirname(__FILE__).'/../../lib/'.$class.'.class.php'); 23 24 $configuration = new $class('test', true); 21 require_once dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'; 22 $configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 25 23 sfContext::createInstance($configuration); 26 24 branches/1.1/test/functional/fixtures/project/test/bootstrap/unit.php
r7614 r7962 11 11 $_test_dir = realpath(dirname(__FILE__).'/..'); 12 12 13 require_once(dirname(__FILE__).'/../../ lib/ProjectConfiguration.class.php');13 require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'); 14 14 $configuration = new ProjectConfiguration(realpath($_test_dir.'/..')); 15 15 include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php'); branches/1.1/test/functional/fixtures/project/web/cache.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/cacheConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new cacheConfiguration('prod', false);5 $configuration = ProjectConfiguration::getApplicationConfiguration('cache', 'prod', false); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/test/functional/fixtures/project/web/cache_dev.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/cacheConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new cacheConfiguration('dev', true);5 $configuration = ProjectConfiguration::getApplicationConfiguration('cache', 'dev', true); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/test/functional/fixtures/project/web/frontend_dev.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/frontendConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new frontendConfiguration('dev', true);5 $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/test/functional/fixtures/project/web/i18n.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/i18nConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new i18nConfiguration('prod', false);5 $configuration = ProjectConfiguration::getApplicationConfiguration('i18n', 'prod', false); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/test/functional/fixtures/project/web/i18n_dev.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/i18nConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new i18nConfiguration('dev', true);5 $configuration = ProjectConfiguration::getApplicationConfiguration('i18n', 'dev', true); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/test/functional/fixtures/project/web/index.php
r7614 r7962 1 1 <?php 2 2 3 require_once(dirname(__FILE__).'/../ lib/frontendConfiguration.class.php');3 require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 4 4 5 $configuration = new frontendConfiguration('prod', false);5 $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false); 6 6 sfContext::createInstance($configuration)->dispatch(); branches/1.1/test/other/tasksTest.php
r7688 r7962 123 123 124 124 $content = $c->execute_command(sprintf('project:freeze %s', realpath(dirname(__FILE__).'/../../data'))); 125 $t->like(file_get_contents($c->tmp_dir.DS.' lib'.DS.'ProjectConfiguration.class.php'), '/dirname\(__FILE__\)/', '"project:freeze" freezes symfony lib and data dir into the project directory');125 $t->like(file_get_contents($c->tmp_dir.DS.'config'.DS.'ProjectConfiguration.class.php'), '/dirname\(__FILE__\)/', '"project:freeze" freezes symfony lib and data dir into the project directory'); 126 126 127 127 $content = $c->execute_command('project:unfreeze'); 128 $t->unlike(file_get_contents($c->tmp_dir.DS.' lib'.DS.'ProjectConfiguration.class.php'), '/dirname\(__FILE__\)/', '"project:unfreeze" unfreezes symfony lib and data dir');128 $t->unlike(file_get_contents($c->tmp_dir.DS.'config'.DS.'ProjectConfiguration.class.php'), '/dirname\(__FILE__\)/', '"project:unfreeze" unfreezes symfony lib and data dir'); 129 129 130 130 $c->shutdown(); branches/1.1/test/unit/task/cache/sfCacheClearTaskTest.php
r7689 r7962 21 21 $task->run(array('frontend')); 22 22 23 require_once sfConfig::get('sf_root_dir').'/ lib/frontendConfiguration.class.php';24 $configuration = new frontendConfiguration('test', true);23 require_once sfConfig::get('sf_root_dir').'/config/ProjectConfiguration.class.php'; 24 $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'test', true); 25 25 26 26 // Put something in the cache

