From b5b901080c2a04d2ed790c9a1a551ee062d81e3b Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 11 Jun 2024 14:41:16 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- src/app/RunFile.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/app/RunFile.php b/src/app/RunFile.php index 531a7ec..151a74f 100644 --- a/src/app/RunFile.php +++ b/src/app/RunFile.php @@ -59,12 +59,18 @@ class RunFile { return $data; } - /** tester si l'application est démarrée */ - function isStarted(): bool { + /** tester si l'application a déjà été démarrée */ + function wasStarted(): bool { $data = $this->read(); return $data["date_start"] !== null; } + /** tester si l'application est démarrée et non arrêtée */ + function isStarted(): bool { + $data = $this->read(); + return $data["date_start"] !== null && $data["date_stop"] === null; + } + /** * vérifier si la tâche tourne et est accessible */ @@ -90,15 +96,22 @@ class RunFile { return true; } - /** tester si l'application est arrêtée */ - function isStopped(): bool { + /** tester si l'application est déjà été stoppée */ + function wasStopped(): bool { $data = $this->read(); return $data["date_stop"] !== null; } + /** tester si l'application a été démarrée puis arrêtée */ + function isStopped(): bool { + $data = $this->read(); + return $data["date_start"] !== null && $data["date_stop"] !== null; + } + function haveWorked(int $serial, ?int &$currentSerial=null): bool { $data = $this->read(); - return $serial !== $data["serial"]; + $currentSerial = $data["serial"]; + return $serial !== $currentSerial; } protected function willWrite(): array {