From a97a290fd5ed06dfc33d2adeed5d3b7531674827 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 23 Nov 2017 15:04:51 +0100 Subject: [PATCH] Cache fetched apps in update check The code tried to find the apps with updates and thus was called for every available app. This caused to get the full appstore content as often as apps are available. The appstore request itself was cached nevertheless in an appdata dir, but with an object storage this is still a lot of round trips to read this cached result. Thus the instantiated list is now cached in a static variable (because it's a static method call). Signed-off-by: Morris Jobke --- lib/private/Installer.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/Installer.php b/lib/private/Installer.php index e754f28455b..cc6725e9175 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -395,7 +395,11 @@ class Installer { return false; } - $apps = $appFetcher->get(); + static $apps = null; + if ($apps === null) { + $apps = $appFetcher->get(); + } + foreach($apps as $app) { if($app['id'] === $appId) { $currentVersion = OC_App::getAppVersion($appId);