summaryrefslogtreecommitdiffstats
path: root/lib/private/Installer.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-11-24 10:41:51 +0100
committerMorris Jobke <hey@morrisjobke.de>2017-11-25 12:01:02 +0100
commitdf61d43529418aace241b99be106ff9a35188dac (patch)
tree1dee18bbed4828e67b96f87c41f3a43f799fd822 /lib/private/Installer.php
parent0e2f00ec59424b2ef5708a928856e2c75abe6deb (diff)
downloadnextcloud-server-df61d43529418aace241b99be106ff9a35188dac.tar.gz
nextcloud-server-df61d43529418aace241b99be106ff9a35188dac.zip
Make isUpdateAvailable non-static
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/Installer.php')
-rw-r--r--lib/private/Installer.php25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/private/Installer.php b/lib/private/Installer.php
index cc6725e9175..70d6c10b335 100644
--- a/lib/private/Installer.php
+++ b/lib/private/Installer.php
@@ -67,6 +67,10 @@ class Installer {
private $logger;
/** @var IConfig */
private $config;
+ /** @var array - for caching the result of app fetcher */
+ private $apps = null;
+ /** @var bool|null - for caching the result of the ready status */
+ private $isInstanceReadyForUpdates = null;
/**
* @param AppFetcher $appFetcher
@@ -187,7 +191,7 @@ class Installer {
* @return bool
*/
public function updateAppstoreApp($appId) {
- if(self::isUpdateAvailable($appId, $this->appFetcher)) {
+ if($this->isUpdateAvailable($appId)) {
try {
$this->downloadApp($appId);
} catch (\Exception $e) {
@@ -375,29 +379,24 @@ class Installer {
* Check if an update for the app is available
*
* @param string $appId
- * @param AppFetcher $appFetcher
* @return string|false false or the version number of the update
*/
- public static function isUpdateAvailable($appId,
- AppFetcher $appFetcher) {
- static $isInstanceReadyForUpdates = null;
-
- if ($isInstanceReadyForUpdates === null) {
+ public function isUpdateAvailable($appId) {
+ if ($this->isInstanceReadyForUpdates === null) {
$installPath = OC_App::getInstallPath();
if ($installPath === false || $installPath === null) {
- $isInstanceReadyForUpdates = false;
+ $this->isInstanceReadyForUpdates = false;
} else {
- $isInstanceReadyForUpdates = true;
+ $this->isInstanceReadyForUpdates = true;
}
}
- if ($isInstanceReadyForUpdates === false) {
+ if ($this->isInstanceReadyForUpdates === false) {
return false;
}
- static $apps = null;
- if ($apps === null) {
- $apps = $appFetcher->get();
+ if ($this->apps === null) {
+ $apps = $this->appFetcher->get();
}
foreach($apps as $app) {