diff options
author | Patrik Kernstock <info@pkern.at> | 2018-09-03 14:28:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-03 14:28:45 +0300 |
commit | 43293773bfb44f425dc92efd8adfa50854b3b551 (patch) | |
tree | f4415ff11954b3f09eab3559ff5b0edc20630dc9 /lib | |
parent | 57090e81638783e2302cb87e3a0e8ff52018102d (diff) | |
parent | 61832ae61240fd1a05e6efe9e3d8948a81566172 (diff) |
Merge branch 'master' into add-nc-mon-ui
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; } } |