Rename "phraseanet.configuration" service to "configuration"

This commit is contained in:
Romain Neutron
2013-11-15 22:08:07 +01:00
parent e0a8bec422
commit 13915dc1a8
87 changed files with 200 additions and 190 deletions

View File

@@ -56,7 +56,7 @@ $cli = new CLI("
under certain conditions; type `about:license' for details.\n\n" under certain conditions; type `about:license' for details.\n\n"
. ' Phraseanet Developer Tools ', Version::getName() . ' ' . Version::getNumber()); . ' Phraseanet Developer Tools ', Version::getName() . ' ' . Version::getNumber());
if ($cli['phraseanet.configuration']->isSetup()) { if ($cli['configuration']->isSetup()) {
$helpers = array( $helpers = array(
'db' => new ConnectionHelper($cli['EM']->getConnection()), 'db' => new ConnectionHelper($cli['EM']->getConnection()),
'em' => new EntityManagerHelper($cli['EM']) 'em' => new EntityManagerHelper($cli['EM'])

View File

@@ -240,8 +240,8 @@ class Application extends SilexApplication
'swftools.timeout' => 'swftools_timeout', 'swftools.timeout' => 'swftools_timeout',
'unoconv.timeout' => 'unoconv_timeout', 'unoconv.timeout' => 'unoconv_timeout',
) as $parameter => $key) { ) as $parameter => $key) {
if (isset($this['phraseanet.configuration']['binaries'][$key])) { if (isset($this['configuration']['binaries'][$key])) {
$configuration[$parameter] = $this['phraseanet.configuration']['binaries'][$key]; $configuration[$parameter] = $this['configuration']['binaries'][$key];
} }
} }
@@ -550,8 +550,8 @@ class Application extends SilexApplication
private function setupUrlGenerator() private function setupUrlGenerator()
{ {
$this['url_generator'] = $this->share($this->extend('url_generator', function ($urlGenerator, $app) { $this['url_generator'] = $this->share($this->extend('url_generator', function ($urlGenerator, $app) {
if ($app['phraseanet.configuration']->isSetup()) { if ($app['configuration']->isSetup()) {
$data = parse_url($app['phraseanet.configuration']['main']['servername']); $data = parse_url($app['configuration']['main']['servername']);
if (isset($data['scheme'])) { if (isset($data['scheme'])) {
$urlGenerator->getContext()->setScheme($data['scheme']); $urlGenerator->getContext()->setScheme($data['scheme']);

View File

@@ -25,7 +25,7 @@ class Configuration extends Command
protected function doExecute(InputInterface $input, OutputInterface $output) protected function doExecute(InputInterface $input, OutputInterface $output)
{ {
$this->container['phraseanet.configuration']->compileAndWrite(); $this->container['configuration']->compileAndWrite();
$output->writeln("Confguration compiled."); $output->writeln("Confguration compiled.");
return 0; return 0;

View File

@@ -32,7 +32,7 @@ class RegenerateSqliteDb extends Command
} }
try { try {
$dbParams = $this->container['phraseanet.configuration']->getTestConnectionParameters(); $dbParams = $this->container['configuration']->getTestConnectionParameters();
$dbParams['path'] = $source; $dbParams['path'] = $source;
$this->container->register(new ORMServiceProvider()); $this->container->register(new ORMServiceProvider());

View File

@@ -53,7 +53,7 @@ class XSendFileMappingGenerator extends Command
if ($input->getOption('write')) { if ($input->getOption('write')) {
$output->write("Writing configuration ..."); $output->write("Writing configuration ...");
$this->container['phraseanet.configuration']['xsendfile'] = $conf; $this->container['configuration']['xsendfile'] = $conf;
$output->writeln(" <info>OK</info>"); $output->writeln(" <info>OK</info>");
$output->writeln(""); $output->writeln("");
$output->write("It is now strongly recommended to use <info>xsendfile:dump-configuration</info> command to upgrade your virtual-host"); $output->write("It is now strongly recommended to use <info>xsendfile:dump-configuration</info> command to upgrade your virtual-host");

View File

@@ -46,7 +46,7 @@ abstract class AbstractDelivery implements ControllerProviderInterface
$referrer = $_SERVER['HTTP_REFERER']; $referrer = $_SERVER['HTTP_REFERER'];
} }
$record->log_view($log_id, $referrer, $app['phraseanet.configuration']['main']['key']); $record->log_view($log_id, $referrer, $app['configuration']['main']['key']);
} catch (\Exception $e) { } catch (\Exception $e) {
} }

View File

@@ -158,7 +158,7 @@ class Databoxes implements ControllerProviderInterface
if ((null === $request->request->get('new_settings')) && (null !== $dataTemplate = $request->request->get('new_data_template'))) { if ((null === $request->request->get('new_settings')) && (null !== $dataTemplate = $request->request->get('new_data_template'))) {
$configuration = $app['phraseanet.configuration']; $configuration = $app['configuration'];
$connexion = $configuration['main']['database']; $connexion = $configuration['main']['database'];
$hostname = $connexion['host']; $hostname = $connexion['host'];
@@ -229,7 +229,7 @@ class Databoxes implements ControllerProviderInterface
if ((null === $request->request->get('new_settings'))) { if ((null === $request->request->get('new_settings'))) {
try { try {
$configuration = $app['phraseanet.configuration']; $configuration = $app['configuration'];
$connexion = $configuration['main']['database']; $connexion = $configuration['main']['database'];
$hostname = $connexion['host']; $hostname = $connexion['host'];

View File

@@ -139,7 +139,7 @@ class TaskManager implements ControllerProviderInterface
$task = $app['manipulator.task']->create( $task = $app['manipulator.task']->create(
$job->getName(), $job->getName(),
$job->getJobId(), $job->getJobId(),
$job->getEditor()->getDefaultSettings($app['phraseanet.configuration']), $job->getEditor()->getDefaultSettings($app['configuration']),
$job->getEditor()->getDefaultPeriod() $job->getEditor()->getDefaultPeriod()
); );

View File

@@ -110,7 +110,7 @@ class Session implements ControllerProviderInterface
} }
if (in_array($app['session']->get('phraseanet.message'), array('1', null))) { if (in_array($app['session']->get('phraseanet.message'), array('1', null))) {
if ($app['phraseanet.configuration']['main']['maintenance']) { if ($app['configuration']['main']['maintenance']) {
$ret['message'] .= _('The application is going down for maintenance, please logout.'); $ret['message'] .= _('The application is going down for maintenance, please logout.');
} }

View File

@@ -36,12 +36,12 @@ class CLIDriversServiceProvider implements ServiceProviderInterface
$extraDirs[] = $app['root.path'] . '/node_modules/.bin'; $extraDirs[] = $app['root.path'] . '/node_modules/.bin';
} }
if (!$app['phraseanet.configuration']->isSetup()) { if (!$app['configuration']->isSetup()) {
return $app['executable-finder']->find($name, null, $extraDirs); return $app['executable-finder']->find($name, null, $extraDirs);
} }
if (isset($app['phraseanet.configuration']['binaries'][$configName])) { if (isset($app['configuration']['binaries'][$configName])) {
return $app['phraseanet.configuration']['binaries'][$configName]; return $app['configuration']['binaries'][$configName];
} }
return $app['executable-finder']->find($name, null, $extraDirs); return $app['executable-finder']->find($name, null, $extraDirs);

View File

@@ -56,7 +56,7 @@ class PluginServiceProvider implements ServiceProviderInterface
}); });
$app['plugins.composer-installer'] = $app->share(function (Application $app) { $app['plugins.composer-installer'] = $app->share(function (Application $app) {
$binaries = $app['phraseanet.configuration']['binaries']; $binaries = $app['configuration']['binaries'];
$phpBinary = isset($binaries['php_binary']) ? $binaries['php_binary'] : null; $phpBinary = isset($binaries['php_binary']) ? $binaries['php_binary'] : null;
if (!is_executable($phpBinary)) { if (!is_executable($phpBinary)) {

View File

@@ -41,11 +41,11 @@ class DebuggerSubscriber implements EventSubscriberInterface
return; return;
} }
if ($this->app['phraseanet.configuration']->isSetup() if ($this->app['configuration']->isSetup()
&& isset($this->app['phraseanet.configuration']['debugger']) && isset($this->app['configuration']['debugger'])
&& isset($this->app['phraseanet.configuration']['debugger']['allowed-ips'])) { && isset($this->app['configuration']['debugger']['allowed-ips'])) {
$allowedIps = $this->app['phraseanet.configuration']['debugger']['allowed-ips']; $allowedIps = $this->app['configuration']['debugger']['allowed-ips'];
$allowedIps = is_array($allowedIps) ? $allowedIps : array($allowedIps); $allowedIps = is_array($allowedIps) ? $allowedIps : array($allowedIps);
} else { } else {
$allowedIps = array(); $allowedIps = array();

View File

@@ -34,7 +34,7 @@ class MaintenanceSubscriber implements EventSubscriberInterface
public function checkForMaintenance(GetResponseEvent $event) public function checkForMaintenance(GetResponseEvent $event)
{ {
if ($this->app['phraseanet.configuration']->isSetup() && $this->app['phraseanet.configuration']['main']['maintenance']) { if ($this->app['configuration']->isSetup() && $this->app['configuration']['main']['maintenance']) {
$this->app->abort(503, 'Service Temporarily Unavailable', array('Retry-After' => 3600)); $this->app->abort(503, 'Service Temporarily Unavailable', array('Retry-After' => 3600));
} }
} }

View File

@@ -36,7 +36,7 @@ class PersistentCookieSubscriber implements EventSubscriberInterface
{ {
$request = $event->getRequest(); $request = $event->getRequest();
if ($this->app['phraseanet.configuration']->isSetup() && $request->cookies->has('persistent') && !$this->app['authentication']->isAuthenticated()) { if ($this->app['configuration']->isSetup() && $request->cookies->has('persistent') && !$this->app['authentication']->isAuthenticated()) {
if (false !== $session = $this->app['authentication.persistent-manager']->getSession($request->cookies->get('persistent'))) { if (false !== $session = $this->app['authentication.persistent-manager']->getSession($request->cookies->get('persistent'))) {
$this->app['authentication']->refreshAccount($session); $this->app['authentication']->refreshAccount($session);
} }

View File

@@ -35,7 +35,7 @@ class XSendFileSubscriber implements EventSubscriberInterface
public function applyHeaders(GetResponseEvent $event) public function applyHeaders(GetResponseEvent $event)
{ {
if (!$this->app['phraseanet.configuration']->isSetup()) { if (!$this->app['configuration']->isSetup()) {
return; return;
} }

View File

@@ -53,7 +53,7 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
}); });
$app['authentication.providers.account-creator'] = $app->share(function (Application $app) { $app['authentication.providers.account-creator'] = $app->share(function (Application $app) {
$authConf = $app['phraseanet.configuration']['authentication']; $authConf = $app['configuration']['authentication'];
$templates = array_filter(array_map(function ($templateId) use ($app) { $templates = array_filter(array_map(function ($templateId) use ($app) {
try { try {
if (is_int($templateId) || ctype_digit($templateId)) { if (is_int($templateId) || ctype_digit($templateId)) {
@@ -78,7 +78,7 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
$providers = new ProvidersCollection(); $providers = new ProvidersCollection();
$authConf = $app['phraseanet.configuration']['authentication']; $authConf = $app['configuration']['authentication'];
foreach ($authConf['providers'] as $providerId => $data) { foreach ($authConf['providers'] as $providerId => $data) {
if (isset($data['enabled']) && false === $data['enabled']) { if (isset($data['enabled']) && false === $data['enabled']) {
continue; continue;
@@ -94,7 +94,7 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
}); });
$app['auth.password-encoder'] = $app->share(function (Application $app) { $app['auth.password-encoder'] = $app->share(function (Application $app) {
return new PasswordEncoder($app['phraseanet.configuration']['main']['key']); return new PasswordEncoder($app['configuration']['main']['key']);
}); });
$app['auth.old-password-encoder'] = $app->share(function (Application $app) { $app['auth.old-password-encoder'] = $app->share(function (Application $app) {
@@ -102,7 +102,7 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
}); });
$app['auth.native.failure-manager'] = $app->share(function (Application $app) { $app['auth.native.failure-manager'] = $app->share(function (Application $app) {
$authConf = $app['phraseanet.configuration']['authentication']['captcha']; $authConf = $app['configuration']['authentication']['captcha'];
return new FailureManager($app['EM'], $app['recaptcha'], isset($authConf['trials-before-display']) ? $authConf['trials-before-display'] : 9); return new FailureManager($app['EM'], $app['recaptcha'], isset($authConf['trials-before-display']) ? $authConf['trials-before-display'] : 9);
}); });
@@ -112,7 +112,7 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
}); });
$app['auth.native'] = $app->share(function (Application $app) { $app['auth.native'] = $app->share(function (Application $app) {
$authConf = $app['phraseanet.configuration']['authentication']; $authConf = $app['configuration']['authentication'];
if ($authConf['captcha']['enabled']) { if ($authConf['captcha']['enabled']) {
return new FailureHandledNativeAuthentication( return new FailureHandledNativeAuthentication(

View File

@@ -30,7 +30,7 @@ class BorderManagerServiceProvider implements ServiceProviderInterface
} }
$options = $app['phraseanet.configuration']['border-manager']; $options = $app['configuration']['border-manager'];
$registeredCheckers = array(); $registeredCheckers = array();

View File

@@ -42,13 +42,13 @@ class CacheServiceProvider implements ServiceProviderInterface
}); });
$app['cache'] = $app->share(function (Application $app) { $app['cache'] = $app->share(function (Application $app) {
$conf = $app['phraseanet.configuration']['main']['cache']; $conf = $app['configuration']['main']['cache'];
return $app['phraseanet.cache-service']->factory('cache', $conf['type'], $conf['options']); return $app['phraseanet.cache-service']->factory('cache', $conf['type'], $conf['options']);
}); });
$app['opcode-cache'] = $app->share(function (Application $app) { $app['opcode-cache'] = $app->share(function (Application $app) {
$conf = $app['phraseanet.configuration']['main']['opcodecache']; $conf = $app['configuration']['main']['opcodecache'];
return $app['phraseanet.cache-service']->factory('cache', $conf['type'], $conf['options']); return $app['phraseanet.cache-service']->factory('cache', $conf['type'], $conf['options']);
}); });

View File

@@ -31,7 +31,7 @@ class ConfigurationServiceProvider implements ServiceProviderInterface
$app['phraseanet.configuration.config-path'] = $app['root.path'] . '/config/configuration.yml'; $app['phraseanet.configuration.config-path'] = $app['root.path'] . '/config/configuration.yml';
$app['phraseanet.configuration.config-compiled-path'] = $app['root.path'] . '/tmp/configuration-compiled.php'; $app['phraseanet.configuration.config-compiled-path'] = $app['root.path'] . '/tmp/configuration-compiled.php';
$app['phraseanet.configuration'] = $app->share(function (SilexApplication $app) { $app['configuration'] = $app->share(function (SilexApplication $app) {
return new Configuration( return new Configuration(
$app['phraseanet.configuration.yaml-parser'], $app['phraseanet.configuration.yaml-parser'],
$app['phraseanet.configuration.compiler'], $app['phraseanet.configuration.compiler'],
@@ -40,6 +40,11 @@ class ConfigurationServiceProvider implements ServiceProviderInterface
$app['debug'] $app['debug']
); );
}); });
// Maintaining BC until 3.10
$app['phraseanet.configuration'] = $app->share(function (SilexApplication $app) {
return $app['configuration'];
});
} }
/** /**
@@ -49,7 +54,7 @@ class ConfigurationServiceProvider implements ServiceProviderInterface
{ {
$app['dispatcher'] = $app->share( $app['dispatcher'] = $app->share(
$app->extend('dispatcher', function ($dispatcher, SilexApplication $app) { $app->extend('dispatcher', function ($dispatcher, SilexApplication $app) {
$dispatcher->addSubscriber(new TrustedProxySubscriber($app['phraseanet.configuration'])); $dispatcher->addSubscriber(new TrustedProxySubscriber($app['configuration']));
return $dispatcher; return $dispatcher;
}) })

View File

@@ -38,10 +38,10 @@ class LocaleServiceProvider implements ServiceProviderInterface
$app['locales.available'] = $app->share(function (Application $app) { $app['locales.available'] = $app->share(function (Application $app) {
$availableLanguages = PhraseaApplication::getAvailableLanguages(); $availableLanguages = PhraseaApplication::getAvailableLanguages();
if ($app['phraseanet.configuration']->isSetup() if ($app['configuration']->isSetup()
&& isset($app['phraseanet.configuration']['main']['languages']) && isset($app['configuration']['main']['languages'])
&& !empty($app['phraseanet.configuration']['main']['languages'])) { && !empty($app['configuration']['main']['languages'])) {
$languages = $app['phraseanet.configuration']['main']['languages']; $languages = $app['configuration']['main']['languages'];
$enabledLanguages = $availableLanguages; $enabledLanguages = $availableLanguages;
foreach ($enabledLanguages as $code => $language) { foreach ($enabledLanguages as $code => $language) {

View File

@@ -100,17 +100,17 @@ class ORMServiceProvider implements ServiceProviderInterface
}); });
$app['EM.opcode-cache-type'] = $app->share(function (Application $app) { $app['EM.opcode-cache-type'] = $app->share(function (Application $app) {
return $app['phraseanet.configuration']['main']['opcodecache']['type']; return $app['configuration']['main']['opcodecache']['type'];
}); });
$app['EM.opcode-cache-options'] = $app->share(function (Application $app) { $app['EM.opcode-cache-options'] = $app->share(function (Application $app) {
return $app['phraseanet.configuration']['main']['opcodecache']['options']; return $app['configuration']['main']['opcodecache']['options'];
}); });
$app['EM.cache-type'] = $app->share(function (Application $app) { $app['EM.cache-type'] = $app->share(function (Application $app) {
return $app['phraseanet.configuration']['main']['cache']['type']; return $app['configuration']['main']['cache']['type'];
}); });
$app['EM.cache-options'] = $app->share(function (Application $app) { $app['EM.cache-options'] = $app->share(function (Application $app) {
return $app['phraseanet.configuration']['main']['cache']['options']; return $app['configuration']['main']['cache']['options'];
}); });
$app['EM.events-manager'] = $app->share(function (Application $app) { $app['EM.events-manager'] = $app->share(function (Application $app) {
$evm = new EventManager(); $evm = new EventManager();
@@ -121,10 +121,10 @@ class ORMServiceProvider implements ServiceProviderInterface
$app['EM.dbal-conf'] = $app->share(function (Application $app) { $app['EM.dbal-conf'] = $app->share(function (Application $app) {
if ('test' === $app->getEnvironment()) { if ('test' === $app->getEnvironment()) {
return $app['phraseanet.configuration']['main']['database-test']; return $app['configuration']['main']['database-test'];
} }
return $app['phraseanet.configuration']['main']['database']; return $app['configuration']['main']['database'];
}); });
$app['EM'] = $app->share(function (Application $app) { $app['EM'] = $app->share(function (Application $app) {

View File

@@ -21,7 +21,7 @@ class RegistrationServiceProvider implements ServiceProviderInterface
public function register(Application $app) public function register(Application $app)
{ {
$app['registration.fields'] = $app->share(function (Application $app) { $app['registration.fields'] = $app->share(function (Application $app) {
return isset($app['phraseanet.configuration']['registration-fields']) ? $app['phraseanet.configuration']['registration-fields'] : array(); return isset($app['configuration']['registration-fields']) ? $app['configuration']['registration-fields'] : array();
}); });
$app['registration.enabled'] = $app->share(function (Application $app) { $app['registration.enabled'] = $app->share(function (Application $app) {

View File

@@ -24,8 +24,8 @@ class SearchEngineServiceProvider implements ServiceProviderInterface
{ {
$app['phraseanet.SE'] = $app->share(function ($app) { $app['phraseanet.SE'] = $app->share(function ($app) {
$engineClass = $app['phraseanet.configuration']['main']['search-engine']['type']; $engineClass = $app['configuration']['main']['search-engine']['type'];
$engineOptions = $app['phraseanet.configuration']['main']['search-engine']['options']; $engineOptions = $app['configuration']['main']['search-engine']['options'];
if (!class_exists($engineClass) || $engineClass instanceof SearchEngineInterface) { if (!class_exists($engineClass) || $engineClass instanceof SearchEngineInterface) {
throw new InvalidArgumentException(sprintf('%s is not valid SearchEngineInterface', $engineClass)); throw new InvalidArgumentException(sprintf('%s is not valid SearchEngineInterface', $engineClass));

View File

@@ -36,8 +36,8 @@ class TasksServiceProvider implements ServiceProviderInterface
}); });
$app['task-manager.listener.options'] = $app->share(function (Application $app) { $app['task-manager.listener.options'] = $app->share(function (Application $app) {
if (isset($app['phraseanet.configuration']['task-manager']) && isset($app['phraseanet.configuration']['task-manager']['listener'])) { if (isset($app['configuration']['task-manager']) && isset($app['configuration']['task-manager']['listener'])) {
$listenerConf = $app['phraseanet.configuration']['task-manager']['listener']; $listenerConf = $app['configuration']['task-manager']['listener'];
} else { } else {
$listenerConf = array(); $listenerConf = array();
} }
@@ -55,7 +55,7 @@ class TasksServiceProvider implements ServiceProviderInterface
}); });
$app['task-manager.status'] = $app->share(function (Application $app) { $app['task-manager.status'] = $app->share(function (Application $app) {
return new TaskManagerStatus($app['phraseanet.configuration']); return new TaskManagerStatus($app['configuration']);
}); });
$app['task-manager.live-information'] = $app->share(function (Application $app) { $app['task-manager.live-information'] = $app->share(function (Application $app) {

View File

@@ -48,7 +48,7 @@ class XSendFileFactory
*/ */
public static function create(Application $app) public static function create(Application $app)
{ {
$conf = $app['phraseanet.configuration']['xsendfile']; $conf = $app['configuration']['xsendfile'];
$mapping = array(); $mapping = array();

View File

@@ -161,7 +161,7 @@ class PhraseaEngine implements SearchEngineInterface
return $this; return $this;
} }
$connexion = $this->app['phraseanet.configuration']['main']['database']; $connexion = $this->app['configuration']['main']['database'];
$hostname = $connexion['host']; $hostname = $connexion['host'];
$port = (int) $connexion['port']; $port = (int) $connexion['port'];
@@ -228,7 +228,7 @@ class PhraseaEngine implements SearchEngineInterface
public function getConfigurationPanel() public function getConfigurationPanel()
{ {
if (!$this->configurationPanel) { if (!$this->configurationPanel) {
$this->configurationPanel = new ConfigurationPanel($this, $this->app['phraseanet.configuration']); $this->configurationPanel = new ConfigurationPanel($this, $this->app['configuration']);
} }
return $this->configurationPanel; return $this->configurationPanel;
@@ -556,7 +556,7 @@ class PhraseaEngine implements SearchEngineInterface
, $sbas_id , $sbas_id
, $this->colls[$sbas_id] , $this->colls[$sbas_id]
, $this->arrayq[$sbas_id] , $this->arrayq[$sbas_id]
, $this->app['phraseanet.configuration']['main']['key'] , $this->app['configuration']['main']['key']
, $this->app['session']->get('usr_id') , $this->app['session']->get('usr_id')
, false , false
, $this->options->getSearchType() == SearchEngineOptions::RECORD_GROUPING ? PHRASEA_MULTIDOC_REGONLY : PHRASEA_MULTIDOC_DOCONLY , $this->options->getSearchType() == SearchEngineOptions::RECORD_GROUPING ? PHRASEA_MULTIDOC_REGONLY : PHRASEA_MULTIDOC_DOCONLY

View File

@@ -175,7 +175,7 @@ class SphinxSearchEngine implements SearchEngineInterface
public function getConfigurationPanel() public function getConfigurationPanel()
{ {
if (!$this->configurationPanel) { if (!$this->configurationPanel) {
$this->configurationPanel = new ConfigurationPanel($this, $this->app['phraseanet.configuration']); $this->configurationPanel = new ConfigurationPanel($this, $this->app['configuration']);
} }
return $this->configurationPanel; return $this->configurationPanel;

View File

@@ -81,7 +81,7 @@ class ConfigurationTester
*/ */
public function isInstalled() public function isInstalled()
{ {
return $this->app['phraseanet.configuration']->isSetup(); return $this->app['configuration']->isSetup();
} }
/** /**

View File

@@ -104,7 +104,7 @@ class Installer
$this->app['manipulator.task']->create( $this->app['manipulator.task']->create(
$job->getName(), $job->getName(),
$job->getJobId(), $job->getJobId(),
$job->getEditor()->getDefaultSettings($this->app['phraseanet.configuration']), $job->getEditor()->getDefaultSettings($this->app['configuration']),
$job->getEditor()->getDefaultPeriod() $job->getEditor()->getDefaultPeriod()
); );
} }
@@ -152,7 +152,7 @@ class Installer
} }
} }
$this->app['phraseanet.configuration']->delete(); $this->app['configuration']->delete();
return; return;
} }
@@ -176,7 +176,7 @@ class Installer
private function createConfigFile($abConn, $serverName, $binaryData) private function createConfigFile($abConn, $serverName, $binaryData)
{ {
$config = $this->app['phraseanet.configuration']->initialize(); $config = $this->app['configuration']->initialize();
foreach ($abConn->get_credentials() as $key => $value) { foreach ($abConn->get_credentials() as $key => $value) {
$key = $key == 'hostname' ? 'host' : $key; $key = $key == 'hostname' ? 'host' : $key;
@@ -192,6 +192,6 @@ class Installer
$config['main']['key'] = md5(mt_rand(100000000, 999999999)); $config['main']['key'] = md5(mt_rand(100000000, 999999999));
$this->app['phraseanet.registry']->setKey($config['main']['key']); $this->app['phraseanet.registry']->setKey($config['main']['key']);
$this->app['phraseanet.configuration']->setConfig($config); $this->app['configuration']->setConfig($config);
} }
} }

View File

@@ -39,6 +39,6 @@ class BinariesProbe extends BinariesRequirements implements ProbeInterface
*/ */
public static function create(Application $app) public static function create(Application $app)
{ {
return new static($app['phraseanet.configuration']['binaries']); return new static($app['configuration']['binaries']);
} }
} }

View File

@@ -29,7 +29,7 @@ class Migration35 implements MigrationInterface
throw new \LogicException('Required config files not found'); throw new \LogicException('Required config files not found');
} }
$config = $this->app['phraseanet.configuration']->initialize(); $config = $this->app['configuration']->initialize();
foreach ($config['registration-fields'] as $key => $field) { foreach ($config['registration-fields'] as $key => $field) {
$config['registration-fields'][$key]['required'] = (boolean) $field['required']; $config['registration-fields'][$key]['required'] = (boolean) $field['required'];
@@ -67,6 +67,6 @@ class Migration35 implements MigrationInterface
rename(__DIR__ . '/../../../../../../config/connexion.inc', __DIR__ . '/../../../../../../config/connexion.inc.old'); rename(__DIR__ . '/../../../../../../config/connexion.inc', __DIR__ . '/../../../../../../config/connexion.inc.old');
rename(__DIR__ . '/../../../../../../config/config.inc', __DIR__ . '/../../../../../../config/config.inc.old'); rename(__DIR__ . '/../../../../../../config/config.inc', __DIR__ . '/../../../../../../config/config.inc.old');
$this->app['phraseanet.configuration']->setConfig($config); $this->app['configuration']->setConfig($config);
} }
} }

View File

@@ -49,14 +49,14 @@ class Migration38 implements MigrationInterface
private function doMigrate($app) private function doMigrate($app)
{ {
$app['phraseanet.configuration']->initialize(); $app['configuration']->initialize();
$conf = $app['phraseanet.configuration']->getConfig(); $conf = $app['configuration']->getConfig();
$this->migrateConnexions($conf); $this->migrateConnexions($conf);
$this->migrateConfigAndServices($conf); $this->migrateConfigAndServices($conf);
$this->migrateBinaries($conf); $this->migrateBinaries($conf);
$app['phraseanet.configuration']->setConfig($conf); $app['configuration']->setConfig($conf);
foreach (array( foreach (array(
$this->configYaml, $this->configYaml,

View File

@@ -79,7 +79,7 @@ class PhraseanetIndexerJob extends AbstractJob
private function getPhraseanetIndexerPath(Application $app) private function getPhraseanetIndexerPath(Application $app)
{ {
$binaries = $app['phraseanet.configuration']['binaries']; $binaries = $app['configuration']['binaries'];
if (isset($binaries['phraseanet_indexer'])) { if (isset($binaries['phraseanet_indexer'])) {
$path = $binaries['phraseanet_indexer']; $path = $binaries['phraseanet_indexer'];

View File

@@ -1478,7 +1478,7 @@ class ACL implements cache_cacheableInterface
foreach ($this->get_granted_base(array(), array($databox->get_sbas_id())) as $collection) { foreach ($this->get_granted_base(array(), array($databox->get_sbas_id())) as $collection) {
$stmt->execute(array( $stmt->execute(array(
':site_id' => $this->app['phraseanet.configuration']['main']['key'], ':site_id' => $this->app['configuration']['main']['key'],
':usr_id' => $this->user->get_id(), ':usr_id' => $this->user->get_id(),
':coll_id' => $collection->get_coll_id(), ':coll_id' => $collection->get_coll_id(),
':mask_and' => $this->get_mask_and($collection->get_base_id()), ':mask_and' => $this->get_mask_and($collection->get_base_id()),
@@ -1506,7 +1506,7 @@ class ACL implements cache_cacheableInterface
$sql = 'DELETE FROM collusr WHERE usr_id = :usr_id AND site = :site'; $sql = 'DELETE FROM collusr WHERE usr_id = :usr_id AND site = :site';
$params = array( $params = array(
':usr_id' => $this->user->get_id() ':usr_id' => $this->user->get_id()
, ':site' => $this->app['phraseanet.configuration']['main']['key'] , ':site' => $this->app['configuration']['main']['key']
); );
$stmt = $databox->get_connection()->prepare($sql); $stmt = $databox->get_connection()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);

View File

@@ -310,9 +310,9 @@ class API_V1_adapter extends API_V1_Abstract
$ret['phraseanet']['environment'] = $app->getEnvironment(); $ret['phraseanet']['environment'] = $app->getEnvironment();
$ret['phraseanet']['debug'] = $app['debug']; $ret['phraseanet']['debug'] = $app['debug'];
$ret['phraseanet']['maintenance'] = $app['phraseanet.configuration']['main']['maintenance']; $ret['phraseanet']['maintenance'] = $app['configuration']['main']['maintenance'];
$ret['phraseanet']['errorsLog'] = $app['debug']; $ret['phraseanet']['errorsLog'] = $app['debug'];
$ret['phraseanet']['serverName'] = $app['phraseanet.configuration']['main']['servername']; $ret['phraseanet']['serverName'] = $app['configuration']['main']['servername'];
return $ret; return $ret;
} }
@@ -330,7 +330,7 @@ class API_V1_adapter extends API_V1_Abstract
$SEStatus = array('error' => $e->getMessage()); $SEStatus = array('error' => $e->getMessage());
} }
$binaries = $app['phraseanet.configuration']['binaries']; $binaries = $app['configuration']['binaries'];
return array( return array(
'global_values' => array( 'global_values' => array(
@@ -341,13 +341,13 @@ class API_V1_adapter extends API_V1_Abstract
'httpServer' => array( 'httpServer' => array(
'logErrors' => $app['phraseanet.registry']->get('GV_log_errors'), 'logErrors' => $app['phraseanet.registry']->get('GV_log_errors'),
'phpTimezone' => ini_get('date.timezone'), 'phpTimezone' => ini_get('date.timezone'),
'siteId' => $app['phraseanet.configuration']['main']['key'], 'siteId' => $app['configuration']['main']['key'],
'staticUrl' => $app['phraseanet.registry']->get('GV_STATIC_URL'), 'staticUrl' => $app['phraseanet.registry']->get('GV_STATIC_URL'),
'defaultLanguage' => $app['phraseanet.registry']->get('id_GV_default_lng'), 'defaultLanguage' => $app['phraseanet.registry']->get('id_GV_default_lng'),
'allowIndexing' => $app['phraseanet.registry']->get('GV_allow_search_engine'), 'allowIndexing' => $app['phraseanet.registry']->get('GV_allow_search_engine'),
'modes' => array( 'modes' => array(
'XsendFile' => $app['phraseanet.configuration']['xsendfile']['enabled'], 'XsendFile' => $app['configuration']['xsendfile']['enabled'],
'XsendFileMapping' => $app['phraseanet.configuration']['xsendfile']['mapping'], 'XsendFileMapping' => $app['configuration']['xsendfile']['mapping'],
'h264Streaming' => $app['phraseanet.registry']->get('GV_h264_streaming'), 'h264Streaming' => $app['phraseanet.registry']->get('GV_h264_streaming'),
'authTokenDirectory' => $app['phraseanet.registry']->get('GV_mod_auth_token_directory'), 'authTokenDirectory' => $app['phraseanet.registry']->get('GV_mod_auth_token_directory'),
'authTokenDirectoryPath' => $app['phraseanet.registry']->get('GV_mod_auth_token_directory_path'), 'authTokenDirectoryPath' => $app['phraseanet.registry']->get('GV_mod_auth_token_directory_path'),

View File

@@ -199,7 +199,7 @@ class API_V1_result
$this->app['dispatcher']->dispatch(PhraseaEvents::API_RESULT, new ApiResultEvent()); $this->app['dispatcher']->dispatch(PhraseaEvents::API_RESULT, new ApiResultEvent());
$conf = $this->app['phraseanet.configuration']; $conf = $this->app['configuration'];
if (isset($conf['main']['api-timers']) && true === $conf['main']['api-timers']) { if (isset($conf['main']['api-timers']) && true === $conf['main']['api-timers']) {
$ret['timers'] = $this->app['api.timers']->toArray(); $ret['timers'] = $this->app['api.timers']->toArray();

View File

@@ -121,7 +121,7 @@ class Session_Logger
$params = array( $params = array(
':ses_id' => $app['session']->get('session_id'), ':ses_id' => $app['session']->get('session_id'),
':usr_login' => $app['authentication']->getUser() ? $app['authentication']->getUser()->get_login() : null, ':usr_login' => $app['authentication']->getUser() ? $app['authentication']->getUser()->get_login() : null,
':site_id' => $app['phraseanet.configuration']['main']['key'], ':site_id' => $app['configuration']['main']['key'],
':usr_id' => $app['authentication']->isAuthenticated() ? $app['authentication']->getUser()->get_id() : null, ':usr_id' => $app['authentication']->isAuthenticated() ? $app['authentication']->getUser()->get_id() : null,
':browser' => $browser->getBrowser(), ':browser' => $browser->getBrowser(),
':browser_version' => $browser->getExtendedVersion(), ':browser_version' => $browser->getExtendedVersion(),
@@ -167,7 +167,7 @@ class Session_Logger
WHERE site = :site AND sit_session = :ses_id'; WHERE site = :site AND sit_session = :ses_id';
$params = array( $params = array(
':site' => $app['phraseanet.configuration']['main']['key'] ':site' => $app['configuration']['main']['key']
, ':ses_id' => $app['session']->get('session_id') , ':ses_id' => $app['session']->get('session_id')
); );

View File

@@ -1057,12 +1057,12 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
} }
} }
if (isset($this->app['phraseanet.configuration']['user-settings'])) { if (isset($this->app['configuration']['user-settings'])) {
$this->_prefs = array_replace( $this->_prefs = array_replace(
$this->_prefs, $this->_prefs,
// remove keys that are not defined in default values // remove keys that are not defined in default values
array_intersect_key( array_intersect_key(
$this->app['phraseanet.configuration']['user-settings'], $this->app['configuration']['user-settings'],
self::$def_values self::$def_values
) )
); );

View File

@@ -65,7 +65,7 @@ class appbox extends base
{ {
$this->app = $app; $this->app = $app;
$this->connection = connection::getPDOConnection($app); $this->connection = connection::getPDOConnection($app);
$connexion = $app['phraseanet.configuration']['main']['database']; $connexion = $app['configuration']['main']['database'];
$this->host = $connexion['host']; $this->host = $connexion['host'];
$this->port = $connexion['port']; $this->port = $connexion['port'];

View File

@@ -129,7 +129,7 @@ class connection
if (trim($name) !== 'appbox') { if (trim($name) !== 'appbox') {
$connection_params = phrasea::sbas_params($app); $connection_params = phrasea::sbas_params($app);
} else { } else {
$connexion = $app['phraseanet.configuration']['main']['database']; $connexion = $app['configuration']['main']['database'];
$hostname = $connexion['host']; $hostname = $connexion['host'];
$port = $connexion['port']; $port = $connexion['port'];

View File

@@ -462,7 +462,7 @@ class databox extends base
$this->app['EM']->flush(); $this->app['EM']->flush();
$params = array(':site_id' => $this->app['phraseanet.configuration']['main']['key']); $params = array(':site_id' => $this->app['configuration']['main']['key']);
$sql = 'DELETE FROM clients WHERE site_id = :site_id'; $sql = 'DELETE FROM clients WHERE site_id = :site_id';
$stmt = $this->get_connection()->prepare($sql); $stmt = $this->get_connection()->prepare($sql);

View File

@@ -70,7 +70,7 @@ class module_console_checkExtension extends Command
$output->writeln("<info>$function</info>"); $output->writeln("<info>$function</info>");
} }
$configuration = $this->getService('phraseanet.configuration'); $configuration = $this->getService('configuration');
$connexion = $configuration['main']['database']; $connexion = $configuration['main']['database'];
$hostname = $connexion['host']; $hostname = $connexion['host'];
$port = $connexion['port']; $port = $connexion['port'];
@@ -167,7 +167,7 @@ class module_console_checkExtension extends Command
, $base["sbas_id"] , $base["sbas_id"]
, $base["searchcoll"] , $base["searchcoll"]
, $base["arrayq"] , $base["arrayq"]
, $this->container['phraseanet.configuration']['main']['key'] , $this->container['configuration']['main']['key']
, $usrId , $usrId
, false , false
, PHRASEA_MULTIDOC_DOCONLY , PHRASEA_MULTIDOC_DOCONLY

View File

@@ -624,7 +624,7 @@ class module_report_activity extends module_report
$result['top_ten_poiddoc'] = array(); $result['top_ten_poiddoc'] = array();
$result['top_ten_poidprev'] = array(); $result['top_ten_poidprev'] = array();
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']); $params = array(':site_id' => $app['configuration']['main']['key']);
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$params = array_merge($params, $datefilter['params']); $params = array_merge($params, $datefilter['params']);
@@ -704,7 +704,7 @@ class module_report_activity extends module_report
$collfilter = $collfilter =
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']); $params = array(':site_id' => $app['configuration']['main']['key']);
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = " $sql = "
@@ -751,7 +751,7 @@ class module_report_activity extends module_report
$collfilter = $collfilter =
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']); $params = array(':site_id' => $app['configuration']['main']['key']);
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = " $sql = "
@@ -792,7 +792,7 @@ class module_report_activity extends module_report
$collfilter = $collfilter =
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']); $params = array(':site_id' => $app['configuration']['main']['key']);
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = " $sql = "
@@ -832,7 +832,7 @@ class module_report_activity extends module_report
$collfilter = $collfilter =
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']); $params = array(':site_id' => $app['configuration']['main']['key']);
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = " $sql = "

View File

@@ -141,7 +141,7 @@ class module_report_connexion extends module_report
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array_merge(array( $params = array_merge(array(
':site_id' => $app['phraseanet.configuration']['main']['key'] ':site_id' => $app['configuration']['main']['key']
), ),
$datefilter['params'], $datefilter['params'],
$collfilter['params'] $collfilter['params']

View File

@@ -174,7 +174,7 @@ class module_report_download extends module_report
{ {
$conn = connection::getPDOConnection($app, $sbas_id); $conn = connection::getPDOConnection($app, $sbas_id);
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']); $params = array(':site_id' => $app['configuration']['main']['key']);
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
@@ -210,7 +210,7 @@ class module_report_download extends module_report
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id); $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']); $params = array(':site_id' => $app['configuration']['main']['key']);
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);

View File

@@ -64,7 +64,7 @@ class module_report_sqlfilter
{ {
$finalfilter = ''; $finalfilter = '';
$params = array(':log_site' => $this->app['phraseanet.configuration']['main']['key']); $params = array(':log_site' => $this->app['configuration']['main']['key']);
if ($this->filter['date']) { if ($this->filter['date']) {
$finalfilter .= $this->filter['date']['sql'] . ' AND '; $finalfilter .= $this->filter['date']['sql'] . ' AND ';
@@ -88,7 +88,7 @@ class module_report_sqlfilter
$params = array(); $params = array();
$sql = 'log.site = :log_site_gv_filter'; $sql = 'log.site = :log_site_gv_filter';
$params[':log_site_gv_filter'] = $this->app['phraseanet.configuration']['main']['key']; $params[':log_site_gv_filter'] = $this->app['configuration']['main']['key'];
return array('sql' => $sql, 'params' => $params); return array('sql' => $sql, 'params' => $params);
} }

View File

@@ -59,7 +59,7 @@ class patch_370alpha9a implements patchInterface
*/ */
public function apply(base $appbox, Application $app) public function apply(base $appbox, Application $app)
{ {
$app['phraseanet.configuration']->setDefault('border-manager'); $app['configuration']->setDefault('border-manager');
return true; return true;
} }

View File

@@ -98,7 +98,7 @@ class patch_373alpha1a implements patchInterface
$stmt->closeCursor(); $stmt->closeCursor();
$config = $app['phraseanet.configuration']->getConfig(); $config = $app['configuration']->getConfig();
$config['binaries'] = $binaries; $config['binaries'] = $binaries;
$sql = 'DELETE FROM registry WHERE `key` = :key'; $sql = 'DELETE FROM registry WHERE `key` = :key';
@@ -118,7 +118,7 @@ class patch_373alpha1a implements patchInterface
$config['main']['key'] = $row['value']; $config['main']['key'] = $row['value'];
$app['phraseanet.configuration']->setConfig($config); $app['configuration']->setConfig($config);
$sql = 'DELETE FROM registry WHERE `key` = :key'; $sql = 'DELETE FROM registry WHERE `key` = :key';
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);

View File

@@ -51,7 +51,7 @@ class patch_380alpha13a implements patchInterface
$xsendfilePath = $app['phraseanet.registry']->get('GV_X_Accel_Redirect'); $xsendfilePath = $app['phraseanet.registry']->get('GV_X_Accel_Redirect');
$xsendfileMountPoint = $app['phraseanet.registry']->get('GV_X_Accel_Redirect_mount_point'); $xsendfileMountPoint = $app['phraseanet.registry']->get('GV_X_Accel_Redirect_mount_point');
$config = $app['phraseanet.configuration'] $config = $app['configuration']
->setDefault('xsendfile') ->setDefault('xsendfile')
->getConfig(); ->getConfig();
@@ -65,7 +65,7 @@ class patch_380alpha13a implements patchInterface
)); ));
} }
$app['phraseanet.configuration']->setConfig($config); $app['configuration']->setConfig($config);
$toRemove = array('GV_X_Accel_Redirect', 'GV_X_Accel_Redirect_mount_point', 'GV_modxsendfile'); $toRemove = array('GV_X_Accel_Redirect', 'GV_X_Accel_Redirect_mount_point', 'GV_modxsendfile');

View File

@@ -48,7 +48,7 @@ class patch_380alpha14a implements patchInterface
*/ */
public function apply(base $appbox, Application $app) public function apply(base $appbox, Application $app)
{ {
$app['phraseanet.configuration']->setDefault('plugins'); $app['configuration']->setDefault('plugins');
return true; return true;
} }

View File

@@ -48,9 +48,9 @@ class patch_380alpha15a implements patchInterface
*/ */
public function apply(base $appbox, Application $app) public function apply(base $appbox, Application $app)
{ {
$binaries = $app['phraseanet.configuration']['binaries']; $binaries = $app['configuration']['binaries'];
unset($binaries['composite_binary'], $binaries['convert_binary']); unset($binaries['composite_binary'], $binaries['convert_binary']);
$app['phraseanet.configuration']['binaries'] = $binaries; $app['configuration']['binaries'] = $binaries;
return true; return true;
} }

View File

@@ -48,7 +48,7 @@ class patch_380alpha16a implements patchInterface
*/ */
public function apply(base $appbox, Application $app) public function apply(base $appbox, Application $app)
{ {
$xsendfile = $app['phraseanet.configuration']['xsendfile']; $xsendfile = $app['configuration']['xsendfile'];
if (!isset($xsendfile['mapping'])) { if (!isset($xsendfile['mapping'])) {
$xsendfile['mapping'] = array(); $xsendfile['mapping'] = array();
@@ -63,7 +63,7 @@ class patch_380alpha16a implements patchInterface
'mount-point' => '/download/', 'mount-point' => '/download/',
); );
$app['phraseanet.configuration']['xsendfile'] = $xsendfile; $app['configuration']['xsendfile'] = $xsendfile;
return true; return true;
} }

View File

@@ -48,7 +48,7 @@ class patch_380alpha17a implements patchInterface
*/ */
public function apply(base $appbox, Application $app) public function apply(base $appbox, Application $app)
{ {
$auth = $app['phraseanet.configuration']['authentication']; $auth = $app['configuration']['authentication'];
if (isset($auth['captcha']) && isset($auth['captcha']['trials-before-failure'])) { if (isset($auth['captcha']) && isset($auth['captcha']['trials-before-failure'])) {
$auth['captcha']['trials-before-display'] = $auth['captcha']['trials-before-failure']; $auth['captcha']['trials-before-display'] = $auth['captcha']['trials-before-failure'];
@@ -59,7 +59,7 @@ class patch_380alpha17a implements patchInterface
unset($auth['auto-create']['enabled']); unset($auth['auto-create']['enabled']);
} }
$app['phraseanet.configuration']['authentication'] = $auth; $app['configuration']['authentication'] = $auth;
return true; return true;
} }

View File

@@ -51,9 +51,9 @@ class patch_380alpha18a implements patchInterface
{ {
$finder = new ExecutableFinder(); $finder = new ExecutableFinder();
$binaries = $app['phraseanet.configuration']['binaries']; $binaries = $app['configuration']['binaries'];
$binaries['recess_binary'] = $finder->find('recess'); $binaries['recess_binary'] = $finder->find('recess');
$app['phraseanet.configuration']['binaries'] = $binaries; $app['configuration']['binaries'] = $binaries;
return true; return true;
} }

View File

@@ -59,12 +59,12 @@ class patch_380alpha2a implements patchInterface
*/ */
public function apply(base $databox, Application $app) public function apply(base $databox, Application $app)
{ {
$config = $app['phraseanet.configuration']->getConfig(); $config = $app['configuration']->getConfig();
if (isset($config['main']['database-test'])) { if (isset($config['main']['database-test'])) {
$config['main']['database-test']['path'] = '/tmp/db.sqlite'; $config['main']['database-test']['path'] = '/tmp/db.sqlite';
} }
$app['phraseanet.configuration']->setConfig($config); $app['configuration']->setConfig($config);
} }
} }

View File

@@ -60,7 +60,7 @@ class patch_380alpha3b implements patchInterface
*/ */
public function apply(base $appbox, Application $app) public function apply(base $appbox, Application $app)
{ {
$app['phraseanet.configuration']->setDefault('main', 'search-engine'); $app['configuration']->setDefault('main', 'search-engine');
return true; return true;
} }

View File

@@ -48,7 +48,7 @@ class patch_380alpha6a implements patchInterface
*/ */
public function apply(base $appbox, Application $app) public function apply(base $appbox, Application $app)
{ {
$app['phraseanet.configuration']->setDefault('registration-fields'); $app['configuration']->setDefault('registration-fields');
$app['phraseanet.configuration']->setDefault('authentication'); $app['configuration']->setDefault('authentication');
} }
} }

View File

@@ -63,9 +63,9 @@ class patch_380alpha8a implements patchInterface
$sxe = simplexml_load_string($row['settings']); $sxe = simplexml_load_string($row['settings']);
$indexer = $sxe->binpath . '/phraseanet_indexer'; $indexer = $sxe->binpath . '/phraseanet_indexer';
$binaries = $app['phraseanet.configuration']['binaries']; $binaries = $app['configuration']['binaries'];
$binaries['phraseanet_indexer'] = $indexer; $binaries['phraseanet_indexer'] = $indexer;
$app['phraseanet.configuration']['binaries'] = $binaries; $app['configuration']['binaries'] = $binaries;
return true; return true;
} }

View File

@@ -1921,7 +1921,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
ORDER BY g.ord ASC, dateadd ASC, record_id ASC'; ORDER BY g.ord ASC, dateadd ASC, record_id ASC';
$params = array( $params = array(
':GV_site' => $this->app['phraseanet.configuration']['main']['key'], ':GV_site' => $this->app['configuration']['main']['key'],
':usr_id' => $this->app['authentication']->getUser()->get_id(), ':usr_id' => $this->app['authentication']->getUser()->get_id(),
':record_id' => $this->get_record_id(), ':record_id' => $this->get_record_id(),
); );
@@ -1972,7 +1972,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
WHERE rid_child = :record_id'; WHERE rid_child = :record_id';
$params = array( $params = array(
':GV_site' => $this->app['phraseanet.configuration']['main']['key'] ':GV_site' => $this->app['configuration']['main']['key']
, ':usr_id' => $this->app['authentication']->getUser()->get_id() , ':usr_id' => $this->app['authentication']->getUser()->get_id()
, ':record_id' => $this->get_record_id() , ':record_id' => $this->get_record_id()
); );

View File

@@ -348,7 +348,7 @@ class record_preview extends record_adapter
if (! $report) { if (! $report) {
$sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")'; $sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")';
$params[':usr_id'] = $this->app['authentication']->getUser()->get_id(); $params[':usr_id'] = $this->app['authentication']->getUser()->get_id();
$params[':site'] = $this->app['phraseanet.configuration']['main']['key']; $params[':site'] = $this->app['configuration']['main']['key'];
} }
$sql .= 'ORDER BY d.date, usrid DESC'; $sql .= 'ORDER BY d.date, usrid DESC';
@@ -453,7 +453,7 @@ class record_preview extends record_adapter
$stmt->execute( $stmt->execute(
array( array(
':record_id' => $this->get_record_id(), ':record_id' => $this->get_record_id(),
':site' => $this->app['phraseanet.configuration']['main']['key'] ':site' => $this->app['configuration']['main']['key']
) )
); );
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -614,7 +614,7 @@ class record_preview extends record_adapter
$stmt->execute( $stmt->execute(
array( array(
':record_id' => $this->get_record_id(), ':record_id' => $this->get_record_id(),
':site' => $this->app['phraseanet.configuration']['main']['key'] ':site' => $this->app['configuration']['main']['key']
) )
); );
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);

View File

@@ -47,10 +47,10 @@ class registry implements registryInterface
$this->cache = new ArrayCache(); $this->cache = new ArrayCache();
if ($app['phraseanet.configuration-tester']->isInstalled()) { if ($app['phraseanet.configuration-tester']->isInstalled()) {
$this->cache->save('GV_ServerName', $app['phraseanet.configuration']['main']['servername']); $this->cache->save('GV_ServerName', $app['configuration']['main']['servername']);
$this->cache->save('GV_debug', $app['debug']); $this->cache->save('GV_debug', $app['debug']);
$config = $app['phraseanet.configuration']->getConfig(); $config = $app['configuration']->getConfig();
if (isset($config['main']['key'])) { if (isset($config['main']['key'])) {
$this->cache->save('GV_sit', $config['main']['key']); $this->cache->save('GV_sit', $config['main']['key']);

View File

@@ -196,7 +196,7 @@ class OverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals($value, $response->headers->get($name)); $this->assertEquals($value, $response->headers->get($name));
} }
$this->assertEquals(rtrim(self::$DI['app']['phraseanet.configuration']['main']['servername'], '/') . "/permalink/v1/1/". self::$DI['record_1']->get_record_id()."/caption/?token=".$token, $response->headers->get("Link")); $this->assertEquals(rtrim(self::$DI['app']['configuration']['main']['servername'], '/') . "/permalink/v1/1/". self::$DI['record_1']->get_record_id()."/caption/?token=".$token, $response->headers->get("Link"));
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
} }
@@ -238,7 +238,7 @@ class OverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals($value, $response->headers->get($name)); $this->assertEquals($value, $response->headers->get($name));
} }
$this->assertEquals(rtrim(self::$DI['app']['phraseanet.configuration']['main']['servername'], '/') . "/permalink/v1/1/". self::$DI['record_1']->get_record_id()."/caption/?token=".$token, $response->headers->get("Link")); $this->assertEquals(rtrim(self::$DI['app']['configuration']['main']['servername'], '/') . "/permalink/v1/1/". self::$DI['record_1']->get_record_id()."/caption/?token=".$token, $response->headers->get("Link"));
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
} }

View File

@@ -291,11 +291,11 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
public function testUrlGeneratorContext() public function testUrlGeneratorContext()
{ {
$app = new Application('test'); $app = new Application('test');
$app['phraseanet.configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface'); $app['configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface');
$app['phraseanet.configuration']->expects($this->once()) $app['configuration']->expects($this->once())
->method('isSetup') ->method('isSetup')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$app['phraseanet.configuration']->expects($this->once()) $app['configuration']->expects($this->once())
->method('offsetGet') ->method('offsetGet')
->with('main') ->with('main')
->will($this->returnValue(array('servername' => 'https://cat.turbocat.com/'))); ->will($this->returnValue(array('servername' => 'https://cat.turbocat.com/')));

View File

@@ -11,8 +11,8 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
$command = new Configuration(); $command = new Configuration();
$command->setContainer(self::$DI['cli']); $command->setContainer(self::$DI['cli']);
self::$DI['cli']['phraseanet.configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface'); self::$DI['cli']['configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface');
self::$DI['cli']['phraseanet.configuration']->expects($this->once()) self::$DI['cli']['configuration']->expects($this->once())
->method('compileAndWrite'); ->method('compileAndWrite');
$input = $this->getMock('Symfony\Component\Console\Input\InputInterface'); $input = $this->getMock('Symfony\Component\Console\Input\InputInterface');

View File

@@ -30,13 +30,13 @@ class XSendFileMappingGeneratorTest extends \PhraseanetPHPUnitAbstract
self::$DI['cli']['monolog'] = self::$DI['cli']->share(function () use ($phpunit) { self::$DI['cli']['monolog'] = self::$DI['cli']->share(function () use ($phpunit) {
return $phpunit->getMockBuilder('Monolog\Logger')->disableOriginalConstructor()->getMock(); return $phpunit->getMockBuilder('Monolog\Logger')->disableOriginalConstructor()->getMock();
}); });
self::$DI['cli']['phraseanet.configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface'); self::$DI['cli']['configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface');
if ($option) { if ($option) {
self::$DI['cli']['phraseanet.configuration']->expects($this->once()) self::$DI['cli']['configuration']->expects($this->once())
->method('offsetSet') ->method('offsetSet')
->with('xsendfile'); ->with('xsendfile');
} else { } else {
self::$DI['cli']['phraseanet.configuration']->expects($this->never()) self::$DI['cli']['configuration']->expects($this->never())
->method('offsetSet'); ->method('offsetSet');
} }
$command->setContainer(self::$DI['cli']); $command->setContainer(self::$DI['cli']);

View File

@@ -9,7 +9,7 @@ class ControllerConnectionTestTest extends \PhraseanetWebTestCaseAbstract
*/ */
public function testRouteMysql() public function testRouteMysql()
{ {
$connexion = self::$DI['app']['phraseanet.configuration']['main']['database']; $connexion = self::$DI['app']['configuration']['main']['database'];
$params = array( $params = array(
"hostname" => $connexion['host'], "hostname" => $connexion['host'],
@@ -26,7 +26,7 @@ class ControllerConnectionTestTest extends \PhraseanetWebTestCaseAbstract
public function testRouteMysqlFailed() public function testRouteMysqlFailed()
{ {
$connexion = self::$DI['app']['phraseanet.configuration']['main']['database']; $connexion = self::$DI['app']['configuration']['main']['database'];
$params = array( $params = array(
"hostname" => $connexion['host'], "hostname" => $connexion['host'],
@@ -52,7 +52,7 @@ class ControllerConnectionTestTest extends \PhraseanetWebTestCaseAbstract
public function testRouteMysqlDbFailed() public function testRouteMysqlDbFailed()
{ {
$connexion = self::$DI['app']['phraseanet.configuration']['main']['database']; $connexion = self::$DI['app']['configuration']['main']['database'];
$params = array( $params = array(
"hostname" => $connexion['host'], "hostname" => $connexion['host'],

View File

@@ -94,7 +94,7 @@ class PluginServiceProvidertest extends ServiceProviderTestCase
} }
$app = self::$DI['cli']; $app = self::$DI['cli'];
$app['phraseanet.configuration'] = array('binaries' => array('php_binary' => null)); $app['configuration'] = array('binaries' => array('php_binary' => null));
$app->register(new PluginServiceProvider()); $app->register(new PluginServiceProvider());
$this->assertInstanceOf('Alchemy\Phrasea\Plugin\Management\ComposerInstaller', $app['plugins.composer-installer']); $this->assertInstanceOf('Alchemy\Phrasea\Plugin\Management\ComposerInstaller', $app['plugins.composer-installer']);
} }
@@ -102,7 +102,7 @@ class PluginServiceProvidertest extends ServiceProviderTestCase
public function testInstallerCanDetectPhpConf() public function testInstallerCanDetectPhpConf()
{ {
$app = self::$DI['cli']; $app = self::$DI['cli'];
$app['phraseanet.configuration'] = array('binaries' => array('php_binary' => null)); $app['configuration'] = array('binaries' => array('php_binary' => null));
$app->register(new PluginServiceProvider()); $app->register(new PluginServiceProvider());
$this->assertInstanceOf('Alchemy\Phrasea\Plugin\Management\ComposerInstaller', $app['plugins.composer-installer']); $this->assertInstanceOf('Alchemy\Phrasea\Plugin\Management\ComposerInstaller', $app['plugins.composer-installer']);
} }

View File

@@ -30,7 +30,7 @@ class DebuggerSubscriberTest extends \PHPUnit_Framework_TestCase
unlink($app['phraseanet.configuration.config-compiled-path']); unlink($app['phraseanet.configuration.config-compiled-path']);
} }
$app['phraseanet.configuration']['debugger'] = array('allowed-ips' => $authorized); $app['configuration']['debugger'] = array('allowed-ips' => $authorized);
$app['dispatcher']->addSubscriber(new DebuggerSubscriber($app)); $app['dispatcher']->addSubscriber(new DebuggerSubscriber($app));
$app->get('/', function () { $app->get('/', function () {
return 'success'; return 'success';

View File

@@ -110,7 +110,7 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetPHPUnitAbstract
$app['phraseanet.registry'] = $this->getMockBuilder('\registry') $app['phraseanet.registry'] = $this->getMockBuilder('\registry')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getmock(); ->getmock();
$app['phraseanet.configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface'); $app['configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface');
$app['dispatcher']->addSubscriber(new PhraseaLocaleSubscriber($app)); $app['dispatcher']->addSubscriber(new PhraseaLocaleSubscriber($app));

View File

@@ -87,9 +87,9 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
$app->register(new AuthenticationManagerServiceProvider()); $app->register(new AuthenticationManagerServiceProvider());
$app->register(new ConfigurationServiceProvider()); $app->register(new ConfigurationServiceProvider());
$app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig(); $app['configuration'] = $conf = $app['configuration']->getConfig();
$conf['authentication']['captcha']['trials-before-display'] = 42; $conf['authentication']['captcha']['trials-before-display'] = 42;
$app['phraseanet.configuration'] = $conf; $app['configuration'] = $conf;
$app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager') $app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager')
->disableOriginalConstructor() ->disableOriginalConstructor()
@@ -107,11 +107,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
$app = new PhraseaApplication(); $app = new PhraseaApplication();
$app->register(new ConfigurationServiceProvider()); $app->register(new ConfigurationServiceProvider());
$conf = $app['phraseanet.configuration']->getConfig(); $conf = $app['configuration']->getConfig();
$conf['authentication']['auto-create'] = array( $conf['authentication']['auto-create'] = array(
'templates' => array(), 'templates' => array(),
); );
$app['phraseanet.configuration']->setConfig($conf); $app['configuration']->setConfig($conf);
$app['authentication.providers.account-creator']; $app['authentication.providers.account-creator'];
} }
@@ -138,11 +138,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
})); }));
$app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox']; $app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox'];
$conf = $app['phraseanet.configuration']->getConfig(); $conf = $app['configuration']->getConfig();
$conf['authentication']['captcha'] = array( $conf['authentication']['captcha'] = array(
'enabled' => true, 'enabled' => true,
); );
$app['phraseanet.configuration']->setConfig($conf); $app['configuration']->setConfig($conf);
$app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager') $app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager')
->disableOriginalConstructor() ->disableOriginalConstructor()
@@ -176,11 +176,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
})); }));
$app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox']; $app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox'];
$conf = $app['phraseanet.configuration']->getConfig(); $conf = $app['configuration']->getConfig();
$conf['authentication']['captcha'] = array( $conf['authentication']['captcha'] = array(
'enabled' => false, 'enabled' => false,
); );
$app['phraseanet.configuration']->setConfig($conf); $app['configuration']->setConfig($conf);
$app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager') $app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager')
->disableOriginalConstructor() ->disableOriginalConstructor()
@@ -202,14 +202,14 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
$template2 = \User_Adapter::create(self::$DI['app'], 'template' . $random->generatePassword(), $random->generatePassword(), null, false); $template2 = \User_Adapter::create(self::$DI['app'], 'template' . $random->generatePassword(), $random->generatePassword(), null, false);
$template2->set_template(self::$DI['user']); $template2->set_template(self::$DI['user']);
$conf = $app['phraseanet.configuration']->getConfig(); $conf = $app['configuration']->getConfig();
$conf['authentication']['auto-create'] = array( $conf['authentication']['auto-create'] = array(
'templates' => array( 'templates' => array(
$template1->get_id(), $template1->get_id(),
$template2->get_login() $template2->get_login()
) )
); );
$app['phraseanet.configuration']->setConfig($conf); $app['configuration']->setConfig($conf);
$this->assertEquals(array($template1, $template2), $app['authentication.providers.account-creator']->getTemplates()); $this->assertEquals(array($template1, $template2), $app['authentication.providers.account-creator']->getTemplates());

View File

@@ -32,7 +32,7 @@ class BorderManagerServiceProvidertest extends ServiceProviderTestCase
) )
)); ));
$app->register(new BorderManagerServiceProvider()); $app->register(new BorderManagerServiceProvider());
$app['phraseanet.configuration'] = array('border-manager' => array('enabled' => false)); $app['configuration'] = array('border-manager' => array('enabled' => false));
$this->assertInstanceOf('Alchemy\Phrasea\Border\Manager', $app['border-manager']); $this->assertInstanceOf('Alchemy\Phrasea\Border\Manager', $app['border-manager']);
$this->assertNull($app['border-manager']->getPdfToText()); $this->assertNull($app['border-manager']->getPdfToText());
@@ -54,7 +54,7 @@ class BorderManagerServiceProvidertest extends ServiceProviderTestCase
) )
)); ));
$app->register(new BorderManagerServiceProvider()); $app->register(new BorderManagerServiceProvider());
$app['phraseanet.configuration'] = array('border-manager' => array('enabled' => false)); $app['configuration'] = array('border-manager' => array('enabled' => false));
$this->assertInstanceOf('Alchemy\Phrasea\Border\Manager', $app['border-manager']); $this->assertInstanceOf('Alchemy\Phrasea\Border\Manager', $app['border-manager']);
$this->assertInstanceOf('XPDF\PdfToText', $app['border-manager']->getPdfToText()); $this->assertInstanceOf('XPDF\PdfToText', $app['border-manager']->getPdfToText());

View File

@@ -15,6 +15,11 @@ class ConfigurationServiceProvidertest extends ServiceProviderTestCase
public function provideServiceDescription() public function provideServiceDescription()
{ {
return array( return array(
array(
'Alchemy\Phrasea\Core\Provider\ConfigurationServiceProvider',
'configuration',
'Alchemy\\Phrasea\\Core\\Configuration\\Configuration'
),
array( array(
'Alchemy\Phrasea\Core\Provider\ConfigurationServiceProvider', 'Alchemy\Phrasea\Core\Provider\ConfigurationServiceProvider',
'phraseanet.configuration', 'phraseanet.configuration',

View File

@@ -22,15 +22,15 @@ class LocaleServiceProvidertest extends \PhraseanetPHPUnitAbstract
{ {
$app = new Application(); $app = new Application();
$app->register(new LocaleServiceProvider()); $app->register(new LocaleServiceProvider());
$app['phraseanet.configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface'); $app['configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface');
$app['phraseanet.configuration']->expects($this->any()) $app['configuration']->expects($this->any())
->method('offsetExist') ->method('offsetExist')
->with('main') ->with('main')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$app['phraseanet.configuration']->expects($this->any()) $app['configuration']->expects($this->any())
->method('isSetup') ->method('isSetup')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$app['phraseanet.configuration']->expects($this->any()) $app['configuration']->expects($this->any())
->method('offsetGet') ->method('offsetGet')
->with('main') ->with('main')
->will($this->returnValue(array('languages' => array('fr_FR', 'en_US', 'de')))); ->will($this->returnValue(array('languages' => array('fr_FR', 'en_US', 'de'))));
@@ -46,15 +46,15 @@ class LocaleServiceProvidertest extends \PhraseanetPHPUnitAbstract
{ {
$app = new Application(); $app = new Application();
$app->register(new LocaleServiceProvider()); $app->register(new LocaleServiceProvider());
$app['phraseanet.configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface'); $app['configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface');
$app['phraseanet.configuration']->expects($this->any()) $app['configuration']->expects($this->any())
->method('offsetExist') ->method('offsetExist')
->with('main') ->with('main')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$app['phraseanet.configuration']->expects($this->any()) $app['configuration']->expects($this->any())
->method('isSetup') ->method('isSetup')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$app['phraseanet.configuration']->expects($this->any()) $app['configuration']->expects($this->any())
->method('offsetGet') ->method('offsetGet')
->with('main') ->with('main')
->will($this->returnValue(array('languages' => array('en_US')))); ->will($this->returnValue(array('languages' => array('en_US'))));

View File

@@ -13,9 +13,9 @@ class RegistrationServiceProvidertest extends \PhraseanetPHPUnitAbstract
{ {
self::$DI['app']->register(new RegistrationServiceProvider()); self::$DI['app']->register(new RegistrationServiceProvider());
$conf = self::$DI['app']['phraseanet.configuration']->getConfig(); $conf = self::$DI['app']['configuration']->getConfig();
$conf['registration-fields'] = array('plop'); $conf['registration-fields'] = array('plop');
self::$DI['app']['phraseanet.configuration'] = $conf; self::$DI['app']['configuration'] = $conf;
$this->assertEquals(array('plop'), self::$DI['app']['registration.fields']); $this->assertEquals(array('plop'), self::$DI['app']['registration.fields']);
$this->assertEquals(array('plop'), self::$DI['app']['registration.fields']); $this->assertEquals(array('plop'), self::$DI['app']['registration.fields']);

View File

@@ -18,6 +18,6 @@ class PhraseaConfigurationPanelTest extends ConfigurationPanelAbstractTest
public function getPanel() public function getPanel()
{ {
return new ConfigurationPanel(new PhraseaEngine(self::$DI['app']), self::$DI['app']['phraseanet.configuration']); return new ConfigurationPanel(new PhraseaEngine(self::$DI['app']), self::$DI['app']['configuration']);
} }
} }

View File

@@ -18,7 +18,7 @@ class SphinxSearchConfigurationPanelTest extends ConfigurationPanelAbstractTest
public function getPanel() public function getPanel()
{ {
return new ConfigurationPanel(new SphinxSearchEngine(self::$DI['app'], 'localhost', 9306, 'localhost', 9308), self::$DI['app']['phraseanet.configuration']); return new ConfigurationPanel(new SphinxSearchEngine(self::$DI['app'], 'localhost', 9306, 'localhost', 9308), self::$DI['app']['configuration']);
} }
public function testGetAVailableCharsets() public function testGetAVailableCharsets()

View File

@@ -35,16 +35,16 @@ class SphinxSearchEngineTest extends SearchEngineAbstractTest
$app = new Application('test'); $app = new Application('test');
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
$configuration = $app['phraseanet.configuration']->getConfig(); $configuration = $app['configuration']->getConfig();
$configuration['main']['search-engine']['options'] = array( $configuration['main']['search-engine']['options'] = array(
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 9312, 'port' => 9312,
'rt_host' => '127.0.0.1', 'rt_host' => '127.0.0.1',
'rt_port' => 9306, 'rt_port' => 9306,
); );
$app['phraseanet.configuration']->setConfig($configuration); $app['configuration']->setConfig($configuration);
self::$searchEngine = SphinxSearchEngine::create($app, $app['phraseanet.configuration']['main']['search-engine']['options']); self::$searchEngine = SphinxSearchEngine::create($app, $app['configuration']['main']['search-engine']['options']);
self::$config = tempnam(sys_get_temp_dir(), 'tmp_sphinx.conf'); self::$config = tempnam(sys_get_temp_dir(), 'tmp_sphinx.conf');
$configuration = self::$searchEngine->getConfigurationPanel()->getConfiguration(); $configuration = self::$searchEngine->getConfigurationPanel()->getConfiguration();
@@ -73,7 +73,7 @@ class SphinxSearchEngineTest extends SearchEngineAbstractTest
self::$searchd = new Process($searchd . ' -c ' . self::$config); self::$searchd = new Process($searchd . ' -c ' . self::$config);
self::$searchd->run(); self::$searchd->run();
self::$searchEngine = SphinxSearchEngine::create($app, $app['phraseanet.configuration']['main']['search-engine']['options']); self::$searchEngine = SphinxSearchEngine::create($app, $app['configuration']['main']['search-engine']['options']);
} }
public function setUp() public function setUp()

View File

@@ -51,7 +51,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase
@unlink($config); @unlink($config);
@unlink($compiled); @unlink($compiled);
$app['phraseanet.configuration'] = new Configuration(new Yaml(), new Compiler(), $config, $compiled, true); $app['configuration'] = new Configuration(new Yaml(), new Compiler(), $config, $compiled, true);
$abConn = new \connection_pdo('abConn', 'localhost', 3306, $credentials['user'], $credentials['password'], 'ab_unitTests'); $abConn = new \connection_pdo('abConn', 'localhost', 3306, $credentials['user'], $credentials['password'], 'ab_unitTests');
$dbConn = new \connection_pdo('dbConn', 'localhost', 3306, $credentials['user'], $credentials['password'], 'db_unitTests'); $dbConn = new \connection_pdo('dbConn', 'localhost', 3306, $credentials['user'], $credentials['password'], 'db_unitTests');
@@ -64,14 +64,14 @@ class InstallerTest extends \PHPUnit_Framework_TestCase
\User_Adapter::unsetInstances(); \User_Adapter::unsetInstances();
$this->assertTrue($app['phraseanet.configuration']->isSetup()); $this->assertTrue($app['configuration']->isSetup());
$this->assertTrue($app['phraseanet.configuration-tester']->isUpToDate()); $this->assertTrue($app['phraseanet.configuration-tester']->isUpToDate());
$databoxes = $app['phraseanet.appbox']->get_databoxes(); $databoxes = $app['phraseanet.appbox']->get_databoxes();
$databox = array_pop($databoxes); $databox = array_pop($databoxes);
$this->assertContains('<path>'.realpath($dataPath).'/db_unitTests/subdefs</path>', $databox->get_structure()); $this->assertContains('<path>'.realpath($dataPath).'/db_unitTests/subdefs</path>', $databox->get_structure());
$conf = $app['phraseanet.configuration']->getConfig(); $conf = $app['configuration']->getConfig();
$this->assertArrayHasKey('main', $conf); $this->assertArrayHasKey('main', $conf);
$this->assertArrayHasKey('key', $conf['main']); $this->assertArrayHasKey('key', $conf['main']);
$this->assertGreaterThan(10, strlen($conf['main']['key'])); $this->assertGreaterThan(10, strlen($conf['main']['key']));

View File

@@ -62,7 +62,7 @@ class Migration35Test extends AbstractSetupTester
$app = $app ? : new Application('test'); $app = $app ? : new Application('test');
if ($this->specifications) { if ($this->specifications) {
$app['phraseanet.configuration'] = $this->specifications; $app['configuration'] = $this->specifications;
} }
return new Migration35($app); return new Migration35($app);

View File

@@ -30,17 +30,17 @@ class Migration38Test extends AbstractSetupTester
public function testMigrate() public function testMigrate()
{ {
$app = new Application(); $app = new Application();
$app['phraseanet.configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface'); $app['configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface');
$app['root.path'] = __DIR__ . '/../Probe/fixtures-3807'; $app['root.path'] = __DIR__ . '/../Probe/fixtures-3807';
$app['phraseanet.configuration']->expects($this->once()) $app['configuration']->expects($this->once())
->method('initialize'); ->method('initialize');
$app['phraseanet.configuration']->expects($this->once()) $app['configuration']->expects($this->once())
->method('getConfig') ->method('getConfig')
->will($this->returnValue($this->getCurrent())); ->will($this->returnValue($this->getCurrent()));
$app['phraseanet.configuration']->expects($this->once()) $app['configuration']->expects($this->once())
->method('setConfig') ->method('setConfig')
->with($this->getModified()); ->with($this->getModified());

View File

@@ -43,7 +43,7 @@ abstract class EditorTestCase extends \PhraseanetPHPUnitAbstract
$editor = $this->getEditor(); $editor = $this->getEditor();
$dom = new \DOMDocument(); $dom = new \DOMDocument();
$dom->strictErrorChecking = true; $dom->strictErrorChecking = true;
$this->assertTrue(false !== $dom->loadXML($editor->getDefaultSettings(self::$DI['app']['phraseanet.configuration']))); $this->assertTrue(false !== $dom->loadXML($editor->getDefaultSettings(self::$DI['app']['configuration'])));
} }
public function testGetDefaultSettingsWithoutConfiguration() public function testGetDefaultSettingsWithoutConfiguration()

View File

@@ -142,7 +142,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
}); });
$app['url_generator'] = $app->share($app->extend('url_generator', function ($generator, $app) { $app['url_generator'] = $app->share($app->extend('url_generator', function ($generator, $app) {
$host = parse_url($app['phraseanet.configuration']['main']['servername'], PHP_URL_HOST); $host = parse_url($app['configuration']['main']['servername'], PHP_URL_HOST);
$generator->setContext(new RequestContext('', 'GET', $host)); $generator->setContext(new RequestContext('', 'GET', $host));
return $generator; return $generator;
@@ -183,7 +183,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
}); });
$app['url_generator'] = $app->share($app->extend('url_generator', function ($generator, $app) { $app['url_generator'] = $app->share($app->extend('url_generator', function ($generator, $app) {
$host = parse_url($app['phraseanet.configuration']['main']['servername'], PHP_URL_HOST); $host = parse_url($app['configuration']['main']['servername'], PHP_URL_HOST);
$generator->setContext(new RequestContext('', 'GET', $host)); $generator->setContext(new RequestContext('', 'GET', $host));
return $generator; return $generator;

View File

@@ -98,7 +98,7 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
{ {
$this->createDatabase(); $this->createDatabase();
$connexion = self::$DI['app']['phraseanet.configuration']['main']['database']; $connexion = self::$DI['app']['configuration']['main']['database'];
try { try {
$conn = new \connection_pdo( $conn = new \connection_pdo(

View File

@@ -40,7 +40,7 @@ class Session_LoggerTest extends PhraseanetPHPUnitAbstract
$params = array( $params = array(
':ses_id' => self::$DI['app']['session']->get('session_id') ':ses_id' => self::$DI['app']['session']->get('session_id')
, ':usr_id' => self::$DI['app']['authentication']->getUser()->get_id() , ':usr_id' => self::$DI['app']['authentication']->getUser()->get_id()
, ':site' => self::$DI['app']['phraseanet.configuration']['main']['key'] , ':site' => self::$DI['app']['configuration']['main']['key']
); );
$stmt = $this->databox->get_connection()->prepare($sql); $stmt = $this->databox->get_connection()->prepare($sql);
@@ -59,7 +59,7 @@ class Session_LoggerTest extends PhraseanetPHPUnitAbstract
$params = array( $params = array(
':ses_id' => $ses_id ':ses_id' => $ses_id
, ':usr_id' => $usr_id , ':usr_id' => $usr_id
, ':site' => self::$DI['app']['phraseanet.configuration']['main']['key'] , ':site' => self::$DI['app']['configuration']['main']['key']
); );
$stmt = $this->databox->get_connection()->prepare($sql); $stmt = $this->databox->get_connection()->prepare($sql);

View File

@@ -17,9 +17,9 @@ class API_V1_resultTest extends PhraseanetPHPUnitAuthenticatedAbstract
self::$DI['app']->register(new \API_V1_Timer()); self::$DI['app']->register(new \API_V1_Timer());
$conf = self::$DI['app']['phraseanet.configuration']->getConfig(); $conf = self::$DI['app']['configuration']->getConfig();
$conf['main']['api-timers'] = true; $conf['main']['api-timers'] = true;
self::$DI['app']['phraseanet.configuration']->setConfig($conf); self::$DI['app']['configuration']->setConfig($conf);
$this->api = $this->getMock("API_V1_adapter", array("get_version"), array(), "", false); $this->api = $this->getMock("API_V1_adapter", array("get_version"), array(), "", false);
$this->api->expects($this->any())->method("get_version")->will($this->returnValue("my_super_version1.0")); $this->api->expects($this->any())->method("get_version")->will($this->returnValue("my_super_version1.0"));

View File

@@ -15,8 +15,8 @@ class patch_380alpha3bTest extends PhraseanetPHPUnitAbstract
$app = self::$DI['app']; $app = self::$DI['app'];
$app['phraseanet.configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface'); $app['configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface');
$app['phraseanet.configuration']->expects($this->once()) $app['configuration']->expects($this->once())
->method('setDefault') ->method('setDefault')
->with('main', 'search-engine'); ->with('main', 'search-engine');

View File

@@ -60,9 +60,9 @@ class userTest extends PhraseanetPHPUnitAbstract
public function testGetPrefWithACustomizedConf() public function testGetPrefWithACustomizedConf()
{ {
$data = isset(self::$DI['app']['phraseanet.configuration']['user-settings']) ? self::$DI['app']['phraseanet.configuration']['user-settings'] : null; $data = isset(self::$DI['app']['configuration']['user-settings']) ? self::$DI['app']['configuration']['user-settings'] : null;
self::$DI['app']['phraseanet.configuration']['user-settings'] = array( self::$DI['app']['configuration']['user-settings'] = array(
'images_per_page' => 42, 'images_per_page' => 42,
'images_size' => 666, 'images_size' => 666,
'lalala' => 'didou', 'lalala' => 'didou',
@@ -76,9 +76,9 @@ class userTest extends PhraseanetPHPUnitAbstract
$this->assertSame(\User_Adapter::$def_values['editing_top_box'], $user->getPrefs('editing_top_box')); $this->assertSame(\User_Adapter::$def_values['editing_top_box'], $user->getPrefs('editing_top_box'));
if (null === $data) { if (null === $data) {
unset(self::$DI['app']['phraseanet.configuration']['user-settings']); unset(self::$DI['app']['configuration']['user-settings']);
} else { } else {
self::$DI['app']['phraseanet.configuration']['user-settings'] = $data; self::$DI['app']['configuration']['user-settings'] = $data;
} }
} }