Refactor Phrasea::start

This commit is contained in:
Romain Neutron
2012-02-23 10:29:19 +01:00
parent 157a6b51ff
commit 9bd67a5361
7 changed files with 13 additions and 7 deletions

View File

@@ -303,7 +303,7 @@ class Installer implements ControllerProviderInterface
} }
} }
\phrasea::start(); \phrasea::start($app['Core']);
$auth = new \Session_Authentication_None($user); $auth = new \Session_Authentication_None($user);

View File

@@ -80,7 +80,7 @@ class Core extends \Pimple
return \registry::get_instance($core); return \registry::get_instance($core);
}); });
\phrasea::start(); \phrasea::start($this);
$this->enableEvents(); $this->enableEvents();
} }

View File

@@ -88,6 +88,12 @@ class Configuration
if ($this->specifications->isSetup()) if ($this->specifications->isSetup())
{ {
$configurations = $this->specifications->getConfigurations(); $configurations = $this->specifications->getConfigurations();
if(!isset($configurations[$this->environment]))
{
throw new \Exception('Requested environnment is not available');
}
$this->configuration = new ParameterBag($configurations[$this->environment]); $this->configuration = new ParameterBag($configurations[$this->environment]);
} }
else else

View File

@@ -79,7 +79,7 @@ class appbox extends base
$this->registry = $registry; $this->registry = $registry;
$this->session = Session_Handler::getInstance($this); $this->session = Session_Handler::getInstance($this);
$configuration = \Alchemy\Phrasea\Core\Configuration::build(); $configuration = $Core->getConfiguration();
$choosenConnexion = $configuration->getPhraseanet()->get('database'); $choosenConnexion = $configuration->getPhraseanet()->get('database');

View File

@@ -103,9 +103,9 @@ class phrasea
return $retval; return $retval;
} }
public static function start() public static function start(\Alchemy\Phrasea\Core $Core)
{ {
$configuration = \Alchemy\Phrasea\Core\Configuration::build(); $configuration = $Core->getConfiguration();
$choosenConnexion = $configuration->getPhraseanet()->get('database'); $choosenConnexion = $configuration->getPhraseanet()->get('database');

View File

@@ -814,7 +814,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
*/ */
protected function resetTwig() protected function resetTwig()
{ {
$configuration = \Alchemy\Phrasea\Core\Configuration::build(); $configuration = self::$core->getConfiguration();
$serviceName = $configuration->getTemplating(); $serviceName = $configuration->getTemplating();
$confService = $configuration->getService($serviceName); $confService = $configuration->getService($serviceName);

View File

@@ -65,7 +65,7 @@ function getFormTimezone($props=array(), $selected=false)
return $form; return $form;
} }
phrasea::start(); phrasea::start($Core);
?> ?>
<html lang="<?php echo $session->get_I18n(); ?>"> <html lang="<?php echo $session->get_I18n(); ?>">
<head> <head>