[icinga-checkins] icinga.org: icingaweb2-module-director/master: SyncRun: new object to track sync history

git at icinga.org git at icinga.org
Wed Feb 24 11:09:30 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: a993f5cafa84c57526aab23b73372da3298a4cbb
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=a993f5cafa84c57526aab23b73372da3298a4cbb

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Feb 24 11:09:12 2016 +0100

SyncRun: new object to track sync history

---

 library/Director/Objects/SyncRun.php |   41 ++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/library/Director/Objects/SyncRun.php b/library/Director/Objects/SyncRun.php
new file mode 100644
index 0000000..a34cb79
--- /dev/null
+++ b/library/Director/Objects/SyncRun.php
@@ -0,0 +1,41 @@
+<?php
+
+namespace Icinga\Module\Director\Objects;
+
+use Icinga\Data\Filter\Filter;
+use Icinga\Module\Director\Data\Db\DbObject;
+use Icinga\Module\Director\Db;
+
+class SyncRun extends DbObject
+{
+    protected $table = 'sync_run';
+
+    protected $keyName = 'id';
+
+    protected $autoincKeyName = 'id';
+
+    protected $defaultProperties = array(
+        'id'                     => null,
+        'rule_id'                => null,
+        'rule_name'              => null,
+        'start_time'             => null,
+        'duration_ms'            => null,
+        'objects_created'        => null,
+        'objects_deleted'        => null,
+        'objects_modified'       => null,
+        'first_related_activity' => null,
+        'last_related_activity'  => null,
+    );
+
+    public static function start(SyncRule $rule)
+    {
+        return static::create(
+            array(
+                'start_time' => date('Y-m-d H:i:s'),
+                'rule_id'    => $rule->id,
+                'rule_name'  => $rule->rule_name,
+            ),
+            $rule->getConnection()
+        );
+    }
+}



More information about the icinga-checkins mailing list