Use configuration property accessor

This commit is contained in:
Romain Neutron
2013-11-18 18:45:25 +01:00
parent 94be7c5498
commit 7e0a3c7338
87 changed files with 209 additions and 265 deletions

View File

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

View File

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

View File

@@ -59,9 +59,7 @@ class patch_380alpha13a implements patchInterface
$xsendfilePath = $app['phraseanet.registry']->get('GV_X_Accel_Redirect');
$xsendfileMountPoint = $app['phraseanet.registry']->get('GV_X_Accel_Redirect_mount_point');
$config = $app['configuration']
->setDefault('xsendfile')
->getConfig();
$config = $app['configuration.store']->setDefault('xsendfile')->getConfig();
$config['xsendfile']['enabled'] = (Boolean) $app['phraseanet.registry']->get('GV_modxsendfile', false);
$config['xsendfile']['type'] = $config['xsendfile']['enabled'] ? 'nginx' : '';
@@ -73,7 +71,7 @@ class patch_380alpha13a implements patchInterface
]];
}
$app['configuration']->setConfig($config);
$app['configuration.store']->setConfig($config);
$toRemove = ['GV_X_Accel_Redirect', 'GV_X_Accel_Redirect_mount_point', 'GV_modxsendfile'];

View File

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

View File

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

View File

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

View File

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

View File

@@ -57,11 +57,7 @@ class patch_380alpha18a implements patchInterface
*/
public function apply(base $appbox, Application $app)
{
$finder = new ExecutableFinder();
$binaries = $app['configuration']['binaries'];
$binaries['recess_binary'] = $finder->find('recess');
$app['configuration']['binaries'] = $binaries;
$app['conf']->set(['binaries', 'recess_binary'], (new ExecutableFinder())->find('recess'));
return true;
}

View File

@@ -11,6 +11,11 @@
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_380alpha2a implements patchInterface
{
/** @var string */
@@ -56,14 +61,8 @@ class patch_380alpha2a implements patchInterface
*/
public function apply(base $databox, Application $app)
{
$config = $app['configuration']->getConfig();
if (isset($config['main']['database-test'])) {
$config['main']['database-test']['path'] = '/tmp/db.sqlite';
if ($app['conf']->has(['main', 'database-test'])) {
$app['conf']->set(['main', 'database-test', 'path'], '/tmp/db.sqlite');
}
$app['configuration']->setConfig($config);
return true;
}
}
}

View File

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

View File

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

View File

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