mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
SyncRule: add various helper methods
This commit is contained in:
parent
7bb55fadbd
commit
516c519af9
@ -50,6 +50,40 @@ class SyncRule extends DbObject
|
||||
));
|
||||
}
|
||||
|
||||
public function getLastSyncTimestamp()
|
||||
{
|
||||
if (! $this->hasBeenLoadedFromDb()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$db = $this->getDb();
|
||||
$query = $db->select()->from(
|
||||
array('sr' => 'sync_run'),
|
||||
'sr.start_time'
|
||||
)->where('sr.rule_id = ?', $this->id)
|
||||
->order('sr.start_time DESC')
|
||||
->limit(1);
|
||||
|
||||
return $db->fetchOne($query);
|
||||
}
|
||||
|
||||
public function getLastSyncRunId()
|
||||
{
|
||||
if (! $this->hasBeenLoadedFromDb()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$db = $this->getDb();
|
||||
$query = $db->select()->from(
|
||||
array('sr' => 'sync_run'),
|
||||
'sr.id'
|
||||
)->where('sr.rule_id = ?', $this->id)
|
||||
->order('sr.start_time DESC')
|
||||
->limit(1);
|
||||
|
||||
return $db->fetchOne($query);
|
||||
}
|
||||
|
||||
public function getPriorityForNextProperty()
|
||||
{
|
||||
if (! $this->hasBeenLoadedFromDb()) {
|
||||
@ -115,6 +149,11 @@ class SyncRule extends DbObject
|
||||
return $this->checkForChanges(true);
|
||||
}
|
||||
|
||||
public function getCurrentSyncRunId()
|
||||
{
|
||||
return $this->currentSyncRunId;
|
||||
}
|
||||
|
||||
protected function sync()
|
||||
{
|
||||
if ($this->sync === null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user