chore: Remove Task

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2024-04-30 06:38:49 +02:00
parent 5e968200bb
commit 5fd1a5c6da
13 changed files with 65 additions and 883 deletions

View File

@@ -59,10 +59,10 @@ final class SaveController extends SimpleControllerBase
private ConfigService $configService;
public function __construct(
Application $application,
Application $application,
SimpleControllerHelper $simpleControllerHelper,
MasterPassService $masterPassService,
ConfigService $configService
ConfigService $configService
) {
parent::__construct($application, $simpleControllerHelper);
@@ -145,13 +145,10 @@ final class SaveController extends SimpleControllerBase
if (!$noAccountPassChange) {
try {
$task = $this->getTask();
$request = new UpdateMasterPassRequest(
$currentMasterPass,
$newMasterPass,
$this->configService->getByParam(MasterPass::PARAM_MASTER_PASS_HASH),
$task
);
$this->eventDispatcher->notify('update.masterPassword.start', new Event($this));
@@ -165,10 +162,6 @@ final class SaveController extends SimpleControllerBase
$this->eventDispatcher->notify('exception', new Event($e));
return $this->returnJsonResponseException($e);
} finally {
if (isset($task)) {
TaskFactory::end($task);
}
}
} else {
try {
@@ -194,18 +187,6 @@ final class SaveController extends SimpleControllerBase
);
}
/**
* @throws FileException
*/
private function getTask(): ?TaskInterface
{
$taskId = $this->request->analyzeString('taskId');
return $taskId !== null
? TaskFactory::register(new Task(__FUNCTION__, $taskId))
: null;
}
/**
* @return void
* @throws JsonException
@@ -222,4 +203,16 @@ final class SaveController extends SimpleControllerBase
$this->returnJsonResponseException($e);
}
}
/**
* @throws FileException
*/
private function getTask(): ?TaskInterface
{
$taskId = $this->request->analyzeString('taskId');
return $taskId !== null
? TaskFactory::register(new Task(__FUNCTION__, $taskId))
: null;
}
}