Skip to content

Commit

Permalink
Dev: Clean up getAllUpdaters()
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Oct 2, 2018
1 parent 43cad84 commit 8ceed06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Expand Up @@ -33,7 +33,6 @@ public function checkAll()
// Only static methods will be used for this updaters.
list($updaters, $errors) = $service->getAllUpdaters();

$errors = [];
foreach ($updaters as $updater) {
try {
$updates = $updater->getAvailableUpdates();
Expand Down
Expand Up @@ -69,15 +69,22 @@ public function getUpdater(string $name)

/**
* Get all created updaters for all updater types (plugins, themes, ...).
* @return ExtensionUpdater[]
* @return array [ExtensionUpdater[] $updaters, string[] $errors]
*/
public function getAllUpdaters()
{
// Get an extension updater for each extension installed.
$updaters = [];
$errors = [];
foreach ($this->updaters as $creator) {
$updaters = array_merge($creator(), $updaters);
list($newUpdaters, $newErrors) = $creator();
if ($newUpdaters) {
$updaters = array_merge($newUpdaters, $updaters);
}
if ($errors) {
$errors = array_merge($newErrors, $errors);
}
}
return $updaters;
return [$updaters, $errors];
}
}

0 comments on commit 8ceed06

Please sign in to comment.