Use public methods for OC_App::isShipped
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
84c22fdeef
commit
cd02b2205e
4 changed files with 16 additions and 24 deletions
|
@ -73,7 +73,7 @@ class ListApps extends Base {
|
||||||
|
|
||||||
//sort enabled apps above disabled apps
|
//sort enabled apps above disabled apps
|
||||||
foreach ($apps as $app) {
|
foreach ($apps as $app) {
|
||||||
if ($shippedFilter !== null && \OC_App::isShipped($app) !== $shippedFilter){
|
if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($this->manager->isInstalled($app)) {
|
if ($this->manager->isInstalled($app)) {
|
||||||
|
|
|
@ -315,10 +315,11 @@ class Updater extends BasicEmitter {
|
||||||
$apps = \OC_App::getEnabledApps();
|
$apps = \OC_App::getEnabledApps();
|
||||||
$this->emit('\OC\Updater', 'appUpgradeCheckBefore');
|
$this->emit('\OC\Updater', 'appUpgradeCheckBefore');
|
||||||
|
|
||||||
|
$appManager = \OC::$server->getAppManager();
|
||||||
foreach ($apps as $appId) {
|
foreach ($apps as $appId) {
|
||||||
$info = \OC_App::getAppInfo($appId);
|
$info = \OC_App::getAppInfo($appId);
|
||||||
$compatible = \OC_App::isAppCompatible($version, $info);
|
$compatible = \OC_App::isAppCompatible($version, $info);
|
||||||
$isShipped = \OC_App::isShipped($appId);
|
$isShipped = $appManager->isShipped($appId);
|
||||||
|
|
||||||
if ($compatible && $isShipped && \OC_App::shouldUpgrade($appId)) {
|
if ($compatible && $isShipped && \OC_App::shouldUpgrade($appId)) {
|
||||||
/**
|
/**
|
||||||
|
@ -407,11 +408,12 @@ class Updater extends BasicEmitter {
|
||||||
$apps = OC_App::getEnabledApps();
|
$apps = OC_App::getEnabledApps();
|
||||||
$version = Util::getVersion();
|
$version = Util::getVersion();
|
||||||
$disabledApps = [];
|
$disabledApps = [];
|
||||||
|
$appManager = \OC::$server->getAppManager();
|
||||||
foreach ($apps as $app) {
|
foreach ($apps as $app) {
|
||||||
// check if the app is compatible with this version of ownCloud
|
// check if the app is compatible with this version of ownCloud
|
||||||
$info = OC_App::getAppInfo($app);
|
$info = OC_App::getAppInfo($app);
|
||||||
if(!OC_App::isAppCompatible($version, $info)) {
|
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');
|
throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update');
|
||||||
}
|
}
|
||||||
OC_App::disable($app);
|
OC_App::disable($app);
|
||||||
|
@ -422,7 +424,7 @@ class Updater extends BasicEmitter {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// shipped apps will remain enabled
|
// shipped apps will remain enabled
|
||||||
if (OC_App::isShipped($app)) {
|
if ($appManager->isShipped($app)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// authentication and session apps will remain enabled as well
|
// authentication and session apps will remain enabled as well
|
||||||
|
|
|
@ -123,13 +123,14 @@ class OC_API {
|
||||||
$name = $parameters['_route'];
|
$name = $parameters['_route'];
|
||||||
// Foreach registered action
|
// Foreach registered action
|
||||||
$responses = array();
|
$responses = array();
|
||||||
|
$appManager = \OC::$server->getAppManager();
|
||||||
foreach(self::$actions[$name] as $action) {
|
foreach(self::$actions[$name] as $action) {
|
||||||
// Check authentication and availability
|
// Check authentication and availability
|
||||||
if(!self::isAuthorised($action)) {
|
if(!self::isAuthorised($action)) {
|
||||||
$responses[] = array(
|
$responses[] = array(
|
||||||
'app' => $action['app'],
|
'app' => $action['app'],
|
||||||
'response' => new OC_OCS_Result(null, API::RESPOND_UNAUTHORISED, 'Unauthorised'),
|
'response' => new OC_OCS_Result(null, API::RESPOND_UNAUTHORISED, 'Unauthorised'),
|
||||||
'shipped' => OC_App::isShipped($action['app']),
|
'shipped' => $appManager->isShipped($action['app']),
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +138,7 @@ class OC_API {
|
||||||
$responses[] = array(
|
$responses[] = array(
|
||||||
'app' => $action['app'],
|
'app' => $action['app'],
|
||||||
'response' => new OC_OCS_Result(null, API::RESPOND_NOT_FOUND, 'Api method not found'),
|
'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;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +146,7 @@ class OC_API {
|
||||||
$responses[] = array(
|
$responses[] = array(
|
||||||
'app' => $action['app'],
|
'app' => $action['app'],
|
||||||
'response' => call_user_func($action['action'], $parameters),
|
'response' => call_user_func($action['action'], $parameters),
|
||||||
'shipped' => OC_App::isShipped($action['app']),
|
'shipped' => $appManager->isShipped($action['app']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$response = self::mergeResponses($responses);
|
$response = self::mergeResponses($responses);
|
||||||
|
|
|
@ -282,18 +282,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
|
* get all enabled apps
|
||||||
*/
|
*/
|
||||||
|
@ -396,7 +384,7 @@ class OC_App {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function removeApp($app) {
|
public static function removeApp($app) {
|
||||||
if (self::isShipped($app)) {
|
if (\OC::$server->getAppManager()->isShipped($app)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -777,8 +765,9 @@ class OC_App {
|
||||||
public function listAllApps() {
|
public function listAllApps() {
|
||||||
$installedApps = OC_App::getAllApps();
|
$installedApps = OC_App::getAllApps();
|
||||||
|
|
||||||
|
$appManager = \OC::$server->getAppManager();
|
||||||
//we don't want to show configuration for these
|
//we don't want to show configuration for these
|
||||||
$blacklist = \OC::$server->getAppManager()->getAlwaysEnabledApps();
|
$blacklist = $appManager->getAlwaysEnabledApps();
|
||||||
$appList = array();
|
$appList = array();
|
||||||
$langCode = \OC::$server->getL10N('core')->getLanguageCode();
|
$langCode = \OC::$server->getL10N('core')->getLanguageCode();
|
||||||
$urlGenerator = \OC::$server->getURLGenerator();
|
$urlGenerator = \OC::$server->getURLGenerator();
|
||||||
|
@ -810,7 +799,7 @@ class OC_App {
|
||||||
|
|
||||||
$info['active'] = $active;
|
$info['active'] = $active;
|
||||||
|
|
||||||
if (self::isShipped($app)) {
|
if ($appManager->isShipped($app)) {
|
||||||
$info['internal'] = true;
|
$info['internal'] = true;
|
||||||
$info['level'] = self::officialApp;
|
$info['level'] = self::officialApp;
|
||||||
$info['removable'] = false;
|
$info['removable'] = false;
|
||||||
|
@ -823,12 +812,12 @@ class OC_App {
|
||||||
if($appPath !== false) {
|
if($appPath !== false) {
|
||||||
$appIcon = $appPath . '/img/' . $app . '.svg';
|
$appIcon = $appPath . '/img/' . $app . '.svg';
|
||||||
if (file_exists($appIcon)) {
|
if (file_exists($appIcon)) {
|
||||||
$info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, $app . '.svg');
|
$info['preview'] = $urlGenerator->imagePath($app, $app . '.svg');
|
||||||
$info['previewAsIcon'] = true;
|
$info['previewAsIcon'] = true;
|
||||||
} else {
|
} else {
|
||||||
$appIcon = $appPath . '/img/app.svg';
|
$appIcon = $appPath . '/img/app.svg';
|
||||||
if (file_exists($appIcon)) {
|
if (file_exists($appIcon)) {
|
||||||
$info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, 'app.svg');
|
$info['preview'] = $urlGenerator->imagePath($app, 'app.svg');
|
||||||
$info['previewAsIcon'] = true;
|
$info['previewAsIcon'] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue