Files
Phraseanet/lib/Alchemy/Phrasea/TaskManager/Editor/PhraseanetIndexerEditor.php
2014-02-22 10:39:07 +01:00

95 lines
2.5 KiB
PHP

<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\TaskManager\Editor;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
class PhraseanetIndexerEditor extends AbstractEditor
{
/**
* {@inheritdoc}
*/
public function getTemplatePath()
{
return 'admin/task-manager/task-editor/phraseanet-indexer.html.twig';
}
/**
* {@inheritdoc}
*/
public function getDefaultPeriod()
{
// Phraseanet Indexer actually never restart.
return 5;
}
/**
* {@inheritdoc}
*/
public function getDefaultSettings(PropertyAccess $config = null)
{
if (null !== $config) {
return '<?xml version="1.0" encoding="UTF-8"?>
<tasksettings>
<host>'.$config->get(['main', 'database', 'host']).'</host>
<port>'.$config->get(['main', 'database', 'port']).'</port>
<base>'.$config->get(['main', 'database', 'dbname']).'</base>
<user>'.$config->get(['main', 'database', 'user']).'</user>
<password>'.$config->get(['main', 'database', 'password']).'</password>
<socket>25200</socket>
<nolog>0</nolog>
<clng></clng>
<winsvc_run>0</winsvc_run>
<charset>utf8</charset>
</tasksettings>';
}
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<tasksettings>
<host></host>
<port></port>
<base></base>
<user></user>
<password></password>
<socket>25200</socket>
<nolog>0</nolog>
<clng></clng>
<winsvc_run>0</winsvc_run>
<charset>utf8</charset>
</tasksettings>
EOF;
}
/**
* {@inheritdoc}
*/
protected function getFormProperties()
{
return [
'host' => static::FORM_TYPE_STRING,
'port' => static::FORM_TYPE_INTEGER,
'base' => static::FORM_TYPE_STRING,
'user' => static::FORM_TYPE_STRING,
'password' => static::FORM_TYPE_STRING,
'socket' => static::FORM_TYPE_INTEGER,
'nolog' => static::FORM_TYPE_BOOLEAN,
'clng' => static::FORM_TYPE_STRING,
'winsvc_run' => static::FORM_TYPE_BOOLEAN,
'charset' => static::FORM_TYPE_STRING,
'debugmask' => static::FORM_TYPE_INTEGER,
'stem' => static::FORM_TYPE_STRING,
'sortempty' => static::FORM_TYPE_STRING,
];
}
}