mirror of
https://github.com/nextcloud/server.git
synced 2026-02-19 02:38:40 -05:00
fix: Make sure array starts at 0 after array filter
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
parent
017f136059
commit
2031fe17b4
1 changed files with 2 additions and 2 deletions
|
|
@ -282,14 +282,14 @@ class Manager implements IManager {
|
|||
$preferences = json_decode($json, true);
|
||||
if (isset($preferences[$task->getType()])) {
|
||||
// If a preference for this task type is set, move the preferred provider to the start
|
||||
$provider = current(array_filter($providers, fn ($provider) => $provider::class === $preferences[$task->getType()]));
|
||||
$provider = current(array_values(array_filter($providers, fn ($provider) => $provider::class === $preferences[$task->getType()])));
|
||||
if ($provider !== false) {
|
||||
$providers = array_filter($providers, fn ($p) => $p !== $provider);
|
||||
array_unshift($providers, $provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
$providers = array_filter($providers, fn (IProvider $provider) => $task->canUseProvider($provider));
|
||||
$providers = array_values(array_filter($providers, fn (IProvider $provider) => $task->canUseProvider($provider)));
|
||||
return $providers;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue