ConfigJob: replace housekeeping-related code

This commit is contained in:
Thomas Gelf 2016-05-17 16:05:00 +02:00
parent deea18f8df
commit c65c8a72c7
1 changed files with 21 additions and 15 deletions

View File

@ -10,35 +10,41 @@ use Icinga\Module\Director\Util;
class ConfigJob extends JobHook
{
protected $housekeeping;
public function run()
{
$this->housekeeping()->runAllTasks();
}
public static function addSettingsFormFields(QuickForm $form)
{
$form->addElement('select', 'deploy_when_changed', array(
'label' => $form->translate('Deploy modified config'),
'description' => $form->translate(
'This allows you to immediately deploy a modified configuration'
),
'value' => 'n',
'multiOptions' => array(
'y' => $form->translate('Yes'),
'n' => $form->translate('No'),
)
));
return $form;
}
public function isPending()
{
return $this->housekeeping()->hasPendingTasks();
return false;
}
public static function getDescription(QuickForm $form)
{
return $form->translate(
'The Housekeeping job provides various task that keep your Director'
. ' database fast and clean'
'The Config job allows you to generate and eventually deploy your'
. 'Icinga 2 configuration'
);
}
protected function housekeeping()
{
if ($this->housekeeping === null) {
$this->housekeeping = new Housekeeping($this->db());
}
return $this->housekeeping;
}
/**
* Re-render the current configuration
*/