mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-25 23:04:53 +02:00
JobHook: provide a new hook for hookable jobs
This commit is contained in:
parent
9c283e8bb6
commit
cf1093ef54
27
library/Director/Hook/JobHook.php
Normal file
27
library/Director/Hook/JobHook.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Hook;
|
||||
|
||||
abstract class JobHook
|
||||
{
|
||||
protected $settings = array();
|
||||
|
||||
public function getName()
|
||||
{
|
||||
$parts = explode('\\', get_class($this));
|
||||
$class = preg_replace('/Job$/', '', array_pop($parts));
|
||||
|
||||
if (array_shift($parts) === 'Icinga' && array_shift($parts) === 'Module') {
|
||||
$module = array_shift($parts);
|
||||
if ($module !== 'Director') {
|
||||
return sprintf('%s (%s)', $class, $module);
|
||||
}
|
||||
}
|
||||
|
||||
return $class;
|
||||
}
|
||||
|
||||
abstract public run();
|
||||
|
||||
abstract public function isPending();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user