diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-08-20 11:50:01 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-08-20 11:50:01 +0200 |
commit | 06d8edd9637f59f914ec7f3d7f6846f3cbe88eaf (patch) | |
tree | 49833fd9a8a80255b7ae2d91291e5371a047870b /lib/private/app | |
parent | 2fe070ca37c76bc118c0fe360b9c7008bf01e52b (diff) | |
parent | a2674b2b303c6b2a5935638af04f0e4a61afae24 (diff) | |
download | nextcloud-server-06d8edd9637f59f914ec7f3d7f6846f3cbe88eaf.tar.gz nextcloud-server-06d8edd9637f59f914ec7f3d7f6846f3cbe88eaf.zip |
Merge pull request #17434 from owncloud/update-showappnameonappupdate
Display app names in update page for app updates
Diffstat (limited to 'lib/private/app')
-rw-r--r-- | lib/private/app/appmanager.php | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/lib/private/app/appmanager.php b/lib/private/app/appmanager.php index 7a61cd53c59..75b1c0a7865 100644 --- a/lib/private/app/appmanager.php +++ b/lib/private/app/appmanager.php @@ -209,4 +209,73 @@ class AppManager implements IAppManager { $settingsMemCache = $this->memCacheFactory->create('settings'); $settingsMemCache->clear('listApps'); } + + /** + * Returns a list of apps that need upgrade + * + * @param array $version ownCloud version as array of version components + * @return array list of app info from apps that need an upgrade + * + * @internal + */ + public function getAppsNeedingUpgrade($ocVersion) { + $appsToUpgrade = []; + $apps = $this->getInstalledApps(); + foreach ($apps as $appId) { + $appInfo = $this->getAppInfo($appId); + $appDbVersion = $this->appConfig->getValue($appId, 'installed_version'); + if ($appDbVersion + && isset($appInfo['version']) + && version_compare($appInfo['version'], $appDbVersion, '>') + && \OC_App::isAppCompatible($ocVersion, $appInfo) + ) { + $appsToUpgrade[] = $appInfo; + } + } + + return $appsToUpgrade; + } + + /** + * Returns the app information from "appinfo/info.xml". + * + * If no version was present in "appinfo/info.xml", reads it + * from the external "appinfo/version" file instead. + * + * @param string $appId app id + * + * @return array app iinfo + * + * @internal + */ + public function getAppInfo($appId) { + $appInfo = \OC_App::getAppInfo($appId); + if (!isset($appInfo['version'])) { + // read version from separate file + $appInfo['version'] = \OC_App::getAppVersion($appId); + } + return $appInfo; + } + + /** + * Returns a list of apps incompatible with the given version + * + * @param array $version ownCloud version as array of version components + * + * @return array list of app info from incompatible apps + * + * @internal + */ + public function getIncompatibleApps($version) { + $apps = $this->getInstalledApps(); + $incompatibleApps = array(); + foreach ($apps as $appId) { + $info = $this->getAppInfo($appId); + if (!\OC_App::isAppCompatible($version, $info)) { + $incompatibleApps[] = $info; + } + } + return $incompatibleApps; + } + } |