diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2018-09-01 23:45:57 +0300 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2018-09-01 23:45:57 +0300 |
commit | c42f1718f3411b2169fbd3c5f14aa3254d726a2a (patch) | |
tree | 125131230ff893a193bafe86c6c0475c362630e3 /lib | |
parent | 5ff2dee83e4b234f1830bed58ec0db5c16f731d6 (diff) |
Fix static call for isUpdateAvailable
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/SystemStatistics.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/SystemStatistics.php b/lib/SystemStatistics.php index c10e454..cc2bb60 100644 --- a/lib/SystemStatistics.php +++ b/lib/SystemStatistics.php @@ -23,9 +23,9 @@ namespace OCA\ServerInfo; use OC\Files\View; +use OC\Installer; use OCP\IConfig; use OCP\App\IAppManager; -use OC\App\AppStore\Fetcher\AppFetcher; class SystemStatistics { @@ -35,27 +35,29 @@ class SystemStatistics { private $view; /** @var IAppManager */ private $appManager; - /** @var AppFetcher */ - private $appFetcher; + /** @var Installer */ + private $installer; /** * SystemStatistics constructor. * - * @param IConfig $config + * @param IConfig $config * @param IAppManager $appManager - * @param AppFetcher $appFetcher + * @param Installer $installer + * @throws \Exception */ - public function __construct(IConfig $config, IAppManager $appManager, AppFetcher $appFetcher) { + public function __construct(IConfig $config, IAppManager $appManager, Installer $installer) { $this->config = $config; $this->view = new View(); $this->appManager = $appManager; - $this->appFetcher = $appFetcher; + $this->installer = $installer; } /** * Get statistics about the system * * @return array with with of data + * @throws \OCP\Files\InvalidPathException */ public function getSystemStatistics() { $memoryUsage = $this->getMemoryUsage(); @@ -161,16 +163,16 @@ class SystemStatistics { // load all apps $apps = $this->appManager->getInstalledApps(); - $info['num_installed'] = count($apps); + $info['num_installed'] = \count($apps); // iteriate through all installed apps. - foreach($apps as $app) { + foreach($apps as $appId) { // check if there is any new version available for that specific app - $newVersion = \OC\Installer::isUpdateAvailable($app, $this->appFetcher); + $newVersion = $this->installer->isUpdateAvailable($appId); if ($newVersion) { // new version available, count up and tell which version. $info['num_updates_available']++; - $info['app_updates'][$app] = $newVersion; + $info['app_updates'][$appId] = $newVersion; } } |