HousekeepingJob: provide first simple job
This commit is contained in:
parent
36fa4f48a0
commit
d292def6e7
|
@ -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;
|
||||
}
|
||||
}
|
2
run.php
2
run.php
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue