HousekeepingJob: provide first simple job

This commit is contained in:
Thomas Gelf 2016-04-21 13:27:39 +02:00
parent 36fa4f48a0
commit d292def6e7
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,30 @@
<?php
namespace Icinga\Module\Director\Job;
use Icinga\Module\Director\Db\Housekeeping;
use Icinga\Module\Director\Hook\JobHook;
class HousekeepingJob extends JobHook
{
protected $housekeeping;
public function run()
{
$this->housekeeping()->runAllTasks();
}
public function isPending()
{
return $this->housekeeping()->hasPendingTasks();
}
protected function housekeeping()
{
if ($this->housekeeping === null) {
$this->housekeeping = new Housekeeping($this->db());
}
return $this->housekeeping;
}
}

View File

@ -32,6 +32,8 @@ $this->provideHook('director/PropertyModifier', $prefix . 'PropertyModifier\\Pro
$this->provideHook('director/PropertyModifier', $prefix . 'PropertyModifier\\PropertyModifierFromAdSid');
$this->provideHook('director/PropertyModifier', $prefix . 'PropertyModifier\\PropertyModifierFromLatin1');
$this->provideHook('director/Job', $prefix . 'Job\\HousekeepingJob');
if (Icinga::app()->isCli()) {
return;
}