aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-08-01 18:57:00 +0200
committerMorris Jobke <hey@morrisjobke.de>2017-08-01 18:57:00 +0200
commitcd02b2205e5148e79698f60d0209cf10391e30c8 (patch)
treec60d4682ea87427ae9c5d4ccd964671ebdbee222
parent84c22fdeef6986f9038d8563937cc234751d5147 (diff)
downloadnextcloud-server-cd02b2205e5148e79698f60d0209cf10391e30c8.tar.gz
nextcloud-server-cd02b2205e5148e79698f60d0209cf10391e30c8.zip
Use public methods for OC_App::isShipped
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r--core/Command/App/ListApps.php2
-rw-r--r--lib/private/Updater.php8
-rw-r--r--lib/private/legacy/api.php7
-rw-r--r--lib/private/legacy/app.php23
4 files changed, 16 insertions, 24 deletions
diff --git a/core/Command/App/ListApps.php b/core/Command/App/ListApps.php
index e03e3ce8f56..c933a2519ef 100644
--- a/core/Command/App/ListApps.php
+++ b/core/Command/App/ListApps.php
@@ -73,7 +73,7 @@ class ListApps extends Base {
//sort enabled apps above disabled apps
foreach ($apps as $app) {
- if ($shippedFilter !== null && \OC_App::isShipped($app) !== $shippedFilter){
+ if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){
continue;
}
if ($this->manager->isInstalled($app)) {
diff --git a/lib/private/Updater.php b/lib/private/Updater.php
index 6c23a43c354..902d22f6679 100644
--- a/lib/private/Updater.php
+++ b/lib/private/Updater.php
@@ -315,10 +315,11 @@ class Updater extends BasicEmitter {
$apps = \OC_App::getEnabledApps();
$this->emit('\OC\Updater', 'appUpgradeCheckBefore');
+ $appManager = \OC::$server->getAppManager();
foreach ($apps as $appId) {
$info = \OC_App::getAppInfo($appId);
$compatible = \OC_App::isAppCompatible($version, $info);
- $isShipped = \OC_App::isShipped($appId);
+ $isShipped = $appManager->isShipped($appId);
if ($compatible && $isShipped && \OC_App::shouldUpgrade($appId)) {
/**
@@ -407,11 +408,12 @@ class Updater extends BasicEmitter {
$apps = OC_App::getEnabledApps();
$version = Util::getVersion();
$disabledApps = [];
+ $appManager = \OC::$server->getAppManager();
foreach ($apps as $app) {
// check if the app is compatible with this version of ownCloud
$info = OC_App::getAppInfo($app);
if(!OC_App::isAppCompatible($version, $info)) {
- if (OC_App::isShipped($app)) {
+ if ($appManager->isShipped($app)) {
throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update');
}
OC_App::disable($app);
@@ -422,7 +424,7 @@ class Updater extends BasicEmitter {
continue;
}
// shipped apps will remain enabled
- if (OC_App::isShipped($app)) {
+ if ($appManager->isShipped($app)) {
continue;
}
// authentication and session apps will remain enabled as well
diff --git a/lib/private/legacy/api.php b/lib/private/legacy/api.php
index 894aee28560..f65275bf1da 100644
--- a/lib/private/legacy/api.php
+++ b/lib/private/legacy/api.php
@@ -123,13 +123,14 @@ class OC_API {
$name = $parameters['_route'];
// Foreach registered action
$responses = array();
+ $appManager = \OC::$server->getAppManager();
foreach(self::$actions[$name] as $action) {
// Check authentication and availability
if(!self::isAuthorised($action)) {
$responses[] = array(
'app' => $action['app'],
'response' => new OC_OCS_Result(null, API::RESPOND_UNAUTHORISED, 'Unauthorised'),
- 'shipped' => OC_App::isShipped($action['app']),
+ 'shipped' => $appManager->isShipped($action['app']),
);
continue;
}
@@ -137,7 +138,7 @@ class OC_API {
$responses[] = array(
'app' => $action['app'],
'response' => new OC_OCS_Result(null, API::RESPOND_NOT_FOUND, 'Api method not found'),
- 'shipped' => OC_App::isShipped($action['app']),
+ 'shipped' => $appManager->isShipped($action['app']),
);
continue;
}
@@ -145,7 +146,7 @@ class OC_API {
$responses[] = array(
'app' => $action['app'],
'response' => call_user_func($action['action'], $parameters),
- 'shipped' => OC_App::isShipped($action['app']),
+ 'shipped' => $appManager->isShipped($action['app']),
);
}
$response = self::mergeResponses($responses);
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index 9f6932b3a89..872c1c120ac 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -283,18 +283,6 @@ class OC_App {
}
/**
- * check if app is shipped
- *
- * @param string $appId the id of the app to check
- * @return bool
- *
- * Check if an app that is installed is a shipped app or installed from the appstore.
- */
- public static function isShipped($appId) {
- return \OC::$server->getAppManager()->isShipped($appId);
- }
-
- /**
* get all enabled apps
*/
protected static $enabledAppsCache = array();
@@ -396,7 +384,7 @@ class OC_App {
* @return bool
*/
public static function removeApp($app) {
- if (self::isShipped($app)) {
+ if (\OC::$server->getAppManager()->isShipped($app)) {
return false;
}
@@ -777,8 +765,9 @@ class OC_App {
public function listAllApps() {
$installedApps = OC_App::getAllApps();
+ $appManager = \OC::$server->getAppManager();
//we don't want to show configuration for these
- $blacklist = \OC::$server->getAppManager()->getAlwaysEnabledApps();
+ $blacklist = $appManager->getAlwaysEnabledApps();
$appList = array();
$langCode = \OC::$server->getL10N('core')->getLanguageCode();
$urlGenerator = \OC::$server->getURLGenerator();
@@ -810,7 +799,7 @@ class OC_App {
$info['active'] = $active;
- if (self::isShipped($app)) {
+ if ($appManager->isShipped($app)) {
$info['internal'] = true;
$info['level'] = self::officialApp;
$info['removable'] = false;
@@ -823,12 +812,12 @@ class OC_App {
if($appPath !== false) {
$appIcon = $appPath . '/img/' . $app . '.svg';
if (file_exists($appIcon)) {
- $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, $app . '.svg');
+ $info['preview'] = $urlGenerator->imagePath($app, $app . '.svg');
$info['previewAsIcon'] = true;
} else {
$appIcon = $appPath . '/img/app.svg';
if (file_exists($appIcon)) {
- $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, 'app.svg');
+ $info['preview'] = $urlGenerator->imagePath($app, 'app.svg');
$info['previewAsIcon'] = true;
}
}