Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 3ca1220

Browse files
committed
CLI and task_id passed : make sure to update status by default, for actions that do not implement specific tasks management. Otherwise scheduler will show "Starting action.... " and nothing more.
1 parent a7e00ce commit 3ca1220

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

core/src/core/src/pydio/Core/Http/Cli/AuthCliMiddleware.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ public static function handleRequest(ServerRequestInterface $requestInterface, R
158158
foreach( $repos as $repoId => $repositoryInterface ){
159159

160160
try{
161-
$output->writeln("<comment>Applying action '$actionName' on workspace ".$repositoryInterface->getDisplay()." (".$repoId.")</comment>");
161+
$message = "Applying action '$actionName' on workspace ".$repositoryInterface->getDisplay()." (".$repoId.")";
162+
$output->writeln("<comment>$message</comment>");
163+
if(!empty($taskId)){
164+
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_RUNNING, "User '$userId' - ".$message);
165+
}
162166
$subResponse = new Response();
163167
$ctx = Context::contextWithObjects($user, $repositoryInterface);
164168
$requestInterface = $requestInterface->withAttribute("ctx", $ctx);
@@ -189,7 +193,7 @@ public static function handleRequest(ServerRequestInterface $requestInterface, R
189193

190194
$output->writeln("<error>$taskId: ".$repoEx->getMessage()."</error>");
191195
if(!empty($taskId)){
192-
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_FAILED, $repoEx->getMessage());
196+
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_FAILED, "User '$userId' / $repoId - ".$repoEx->getMessage());
193197
}
194198

195199
}
@@ -200,7 +204,7 @@ public static function handleRequest(ServerRequestInterface $requestInterface, R
200204

201205
$output->writeln("<error>USER: ".$userEx->getMessage()."</error>");
202206
if(!empty($taskId)){
203-
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_FAILED, $userEx->getMessage());
207+
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_FAILED, "User '$userId' - ".$userEx->getMessage());
204208
}
205209

206210
}

core/src/core/src/pydio/Core/Http/Cli/CliMiddleware.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ public function handleRequest(ServerRequestInterface $requestInterface, Response
9797

9898
}
9999

100+
if(!empty($taskId)){
101+
$task = TaskService::getInstance()->getTaskById($taskId);
102+
// Update status if required.
103+
if($task->getStatus() === Task::STATUS_RUNNING){
104+
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_COMPLETE, "Finished");
105+
}
106+
}
100107
}
101108

102109
/**

0 commit comments

Comments
 (0)