Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Latest
* [#216](https://github.com/cleverage/ui-process-bundle/issues/216) Cookbooks with task codes, application `upload_directory` parameter left alone, deprecation notice for the unused `$translator` argument, scheduler log levels.

## Changes
* [#226](https://github.com/cleverage/ui-process-bundle/issues/226) Require `cleverage/process-bundle` `^5.5` (`ProcessEvent::isProcessStopped()`, #220): the compatibility code with process-bundle 5.4 is removed.
* [#220](https://github.com/cleverage/ui-process-bundle/issues/220) A process stopped on purpose by a `StopTask` (e.g. not going on when the source file does not exist) is recorded with the `stopped` status, and notified as `stopped`, instead of `finish`. Requires the process bundle version providing `ProcessEvent::isProcessStopped()` (cleverage/process-bundle#337); with an older version, the execution keeps the `finish` status. Update documentation, add tests.
* [#207](https://github.com/cleverage/ui-process-bundle/issues/207) The `main` firewall configured by the bundle (`security.configure_firewall`) limits the login attempts (Symfony `login_throttling`, default settings: 5 failed attempts per minute for a username and an IP address, 25 for an IP address); the settings can be changed in the application firewall. Require `symfony/rate-limiter`. Update documentation and tests.
* [#186](https://github.com/cleverage/ui-process-bundle/issues/186) `ProcessExecuteController`, `ProcessExecuteHandler`, `LaunchType`, `ProcessConfigurationsManager` and `IsValidProcessCodeValidator` are typed on `ProcessManagerInterface` / `ProcessConfigurationRegistryInterface` (process-bundle 5.4) instead of the concrete classes, `@final since 5.4`: the process manager and the process configuration registry can be decorated or replaced for the UI.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"require": {
"php": "^8.2",
"cleverage/process-bundle": "^5.4",
"cleverage/process-bundle": "^5.5",
"doctrine/collections": "^1.5|^2.1|^3.1",
"doctrine/dbal": "^3.10|^4.4",
"doctrine/doctrine-bundle": "^2.18|^3.1",
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/04-process_executions_and_logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ An event subscriber listens to the process bundle events:
name of the log file,
- on process end, its status becomes `finish` and its end date is set, or `stopped` when the process has been stopped
on purpose by a [StopTask](https://github.com/cleverage/process-bundle/blob/main/docs/reference/tasks/stop_task.md)
(e.g. not going on when the source file does not exist; requires the process bundle version following 5.4),
(e.g. not going on when the source file does not exist),
- on process failure, its status becomes `failed` and its end date is set, or `stopped` when the process has been
[stopped from the UI](#stopping-a-process-execution).

Expand Down
12 changes: 0 additions & 12 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,3 @@ parameters:
path: tests/*
- identifier: method.impossibleType
path: tests/*
# ProcessEvent::isProcessStopped() is only provided by the process bundle version following 5.4 (#220): remove
# these entries once this version is required
- identifier: function.alreadyNarrowedType
paths:
- src/EventSubscriber/ProcessEventSubscriber.php
- tests/EventSubscriber/ProcessEventSubscriberTest.php
- identifier: function.impossibleType
paths:
- src/EventSubscriber/ProcessEventSubscriber.php
- tests/EventSubscriber/ProcessEventSubscriberTest.php
- identifier: arguments.count
path: tests/EventSubscriber/ProcessEventSubscriberTest.php
12 changes: 2 additions & 10 deletions src/EventSubscriber/ProcessEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public function success(ProcessEvent $event): void
{
if ($event->getProcessCode() === $this->processExecutionManager->getCurrentProcessExecution()?->getCode()) {
$this->processExecutionManager->getCurrentProcessExecution()->setStatus(
$this->isStoppedOnPurpose($event) ? ProcessExecutionStatus::Stopped : ProcessExecutionStatus::Finish
// Stopped on purpose by a StopTask: ended normally, flagged as stopped
$event->isProcessStopped() ? ProcessExecutionStatus::Stopped : ProcessExecutionStatus::Finish
);
$this->processExecutionManager->getCurrentProcessExecution()->end();
$this->endProcessExecution($event);
Expand Down Expand Up @@ -90,15 +91,6 @@ private function endProcessExecution(ProcessEvent $event): void
$this->dispatchEnded($event);
}

/**
* The process has been stopped on purpose by a StopTask: it has ended normally, flagged as stopped
* (ProcessEvent::isProcessStopped(), since the process bundle version following 5.4).
*/
private function isStoppedOnPurpose(ProcessEvent $event): bool
{
return method_exists($event, 'isProcessStopped') && $event->isProcessStopped();
}

/**
* The process has been stopped on a stop request: a ProcessStoppedException in the chain of the previous
* exceptions (wrapped in a ProcessFailedException, by each parent process for a sub-process).
Expand Down
3 changes: 0 additions & 3 deletions tests/EventSubscriber/ProcessEventSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ public static function provideStopErrors(): iterable

public function testProcessStoppedByAStopTask(): void
{
if (!method_exists(ProcessEvent::class, 'isProcessStopped')) {
self::markTestSkipped('ProcessEvent::isProcessStopped() requires a newer cleverage/process-bundle');
}
$processExecution = new ProcessExecution('test.process', 'test.log');
$processExecutionManager = new ProcessExecutionManager($this->createRepositoryStub());
$processExecutionManager->setCurrentProcessExecution($processExecution);
Expand Down
Loading