Refactor dependencies in setAppTypes

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
pull/8411/head
Morris Jobke 8 years ago
parent 9dc3b04802
commit 2e15c0d871
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
  1. 14
      lib/private/legacy/app.php

@ -303,8 +303,9 @@ class OC_App {
/**
* read app types from info.xml and cache them in the database
*/
public static function setAppTypes($app) {
$appData = self::getAppInfo($app);
public static function setAppTypes(string $app) {
$appManager = \OC::$server->getAppManager();
$appData = $appManager->getAppInfo($app);
if(!is_array($appData)) {
return;
}
@ -316,12 +317,13 @@ class OC_App {
$appData['types'] = [];
}
\OC::$server->getConfig()->setAppValue($app, 'types', $appTypes);
$config = \OC::$server->getConfig();
$config->setAppValue($app, 'types', $appTypes);
if (\OC::$server->getAppManager()->hasProtectedAppType($appData['types'])) {
$enabled = \OC::$server->getConfig()->getAppValue($app, 'enabled', 'yes');
if ($appManager->hasProtectedAppType($appData['types'])) {
$enabled = $config->getAppValue($app, 'enabled', 'yes');
if ($enabled !== 'yes' && $enabled !== 'no') {
\OC::$server->getConfig()->setAppValue($app, 'enabled', 'yes');
$config->setAppValue($app, 'enabled', 'yes');
}
}
}

Loading…
Cancel
Save