Use configurtion file instead of GV

This commit is contained in:
Nicolas Le Goff
2014-07-28 11:59:21 +02:00
parent 76cb4fad28
commit c752141ff2
10 changed files with 11 additions and 22 deletions

View File

@@ -28,6 +28,7 @@ main:
type: Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngine
options: []
task-manager:
enabled: true
logger:
max-files: 10
enabled: true

View File

@@ -73,7 +73,7 @@ class TaskManager implements ControllerProviderInterface
*/
$controllers->get('/scheduler/stop', function (Application $app, Request $request) use ($app) {
if ($app['phraseanet.registry"].get("GV_disable_task_manager']) {
if (false === $app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
@@ -347,7 +347,7 @@ class TaskManager implements ControllerProviderInterface
public function startScheduler(Application $app, Request $request)
{
if ($app['phraseanet.registry"].get("GV_disable_task_manager']) {
if (false === $app['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}

View File

@@ -107,7 +107,7 @@ class API_V1_adapter extends API_V1_Abstract
{
$result = new \API_V1_result($app, $app['request'], $this);
if ($app['phraseanet.registry"].get("GV_disable_task_manager']) {
if (false === $app['phraseanet.configuration']['main']['task-manager']['enabled']) {
$ret = array('state' => 'disabled');
} else {
$taskManager = $app['task-manager'];

View File

@@ -37,7 +37,7 @@ class module_console_schedulerStart extends Command
protected function doExecute(InputInterface $input, OutputInterface $output)
{
if ($this->container['phraseanet.registry"].get("GV_disable_task_manager']) {
if (false === $this->container['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}
$logger = $this->container['task-manager.logger'];

View File

@@ -56,7 +56,7 @@ class module_console_schedulerState extends Command
return self::EXITCODE_SETUP_ERROR;
}
if ($this->container['phraseanet.registry"].get("GV_disable_task_manager']) {
if (false === $this->container['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}

View File

@@ -34,7 +34,7 @@ class module_console_schedulerStop extends Command
protected function doExecute(InputInterface $input, OutputInterface $output)
{
if ($this->container['phraseanet.registry"].get("GV_disable_task_manager']) {
if (false === $this->container['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}

View File

@@ -73,7 +73,7 @@ class module_console_taskrun extends Command
return self::EXITCODE_SETUP_ERROR;
}
if ($this->container['phraseanet.registry"].get("GV_disable_task_manager']) {
if (false === $this->container['phraseanet.configuration']['main']['task-manager']['enabled']) {
throw new RuntimeException('The use of the task manager is disabled on this instance.');
}

View File

@@ -341,19 +341,6 @@ return call_user_func_array(function(Application $app) {
'required' => true
)
)
), array(
'section' => _('Task manager'),
'rolled' => true,
'vars' => array(
array(
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_disable_task_manager',
'comment' => _('Disable task manager'),
'help' => '',
'default' => false,
'required' => true
)
)
), array(
'section' => _('Search engine'),
'rolled' => true,

View File

@@ -28,6 +28,7 @@ main:
type: Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngine
options: []
task-manager:
enabled: true
logger:
max-files: 10
enabled: true

View File

@@ -33,7 +33,7 @@
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
{% if not app["phraseanet.registry"].get("GV_disable_task_manager") %}
{% if app['phraseanet.configuration']['main']['task-manager']['enabled'] %}
<li class="schedMenuItem" id="schedulerStart"><a href="#">start</a></li>
<li class="schedMenuItem" id="schedulerStop"><a href="#">stop</a></li>
{% endif %}
@@ -57,7 +57,7 @@
</a>
<ul class="dropdown-menu">
<li class="taskMenuItem" id="taskEdit_{{ task.getID() }}"><a href="#">{% trans 'Edit' %}</a></li>
{% if not app["phraseanet.registry"].get("GV_disable_task_manager") %}
{% if app['phraseanet.configuration']['main']['task-manager']['enabled'] %}
<li class="taskMenuItem" id="taskStart_{{ task.getID() }}"><a href="#">{% trans 'Start' %}</a></li>
<li class="taskMenuItem" id="taskStop_{{ task.getID() }}"><a href="#">{% trans 'Stop' %}</a></li>
{% endif %}