aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-12-06 19:25:32 +0100
committerGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-12-16 15:23:54 +0100
commitbcc9d07c1772a45567b7554fba80e84dc09b9e51 (patch)
treecc5ec55d9adbed15a7192de50fe3c906942d358f
parentad045d6ede511d15da045e64cc0ee988fd945a9f (diff)
downloadnextcloud-server-appStoreDisabledOcc.tar.gz
nextcloud-server-appStoreDisabledOcc.zip
feat(occ): Better handling of disabled or unreacheable App storeappStoreDisabledOcc
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
-rw-r--r--core/Command/App/Update.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php
index b2d02e222de..259c26013f7 100644
--- a/core/Command/App/Update.php
+++ b/core/Command/App/Update.php
@@ -10,6 +10,7 @@ namespace OC\Core\Command\App;
use OC\Installer;
use OCP\App\IAppManager;
+use OCP\IConfig;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@@ -18,8 +19,11 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Update extends Command {
+ public const APP_STORE_URL = 'https://apps.nextcloud.com/api/v1';
+
public function __construct(
protected IAppManager $manager,
+ protected IConfig $config,
private Installer $installer,
private LoggerInterface $logger,
) {
@@ -57,6 +61,19 @@ class Update extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
+ $appStoreEnabled = $this->config->getSystemValueBool('appstoreenabled', true);
+ if ($appStoreEnabled === false) {
+ $output->writeln('App store access is disabled');
+ return 1;
+ }
+
+ $internetAvailable = $this->config->getSystemValueBool('has_internet_connection', true);
+ $isDefaultAppStore = $this->config->getSystemValueString('appstoreurl', self::APP_STORE_URL) === self::APP_STORE_URL;
+ if ($internetAvailable === false && $isDefaultAppStore === true) {
+ $output->writeln('Internet connection is disabled, and therefore the default public App store is not reachable');
+ return 1;
+ }
+
$singleAppId = $input->getArgument('app-id');
$updateFound = false;