diff --git a/Admin/Install/Workflow.install.json b/Admin/Install/Workflow.install.json index 6a413ca..b5fea35 100755 --- a/Admin/Install/Workflow.install.json +++ b/Admin/Install/Workflow.install.json @@ -8,8 +8,9 @@ "en": "Check resources", "de": "Ueberpruefe Ressourcen" }, - "function_type": "API", - "function": "apiResourceCheck", + "function_type": "Api", + "function": "checkResources", + "module": "OnlineResourceWatcher", "inputs": [ "unit", "{*}" diff --git a/Controller/ApiController.php b/Controller/ApiController.php index c4c83a0..9e9474f 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -181,6 +181,15 @@ final class ApiController extends Controller */ public function apiCheckResources(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { + $this->checkResources(); + + $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Resources', 'Resources were checked.', null); + } + + public function checkResources(mixed $var = null) : array + { + $changed = []; + /** @var Resource[] $resources */ $resources = ResourceMapper::getAll() ->where('status', ResourceStatus::ACTIVE) @@ -422,6 +431,8 @@ final class ApiController extends Controller $resource->lastVersionDate = $report->createdAt; $resource->hash = $md5New; + $changed[] = $report; + Directory::copy($path, $basePath . '/' . $id . '/' . $check['timestamp']); } @@ -443,7 +454,7 @@ final class ApiController extends Controller Directory::delete($basePath . '/temp'); - $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Resources', 'Resources were checked.', null); + return $changed; } /**