Development

Changeset 8465

You must first sign up to be able to contribute.

Changeset 8465

Show
Ignore:
Timestamp:
04/15/08 02:20:33 (1 year ago)
Author:
fabien
Message:

fixed stuff so that you can have 2 different configuration in one single script (WIP, closes #3329)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/controller/sfController.class.php

    r7992 r8465  
    195195 
    196196    // check for a module generator config file 
    197     $this->context->getConfigCache()->import('modules/'.$moduleName.'/config/generator.yml', true, true); 
     197    $this->context->getConfigCache()->import('modules/'.$moduleName.'/config/generator.yml', false, true); 
    198198 
    199199    if (!$this->actionExists($moduleName, $actionName)) 
  • branches/1.1/lib/helper/I18NHelper.php

    r7757 r8465  
    2020function __($text, $args = array(), $catalogue = 'messages') 
    2121{ 
    22   static $i18n; 
    23  
    2422  if (sfConfig::get('sf_i18n')) 
    2523  { 
    26     if (!isset($i18n) || sfConfig::get('sf_test')) 
    27     { 
    28       $i18n = sfContext::getInstance()->getI18N(); 
    29     } 
    30  
    31     return $i18n->__($text, $args, $catalogue); 
     24    return sfContext::getInstance()->getI18N()->__($text, $args, $catalogue); 
    3225  } 
    3326  else 
  • branches/1.1/lib/helper/UrlHelper.php

    r8000 r8465  
    3939function url_for($internal_uri, $absolute = false) 
    4040{ 
    41   static $controller; 
    42  
    43   if (!isset($controller)) 
    44   { 
    45     $controller = sfContext::getInstance()->getController(); 
    46   } 
    47  
    48   return $controller->genUrl($internal_uri, $absolute); 
     41  return sfContext::getInstance()->getController()->genUrl($internal_uri, $absolute); 
    4942} 
    5043 
  • branches/1.1/lib/plugins/sfCompat10Plugin/config/config.php

    r7614 r8465  
    11<?php 
    22 
    3 if (sfConfig::get('sf_compat_10') && !class_exists('sfCompatAutoload', false)
     3if (sfConfig::get('sf_compat_10')
    44{ 
    5   class sfCompatAutoload extends sfSimpleAutoload 
     5  if (!class_exists('sfCompatAutoload', false)) 
    66  { 
     7    class sfCompatAutoload extends sfSimpleAutoload 
     8    { 
     9    } 
     10 
     11    // autoload classes 
     12    $autoload = sfCompatAutoload::getInstance(sfConfig::get('sf_app_cache_dir').'/sf_compat_autoloader.txt'); 
     13    $autoload->addDirectory(dirname(__FILE__).'/../lib'); 
     14    $autoload->register(); 
    715  } 
    8  
    9   // autoload classes 
    10   $autoload = sfCompatAutoload::getInstance(sfConfig::get('sf_app_cache_dir').'/sf_compat_autoloader.txt'); 
    11   $autoload->addDirectory(dirname(__FILE__).'/../lib'); 
    12   $autoload->register(); 
    1316 
    1417  // register config handler for validate/*.yml files 
  • branches/1.1/lib/plugins/sfPropelPlugin/test/functional/i18nTest.php

    r8296 r8465  
    1616} 
    1717 
    18 $b = new sfTestBrowser(); 
     18class myTestBrowser extends sfTestBrowser 
     19
     20  public function getContext($forceReload = false) 
     21  { 
     22    parent::getContext($forceReload); 
     23 
     24    sfPropel::initialize($this->context->getEventDispatcher()); 
     25 
     26    return $this->context; 
     27  } 
     28
     29 
     30$b = new myTestBrowser(); 
    1931 
    2032// en 
  • branches/1.1/lib/util/sfBrowser.class.php

    r8455 r8465  
    402402    if (is_null($this->context) || $forceReload) 
    403403    { 
    404       $this->context = sfContext::getInstance(); 
    405       $this->context->initialize($this->context->getConfiguration()); 
     404      if (!is_null($this->context)) 
     405      { 
     406        $currentConfiguration = $this->context->getConfiguration(); 
     407        $configuration = ProjectConfiguration::getApplicationConfiguration($currentConfiguration->getApplication(), $currentConfiguration->getEnvironment(), $currentConfiguration->isDebug()); 
     408        $this->context = sfContext::createInstance($configuration); 
     409      } 
     410      else 
     411      { 
     412        $this->context = sfContext::getInstance(); 
     413        $this->context->initialize($this->context->getConfiguration()); 
     414      } 
     415 
    406416      $this->context->getEventDispatcher()->connect('application.throw_exception', array($this, 'ListenToException')); 
     417      unset($currentConfiguration); 
    407418    } 
    408419 
  • branches/1.1/lib/util/sfContext.class.php

    r8368 r8465  
    5050    self::$current = $name; 
    5151 
    52     if (!isset(self::$instances[$name])) 
    53     { 
    54       self::$instances[$name] = new $class(); 
    55  
    56       if (!self::$instances[$name] instanceof sfContext) 
    57       { 
    58         throw new sfFactoryException(sprintf('Class "%s" is not of the type sfContext.', $class)); 
    59       } 
    60  
    61       self::$instances[$name]->initialize($configuration); 
    62     } 
     52    self::$instances[$name] = new $class(); 
     53 
     54    if (!self::$instances[$name] instanceof sfContext) 
     55    { 
     56      throw new sfFactoryException(sprintf('Class "%s" is not of the type sfContext.', $class)); 
     57    } 
     58 
     59    self::$instances[$name]->initialize($configuration); 
    6360 
    6461    return self::$instances[$name]; 

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.