mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 17:24:18 +02:00
Db: allow to fetch object-based undeployed changes
This commit is contained in:
parent
0e99120c75
commit
3503fce64f
@ -5,6 +5,7 @@ namespace Icinga\Module\Director;
|
|||||||
use Icinga\Data\Db\DbConnection;
|
use Icinga\Data\Db\DbConnection;
|
||||||
use Icinga\Module\Director\Objects\DirectorDeploymentLog;
|
use Icinga\Module\Director\Objects\DirectorDeploymentLog;
|
||||||
use Icinga\Module\Director\Objects\IcingaEndpoint;
|
use Icinga\Module\Director\Objects\IcingaEndpoint;
|
||||||
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
use Icinga\Exception\ConfigurationError;
|
use Icinga\Exception\ConfigurationError;
|
||||||
use Zend_Db_Expr;
|
use Zend_Db_Expr;
|
||||||
use Zend_Db_Select;
|
use Zend_Db_Select;
|
||||||
@ -24,8 +25,10 @@ class Db extends DbConnection
|
|||||||
return $this->getDbAdapter();
|
return $this->getDbAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function countActivitiesSinceLastDeployedConfig()
|
public function countActivitiesSinceLastDeployedConfig(IcingaObject $object = null)
|
||||||
{
|
{
|
||||||
|
$db = $this->db();
|
||||||
|
|
||||||
$query = 'SELECT COUNT(*) FROM director_activity_log WHERE id > ('
|
$query = 'SELECT COUNT(*) FROM director_activity_log WHERE id > ('
|
||||||
. ' SELECT id FROM director_activity_log WHERE checksum = ('
|
. ' SELECT id FROM director_activity_log WHERE checksum = ('
|
||||||
. ' SELECT last_activity_checksum FROM director_generated_config WHERE checksum = ('
|
. ' SELECT last_activity_checksum FROM director_generated_config WHERE checksum = ('
|
||||||
@ -34,7 +37,11 @@ class Db extends DbConnection
|
|||||||
. ' )'
|
. ' )'
|
||||||
. ')';
|
. ')';
|
||||||
|
|
||||||
return (int) $this->db()->fetchOne($query);
|
if ($object !== null) {
|
||||||
|
$query .= $db->quoteInto(' AND object_type = ?', $object->getTableName());
|
||||||
|
$query .= $db->quoteInto(' AND object_name = ?', $object->object_name);
|
||||||
|
}
|
||||||
|
return (int) $db->fetchOne($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMasterZoneName()
|
public function getMasterZoneName()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user