-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Properly inject EventDispatched in BackgroundRepair #14805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Else it will just be null when called Signed-off-by: Roeland Jago Douma <[email protected]>
ChristophWurst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
| /** | ||
| * @param EventDispatcherInterface $dispatcher | ||
| */ | ||
| public function setDispatcher(EventDispatcherInterface $dispatcher): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is only executed in tests, why did it work then in the actual code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is then actually needed in line 94. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only used in
server/lib/private/legacy/app.php
Lines 983 to 985 in 769cb62
| $queue->add('OC\Migration\BackgroundRepair', [ | |
| 'app' => $appId, | |
| 'step' => $step]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because
Lines 195 to 198 in e819e97
| if (!is_null($this->dispatcher)) { | |
| $this->dispatcher->dispatch("$scope::$method", | |
| new GenericEvent("$scope::$method", $arguments)); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But shouldn't then this fail?
Line 80 in e819e97
| public function __construct(array $repairSteps, EventDispatcherInterface $dispatcher) { |
because there is only a type hint and not an explicit = null. Or is this only causing issues in strict mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there already a PR, because I can't find any.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is it. We now properly inject it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But where? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was referencing the initialization of a new BackgroundRepair instance. But you are right - they are added to the queue and the queue then uses the DI container. Sorry for the noise.
|
🤖 beep boop beep 🤖 Here are the logs for the failed build: Status of 17256: failureTESTS=acceptance, TESTS-ACCEPTANCE=app-files-sharing-link
Show full log |

Else it will just be null when called
Signed-off-by: Roeland Jago Douma [email protected]