Development

Changeset 7962

You must first sign up to be able to contribute.

Changeset 7962

Show
Ignore:
Timestamp:
03/19/08 11:21:16 (1 year ago)
Author:
fabien
Message:

moved *Configuration classes in "better" places

  • moved ProjectConfiguration? from lib/ to config/
  • moved $APP_NAME$Configuration to apps/$APP_NAME$/config/
  • added a ProjectConfiguration::getApplicationConfiguration() to retrieve an application configuration
  • removed sfApplicationConfiguration::getForApplication() method (please use ProjectConfiguration::getApplicationConfiguration)
  • updated the UPGRADE file for early adopters (how to upgrade projects that live on the 1.1 branch)
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/UPGRADE

    r7908 r7962  
    2929        [php] 
    3030        chdir(dirname(__FILE__)); 
    31         require_once(dirname(__FILE__).'/lib/ProjectConfiguration.class.php'); 
     31        require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php'); 
    3232        $configuration = new ProjectConfiguration(); 
    3333        include($configuration->getSymfonyLibDir().'/command/cli.php'); 
     
    3737        $ cp /path/to/symfony/lib/task/generator/skeleton/project/symfony symfony 
    3838 
    39   * Create a `lib/ProjectConfiguration.class.php` file with the following content: 
     39  * Create a `config/ProjectConfiguration.class.php` file with the following content: 
    4040 
    4141        [php] 
     
    5858    You can also copy the skeleton file from the symfony project skeleton directly: 
    5959 
    60         $ cp /path/to/symfony/lib/task/generator/skeleton/project/lib/ProjectConfiguration.class.php lib/ProjectConfiguration.class.php 
     60        $ cp /path/to/symfony/lib/task/generator/skeleton/project/config/ProjectConfiguration.class.php config/ProjectConfiguration.class.php 
    6161 
    6262  * Launch the `project:upgrade1.1` task from your project directory 
     
    394394 
    395395    [php] 
    396     $databaseManager = new sfDatabaseManager(); 
     396    $configuration = ProjectConfiguration::getApplicationConfiguration($application, $env, true); 
     397    $databaseManager = new sfDatabaseManager($configuration); 
    397398    $databaseManager->loadConfiguration(); 
    398399 
     
    540541---------- 
    541542 
    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: 
     543The `sfViewCacheManager::removePattern()` and `sfToolkit::clearGlob()` don't work anymore 
     544for removing several cache parts at once. But the `sfViewCacheManager::remove()` now 
     545accepts internal URIs with wildcards. So you can replace: 
    543546 
    544547    $cacheManager->removePattern('*/all/user/show/id/*'); 
    545      
     548 
    546549By: 
    547550 
     
    556559    $cacheManager->remove('@sf_cache_partial?module=user&action=_my_partial&sf_cache_key=*'); 
    557560 
    558 And the biggets benefit is that it allows you to clear 'glob' URIs in *any* cache factory, noy only the `sfFileCache`. 
     561And the biggets benefit is that it allows you to clear 'glob' URIs in *any* cache 
     562factory, not only the `sfFileCache`. 
     563 
     564NOTE to early adopters 
     565---------------------- 
     566 
     567If you have upgraded your project and have a `lib/Projectconfiguratioun.class.php` file, 
     568then you need to upgrade your project manually before being able to launch the 
     569`project:upgrade1.1` task. 
     570 
     571Here 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 
     594You can now launch the `project:upgrade1.1` script to finish the upgrade. 
  • branches/1.1/lib/config/sfApplicationConfiguration.class.php

    r7846 r7962  
    7676 
    7777  /** 
    78    * Returns a sfApplicationConfiguration configuration for a given application. 
    79    * 
    80    * @param string  An application name 
    81    * @param string  The environment name 
    82    * @param Boolean true to enable debug mode 
    83    * @param string  The project root directory 
    84    * 
    85    * @return sfApplicationConfiguration A sfApplicationConfiguration instance 
    86    */ 
    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   /** 
    9578   * @see sfProjectConfiguration 
    9679   */ 
  • branches/1.1/lib/config/sfProjectConfiguration.class.php

    r7696 r7962  
    3333    sfProjectConfiguration::$active = $this; 
    3434 
    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); 
    4536 
    4637    $this->symfonyLibDir = realpath(dirname(__FILE__).'/..'); 
     
    262253    return sfProjectConfiguration::$active; 
    263254  } 
     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  } 
    264292} 
  • branches/1.1/lib/plugins/sfCompat10Plugin/test/bootstrap/functional.php

    r7715 r7962  
    1414} 
    1515 
    16 $class = $app.'Configuration'; 
    17 require $root_dir.'/lib/'.$class.'.class.php'; 
    18 $configuration = new $class('test', isset($debug) ? $debug : true); 
     16require_once $root_dir.'/config/ProjectConfiguration.class.php'; 
     17$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 
    1918sfContext::createInstance($configuration); 
    2019 
  • branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/apps/frontend/config/frontendConfiguration.class.php

    r7614 r7962  
    11<?php 
    2  
    3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php'; 
    42 
    53class frontendConfiguration extends sfApplicationConfiguration 
  • branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/test/bootstrap/functional.php

    r7614 r7962  
    1919} 
    2020 
    21 $class = $app.'Configuration'; 
    22 require_once(dirname(__FILE__).'/../../lib/'.$class.'.class.php'); 
    23  
    24 $configuration = new $class('test', true); 
     21require_once dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'; 
     22$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 
    2523sfContext::createInstance($configuration); 
    2624 
  • branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/test/bootstrap/unit.php

    r7614 r7962  
    1111$_test_dir = realpath(dirname(__FILE__).'/..'); 
    1212 
    13 require_once(dirname(__FILE__).'/../../lib/ProjectConfiguration.class.php'); 
     13require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'); 
    1414$configuration = new ProjectConfiguration(realpath($_test_dir.'/..')); 
    1515include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php'); 
  • branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/web/frontend_dev.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/frontendConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new frontendConfiguration('dev', true); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/lib/plugins/sfCompat10Plugin/test/functional/fixtures/web/index.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/frontendConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new frontendConfiguration('prod', false); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildAllLoadTask.class.php

    r7669 r7962  
    6161  { 
    6262    // load Propel configuration before Phing 
    63     $configuration = sfApplicationConfiguration::getForApplication($arguments['application'], $options['env'], true); 
     63    $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true); 
    6464    $databaseManager = new sfDatabaseManager($configuration); 
    6565    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  
    6969  protected function execute($arguments = array(), $options = array()) 
    7070  { 
    71     $configuration = sfApplicationConfiguration::getForApplication($arguments['application'], $options['env'], true); 
     71    $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true); 
    7272 
    7373    $databaseManager = new sfDatabaseManager($configuration); 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataLoadTask.class.php

    r7614 r7962  
    8484    } 
    8585 
    86     $configuration = sfApplicationConfiguration::getForApplication($arguments['application'], $options['env'], true); 
     86    $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true); 
    8787 
    8888    $databaseManager = new sfDatabaseManager($configuration); 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/bootstrap/functional.php

    r7715 r7962  
    2020} 
    2121 
    22 $class = $app.'Configuration'; 
    23 require $root_dir.'/lib/'.$class.'.class.php'; 
    24 $configuration = new $class('test', isset($debug) ? $debug : true); 
     22require_once $root_dir.'/config/ProjectConfiguration.class.php'; 
     23$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 
    2524sfContext::createInstance($configuration); 
    2625 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/backend/config/backendConfiguration.class.php

    r7614 r7962  
    11<?php 
    2  
    3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php'; 
    42 
    53class backendConfiguration extends sfApplicationConfiguration 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/crud/config/crudConfiguration.class.php

    r7614 r7962  
    11<?php 
    2  
    3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php'; 
    42 
    53class crudConfiguration extends sfApplicationConfiguration 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/test/bootstrap/functional.php

    r7614 r7962  
    1919} 
    2020 
    21 $class = $app.'Configuration'; 
    22 require_once(dirname(__FILE__).'/../../lib/'.$class.'.class.php'); 
    23  
    24 $configuration = new $class('test', true); 
     21require_once dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'; 
     22$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 
    2523sfContext::createInstance($configuration); 
    2624 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/test/bootstrap/unit.php

    r7614 r7962  
    1111$_test_dir = realpath(dirname(__FILE__).'/..'); 
    1212 
    13 require_once(dirname(__FILE__).'/../../lib/ProjectConfiguration.class.php'); 
     13require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'); 
    1414$configuration = new ProjectConfiguration(realpath($_test_dir.'/..')); 
    1515include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php'); 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/backend_dev.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/backendConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new backendConfiguration('dev', true); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('backend', 'dev', true); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/crud.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/crudConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new crudConfiguration('prod', false); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('crud', 'prod', false); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/crud_dev.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/crudConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new crudConfiguration('dev', true); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('crud', 'dev', true); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/web/index.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/backendConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new backendConfiguration('prod', false); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('backend', 'prod', false); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/lib/task/cache/sfCacheClearTask.class.php

    r7824 r7962  
    8484    foreach ($apps as $app) 
    8585    { 
    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); 
    8987 
    9088      if (!is_dir(sfConfig::get('sf_cache_dir').'/'.$app)) 
  • branches/1.1/lib/task/generator/sfGenerateAppTask.class.php

    r7691 r7962  
    113113    )); 
    114114 
    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'); 
    116116 
    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)); 
    118118 
    119119    $fixPerms = new sfProjectPermissionsTask($this->dispatcher, $this->formatter); 
  • branches/1.1/lib/task/generator/sfGenerateProjectTask.class.php

    r7614 r7962  
    7676 
    7777    // 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'))); 
    7979 
    8080    $fixPerms = new sfProjectPermissionsTask($this->dispatcher, $this->formatter); 
  • branches/1.1/lib/task/generator/skeleton/app/app/config/ApplicationConfiguration.class.php

    r7614 r7962  
    11<?php 
    2  
    3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php'; 
    42 
    53class ##APP_NAME##Configuration extends sfApplicationConfiguration 
  • branches/1.1/lib/task/generator/skeleton/app/web/index.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/##APP_NAME##Configuration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new ##APP_NAME##Configuration('##ENVIRONMENT##', ##IS_DEBUG##); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('##APP_NAME##', '##ENVIRONMENT##', ##IS_DEBUG##); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/lib/task/generator/skeleton/project/symfony

    r7614 r7962  
    1111 
    1212chdir(dirname(__FILE__)); 
    13 require_once(dirname(__FILE__).'/lib/ProjectConfiguration.class.php'); 
     13require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php'); 
    1414$configuration = new ProjectConfiguration(); 
    1515include($configuration->getSymfonyLibDir().'/command/cli.php'); 
  • branches/1.1/lib/task/generator/skeleton/project/test/bootstrap/functional.php

    r7614 r7962  
    1919} 
    2020 
    21 $class = $app.'Configuration'; 
    22 require_once(dirname(__FILE__).'/../../lib/'.$class.'.class.php'); 
    23  
    24 $configuration = new $class('test', true); 
     21require_once dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'; 
     22$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 
    2523sfContext::createInstance($configuration); 
    2624 
  • branches/1.1/lib/task/generator/skeleton/project/test/bootstrap/unit.php

    r7614 r7962  
    1111$_test_dir = realpath(dirname(__FILE__).'/..'); 
    1212 
    13 require_once(dirname(__FILE__).'/../../lib/ProjectConfiguration.class.php'); 
     13require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'); 
    1414$configuration = new ProjectConfiguration(realpath($_test_dir.'/..')); 
    1515include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php'); 
  • branches/1.1/lib/task/project/sfProjectFreezeTask.class.php

    r7614 r7962  
    8585 
    8686    // 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'; 
    8888    $content = file_get_contents($config); 
    8989    $content = str_replace('<?php', "<?php\n\n# FROZEN_SF_LIB_DIR: $symfonyLibDir", $content); 
  • branches/1.1/lib/task/project/sfProjectUnfreezeTask.class.php

    r7614 r7962  
    5252 
    5353    // 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'; 
    5555    $content = file_get_contents($config); 
    5656    if (preg_match('/^# FROZEN_SF_LIB_DIR\: (.+?)$/m', $content, $match)) 
  • branches/1.1/lib/task/project/upgrade1.1/sfConfigUpgrade.class.php

    r7614 r7962  
    2121  public function upgrade() 
    2222  { 
     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 
    2328    $this->checkConfigFiles(); 
    2429    $this->upgradeFrontControllers(); 
     
    115120    foreach ($this->getApplications() as $application) 
    116121    { 
    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)) 
    118125      { 
    119126        continue; 
    120127      } 
    121128 
    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); 
    123130 
    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)); 
    125132    } 
    126133  } 
  • branches/1.1/lib/task/project/upgrade1.1/sfTestUpgrade.class.php

    r7614 r7962  
    2626    { 
    2727      $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')
    2929      { 
    3030        $this->logSection('test', sprintf('Migrating %s', $unit)); 
     
    3737    { 
    3838      $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')
    4040      { 
    4141        $this->logSection('test', sprintf('Migrating %s', $functional)); 
  • branches/1.1/lib/task/sfBaseTask.class.php

    r7813 r7962  
    3535    { 
    3636      $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); 
    4040    } 
    4141    else 
    4242    { 
    43       if (file_exists(sfConfig::get('sf_lib_dir').'/ProjectConfiguration.class.php')) 
     43      if (file_exists(sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php')) 
    4444      { 
    45         require_once sfConfig::get('sf_lib_dir').'/ProjectConfiguration.class.php'; 
     45        require_once sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php'; 
    4646        $this->configuration = new ProjectConfiguration(); 
    4747      } 
  • branches/1.1/test/bootstrap/functional.php

    r7715 r7962  
    2222} 
    2323 
    24 $class = $app.'Configuration'; 
    25 require $root_dir.'/lib/'.$class.'.class.php'; 
    26 $configuration = new $class('test', isset($debug) ? $debug : true); 
     24require_once $root_dir.'/config/ProjectConfiguration.class.php'; 
     25$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 
    2726sfContext::createInstance($configuration); 
    2827 
  • branches/1.1/test/functional/fixtures/project/apps/cache/config/cacheConfiguration.class.php

    r7614 r7962  
    11<?php 
    2  
    3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php'; 
    42 
    53class cacheConfiguration extends sfApplicationConfiguration 
  • branches/1.1/test/functional/fixtures/project/apps/frontend/config/frontendConfiguration.class.php

    r7614 r7962  
    11<?php 
    2  
    3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php'; 
    42 
    53class frontendConfiguration extends sfApplicationConfiguration 
  • branches/1.1/test/functional/fixtures/project/apps/i18n/config/i18nConfiguration.class.php

    r7614 r7962  
    11<?php 
    2  
    3 require_once dirname(__FILE__).'/ProjectConfiguration.class.php'; 
    42 
    53class i18nConfiguration extends sfApplicationConfiguration 
  • branches/1.1/test/functional/fixtures/project/test/bootstrap/functional.php

    r7614 r7962  
    1919} 
    2020 
    21 $class = $app.'Configuration'; 
    22 require_once(dirname(__FILE__).'/../../lib/'.$class.'.class.php'); 
    23  
    24 $configuration = new $class('test', true); 
     21require_once dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'; 
     22$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); 
    2523sfContext::createInstance($configuration); 
    2624 
  • branches/1.1/test/functional/fixtures/project/test/bootstrap/unit.php

    r7614 r7962  
    1111$_test_dir = realpath(dirname(__FILE__).'/..'); 
    1212 
    13 require_once(dirname(__FILE__).'/../../lib/ProjectConfiguration.class.php'); 
     13require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'); 
    1414$configuration = new ProjectConfiguration(realpath($_test_dir.'/..')); 
    1515include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php'); 
  • branches/1.1/test/functional/fixtures/project/web/cache.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/cacheConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new cacheConfiguration('prod', false); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('cache', 'prod', false); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/test/functional/fixtures/project/web/cache_dev.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/cacheConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new cacheConfiguration('dev', true); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('cache', 'dev', true); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/test/functional/fixtures/project/web/frontend_dev.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/frontendConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new frontendConfiguration('dev', true); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/test/functional/fixtures/project/web/i18n.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/i18nConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new i18nConfiguration('prod', false); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('i18n', 'prod', false); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/test/functional/fixtures/project/web/i18n_dev.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/i18nConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new i18nConfiguration('dev', true); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('i18n', 'dev', true); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/test/functional/fixtures/project/web/index.php

    r7614 r7962  
    11<?php 
    22 
    3 require_once(dirname(__FILE__).'/../lib/frontendConfiguration.class.php'); 
     3require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
    44 
    5 $configuration = new frontendConfiguration('prod', false); 
     5$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false); 
    66sfContext::createInstance($configuration)->dispatch(); 
  • branches/1.1/test/other/tasksTest.php

    r7688 r7962  
    123123 
    124124$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'); 
    126126 
    127127$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'); 
    129129 
    130130$c->shutdown(); 
  • branches/1.1/test/unit/task/cache/sfCacheClearTaskTest.php

    r7689 r7962  
    2121$task->run(array('frontend')); 
    2222 
    23 require_once sfConfig::get('sf_root_dir').'/lib/frontendConfiguration.class.php'; 
    24 $configuration = new frontendConfiguration('test', true); 
     23require_once sfConfig::get('sf_root_dir').'/config/ProjectConfiguration.class.php'; 
     24$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'test', true); 
    2525 
    2626// Put something in the cache 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.