From cd989f9c3aff968e19a3aeabc4eb9085787a6673 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:43:12 +0200 Subject: Adding upstream version 1.10.2. Signed-off-by: Daniel Baumann --- library/Director/Objects/SyncRun.php | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 library/Director/Objects/SyncRun.php (limited to 'library/Director/Objects/SyncRun.php') diff --git a/library/Director/Objects/SyncRun.php b/library/Director/Objects/SyncRun.php new file mode 100644 index 0000000..62f7378 --- /dev/null +++ b/library/Director/Objects/SyncRun.php @@ -0,0 +1,46 @@ + null, + 'rule_id' => null, + 'rule_name' => null, + 'start_time' => null, + 'duration_ms' => null, + 'objects_created' => null, + 'objects_deleted' => null, + 'objects_modified' => null, + 'last_former_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() + ); + } + + public function countActivities() + { + return (int) $this->get('objects_deleted') + + (int) $this->get('objects_created') + + (int) $this->get('objects_modified'); + } +} -- cgit v1.2.3