From 54c227b6c4cf7c4597a45aa255be93cd4c14d1ec Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 14 Dec 2017 09:50:17 +0100 Subject: [PATCH] Use cached app list Followup to #7264 Signed-off-by: Morris Jobke --- lib/private/Installer.php | 4 ++-- tests/lib/InstallerTest.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 48bd57f4c1..eb1f8a456b 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -396,10 +396,10 @@ class Installer { } if ($this->apps === null) { - $apps = $this->appFetcher->get(); + $this->apps = $this->appFetcher->get(); } - foreach($apps as $app) { + foreach($this->apps as $app) { if($app['id'] === $appId) { $currentVersion = OC_App::getAppVersion($appId); $newestVersion = $app['releases'][0]['version']; diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php index 897bc47210..c7e4bfeacf 100644 --- a/tests/lib/InstallerTest.php +++ b/tests/lib/InstallerTest.php @@ -156,6 +156,7 @@ class InstallerTest extends TestCase { $installer = $this->getInstaller(); $this->assertSame($updateAvailable, $installer->isUpdateAvailable('files')); + $this->assertSame($updateAvailable, $installer->isUpdateAvailable('files'), 'Cached result should be returned and fetcher should be only called once'); } /**