mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 08:44:11 +02:00
CoreApi: add getActiveChecksum helper method
This commit is contained in:
parent
9ae6f5539a
commit
dc7f9ac039
@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Core;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
|
use Icinga\Module\Director\Db;
|
||||||
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
||||||
use Icinga\Module\Director\Objects\IcingaObject;
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
use Icinga\Module\Director\Objects\IcingaCommand;
|
use Icinga\Module\Director\Objects\IcingaCommand;
|
||||||
@ -21,7 +22,7 @@ class CoreApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Todo: type
|
// Todo: type
|
||||||
public function setDb($db)
|
public function setDb(Db $db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
return $this;
|
return $this;
|
||||||
@ -277,6 +278,22 @@ constants
|
|||||||
return current($this->listModuleStages('director', true));
|
return current($this->listModuleStages('director', true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getActiveChecksum(Db $conn)
|
||||||
|
{
|
||||||
|
$db = $conn->getConnection();
|
||||||
|
$stage = $this->getActiveStageName();
|
||||||
|
if (! $stage) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $db->select()->from(
|
||||||
|
array('l' => 'director_deployment_log'),
|
||||||
|
array('checksum' => $conn->dbHexFunc('l.config_checksum'))
|
||||||
|
)->where('l.stage_name = ?', $stage);
|
||||||
|
|
||||||
|
return $db->fetchOne($query);
|
||||||
|
}
|
||||||
|
|
||||||
protected function getDirectorObjects($type, $single, $plural, $map)
|
protected function getDirectorObjects($type, $single, $plural, $map)
|
||||||
{
|
{
|
||||||
$attrs = array_merge(
|
$attrs = array_merge(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user