summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-11-27 11:48:59 +0100
committerGitHub <noreply@github.com>2017-11-27 11:48:59 +0100
commit8ccb4868762b13adc02f49654a7867b556009a41 (patch)
treebfdbb3deea57edf49122c12c05ef28b7c61a25cf /settings
parentf0d809fddecd63ca16028222a355b1c7f5aca4d9 (diff)
parentdf61d43529418aace241b99be106ff9a35188dac (diff)
downloadnextcloud-server-8ccb4868762b13adc02f49654a7867b556009a41.tar.gz
nextcloud-server-8ccb4868762b13adc02f49654a7867b556009a41.zip
Merge pull request #7264 from nextcloud/cache-fetched-apps
Cache fetched apps in update check
Diffstat (limited to 'settings')
-rw-r--r--settings/Controller/AppSettingsController.php19
-rw-r--r--settings/ajax/updateapp.php8
2 files changed, 13 insertions, 14 deletions
diff --git a/settings/Controller/AppSettingsController.php b/settings/Controller/AppSettingsController.php
index 26858eabcf3..f2a92b52f6d 100644
--- a/settings/Controller/AppSettingsController.php
+++ b/settings/Controller/AppSettingsController.php
@@ -37,6 +37,7 @@ use OC\App\AppStore\Fetcher\CategoryFetcher;
use OC\App\AppStore\Version\VersionParser;
use OC\App\DependencyAnalyzer;
use OC\App\Platform;
+use OC\Installer;
use OCP\App\IAppManager;
use \OCP\AppFramework\Controller;
use OCP\AppFramework\Http\ContentSecurityPolicy;
@@ -74,6 +75,8 @@ class AppSettingsController extends Controller {
private $l10nFactory;
/** @var BundleFetcher */
private $bundleFetcher;
+ /** @var Installer */
+ private $installer;
/**
* @param string $appName
@@ -86,6 +89,7 @@ class AppSettingsController extends Controller {
* @param AppFetcher $appFetcher
* @param IFactory $l10nFactory
* @param BundleFetcher $bundleFetcher
+ * @param Installer $installer
*/
public function __construct($appName,
IRequest $request,
@@ -96,7 +100,8 @@ class AppSettingsController extends Controller {
CategoryFetcher $categoryFetcher,
AppFetcher $appFetcher,
IFactory $l10nFactory,
- BundleFetcher $bundleFetcher) {
+ BundleFetcher $bundleFetcher,
+ Installer $installer) {
parent::__construct($appName, $request);
$this->l10n = $l10n;
$this->config = $config;
@@ -106,6 +111,7 @@ class AppSettingsController extends Controller {
$this->appFetcher = $appFetcher;
$this->l10nFactory = $l10nFactory;
$this->bundleFetcher = $bundleFetcher;
+ $this->installer = $installer;
}
/**
@@ -270,8 +276,7 @@ class AppSettingsController extends Controller {
];
- $appFetcher = \OC::$server->getAppFetcher();
- $newVersion = \OC\Installer::isUpdateAvailable($app['id'], $appFetcher);
+ $newVersion = $this->installer->isUpdateAvailable($app['id']);
if($newVersion && $this->appManager->isInstalled($app['id'])) {
$formattedApps[count($formattedApps)-1]['update'] = $newVersion;
}
@@ -284,7 +289,7 @@ class AppSettingsController extends Controller {
$appClass = new \OC_App();
$apps = $appClass->listAllApps();
foreach($apps as $key => $app) {
- $newVersion = \OC\Installer::isUpdateAvailable($app['id'], $this->appFetcher);
+ $newVersion = $this->installer->isUpdateAvailable($app['id']);
if($newVersion !== false) {
$apps[$key]['update'] = $newVersion;
} else {
@@ -317,7 +322,7 @@ class AppSettingsController extends Controller {
$apps = $appClass->listAllApps();
foreach($apps as $key => $app) {
- $newVersion = \OC\Installer::isUpdateAvailable($app['id'], $this->appFetcher);
+ $newVersion = $this->installer->isUpdateAvailable($app['id']);
$apps[$key]['update'] = $newVersion;
}
@@ -342,7 +347,7 @@ class AppSettingsController extends Controller {
});
foreach($apps as $key => $app) {
- $newVersion = \OC\Installer::isUpdateAvailable($app['id'], $this->appFetcher);
+ $newVersion = $this->installer->isUpdateAvailable($app['id']);
$apps[$key]['update'] = $newVersion;
}
@@ -363,7 +368,7 @@ class AppSettingsController extends Controller {
});
$apps = array_map(function ($app) {
- $newVersion = \OC\Installer::isUpdateAvailable($app['id'], $this->appFetcher);
+ $newVersion = $this->installer->isUpdateAvailable($app['id']);
if ($newVersion !== false) {
$app['update'] = $newVersion;
}
diff --git a/settings/ajax/updateapp.php b/settings/ajax/updateapp.php
index 7b615cb56bb..3431c68dbd7 100644
--- a/settings/ajax/updateapp.php
+++ b/settings/ajax/updateapp.php
@@ -41,13 +41,7 @@ $appId = OC_App::cleanAppId($appId);
$config = \OC::$server->getConfig();
$config->setSystemValue('maintenance', true);
try {
- $installer = new \OC\Installer(
- \OC::$server->getAppFetcher(),
- \OC::$server->getHTTPClientService(),
- \OC::$server->getTempManager(),
- \OC::$server->getLogger(),
- \OC::$server->getConfig()
- );
+ $installer = \OC::$server->query(\OC\Installer::class);
$result = $installer->updateAppstoreApp($appId);
$config->setSystemValue('maintenance', false);
} catch(Exception $ex) {