diff options
Diffstat (limited to 'apps/settings/lib/Controller/AppSettingsController.php')
-rw-r--r-- | apps/settings/lib/Controller/AppSettingsController.php | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index f40a8024b6d..7dbbaca1a45 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -149,9 +149,9 @@ class AppSettingsController extends Controller { private function getAppsWithUpdates() { $appClass = new \OC_App(); $apps = $appClass->listAllApps(); - foreach($apps as $key => $app) { + foreach ($apps as $key => $app) { $newVersion = $this->installer->isUpdateAvailable($app['id']); - if($newVersion === false) { + if ($newVersion === false) { unset($apps[$key]); } } @@ -169,7 +169,6 @@ class AppSettingsController extends Controller { ]; } return $result; - } /** @@ -186,7 +185,7 @@ class AppSettingsController extends Controller { $formattedCategories = []; $categories = $this->categoryFetcher->get(); - foreach($categories as $category) { + foreach ($categories as $category) { $formattedCategories[] = [ 'id' => $category['id'], 'ident' => $category['id'], @@ -217,10 +216,10 @@ class AppSettingsController extends Controller { // add bundle information $bundles = $this->bundleFetcher->getBundles(); - foreach($bundles as $bundle) { - foreach($bundle->getAppIdentifiers() as $identifier) { - foreach($this->allApps as &$app) { - if($app['id'] === $identifier) { + foreach ($bundles as $bundle) { + foreach ($bundle->getAppIdentifiers() as $identifier) { + foreach ($this->allApps as &$app) { + if ($app['id'] === $identifier) { $app['bundleIds'][] = $bundle->getIdentifier(); continue; } @@ -240,7 +239,6 @@ class AppSettingsController extends Controller { * @throws \Exception */ public function listApps(): JSONResponse { - $this->fetchApps(); $apps = $this->getAllApps(); @@ -255,7 +253,7 @@ class AppSettingsController extends Controller { } $newVersion = $this->installer->isUpdateAvailable($appData['id']); - if($newVersion) { + if ($newVersion) { $appData['update'] = $newVersion; } @@ -307,16 +305,16 @@ class AppSettingsController extends Controller { $versionParser = new VersionParser(); $formattedApps = []; $apps = $this->appFetcher->get(); - foreach($apps as $app) { + foreach ($apps as $app) { // Skip all apps not in the requested category if ($requestedCategory !== '') { $isInCategory = false; - foreach($app['categories'] as $category) { - if($category === $requestedCategory) { + foreach ($app['categories'] as $category) { + if ($category === $requestedCategory) { $isInCategory = true; } } - if(!$isInCategory) { + if (!$isInCategory) { continue; } } @@ -326,28 +324,28 @@ class AppSettingsController extends Controller { } $nextCloudVersion = $versionParser->getVersion($app['releases'][0]['rawPlatformVersionSpec']); $nextCloudVersionDependencies = []; - if($nextCloudVersion->getMinimumVersion() !== '') { + if ($nextCloudVersion->getMinimumVersion() !== '') { $nextCloudVersionDependencies['nextcloud']['@attributes']['min-version'] = $nextCloudVersion->getMinimumVersion(); } - if($nextCloudVersion->getMaximumVersion() !== '') { + if ($nextCloudVersion->getMaximumVersion() !== '') { $nextCloudVersionDependencies['nextcloud']['@attributes']['max-version'] = $nextCloudVersion->getMaximumVersion(); } $phpVersion = $versionParser->getVersion($app['releases'][0]['rawPhpVersionSpec']); $existsLocally = \OC_App::getAppPath($app['id']) !== false; $phpDependencies = []; - if($phpVersion->getMinimumVersion() !== '') { + if ($phpVersion->getMinimumVersion() !== '') { $phpDependencies['php']['@attributes']['min-version'] = $phpVersion->getMinimumVersion(); } - if($phpVersion->getMaximumVersion() !== '') { + if ($phpVersion->getMaximumVersion() !== '') { $phpDependencies['php']['@attributes']['max-version'] = $phpVersion->getMaximumVersion(); } - if(isset($app['releases'][0]['minIntSize'])) { + if (isset($app['releases'][0]['minIntSize'])) { $phpDependencies['php']['@attributes']['min-int-size'] = $app['releases'][0]['minIntSize']; } $authors = ''; - foreach($app['authors'] as $key => $author) { + foreach ($app['authors'] as $key => $author) { $authors .= $author['name']; - if($key !== count($app['authors']) - 1) { + if ($key !== count($app['authors']) - 1) { $authors .= ', '; } } @@ -355,12 +353,12 @@ class AppSettingsController extends Controller { $currentLanguage = substr(\OC::$server->getL10NFactory()->findLanguage(), 0, 2); $enabledValue = $this->config->getAppValue($app['id'], 'enabled', 'no'); $groups = null; - if($enabledValue !== 'no' && $enabledValue !== 'yes') { + if ($enabledValue !== 'no' && $enabledValue !== 'yes') { $groups = $enabledValue; } $currentVersion = ''; - if($this->appManager->isInstalled($app['id'])) { + if ($this->appManager->isInstalled($app['id'])) { $currentVersion = $this->appManager->getAppVersion($app['id']); } else { $currentLanguage = $app['releases'][0]['version']; @@ -442,7 +440,7 @@ class AppSettingsController extends Controller { $installer = \OC::$server->query(Installer::class); $isDownloaded = $installer->isDownloaded($appId); - if(!$isDownloaded) { + if (!$isDownloaded) { $installer->downloadApp($appId); } @@ -458,7 +456,6 @@ class AppSettingsController extends Controller { } } return new JSONResponse(['data' => ['update_required' => $updateRequired]]); - } catch (\Exception $e) { $this->logger->logException($e); return new JSONResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_INTERNAL_SERVER_ERROR); @@ -515,7 +512,7 @@ class AppSettingsController extends Controller { public function uninstallApp(string $appId): JSONResponse { $appId = OC_App::cleanAppId($appId); $result = $this->installer->removeApp($appId); - if($result !== false) { + if ($result !== false) { $this->appManager->clearAppsCache(); return new JSONResponse(['data' => ['appid' => $appId]]); } @@ -558,5 +555,4 @@ class AppSettingsController extends Controller { $this->appManager->ignoreNextcloudRequirementForApp($appId); return new JSONResponse(); } - } |