Skip to content

Commit

Permalink
feat(occ): Better handling of disabled appstore
Browse files Browse the repository at this point in the history
Signed-off-by: Git'Fellow <[email protected]>
  • Loading branch information
solracsf authored Dec 6, 2024
1 parent ad045d6 commit 24a5bfc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/Command/App/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

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;
Expand All @@ -18,8 +19,11 @@
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,
) {
Expand Down Expand Up @@ -57,6 +61,20 @@ protected function configure(): void {
}

protected function execute(InputInterface $input, OutputInterface $output): int {
$appStoreEnabled = $this->config->getSystemValueBool('appstoreenabled', true);
$internetAvailable = $this->config->getSystemValueBool('has_internet_connection', true);
$isDefaultAppStore = $this->config->getSystemValueString('appstoreurl', self::APP_STORE_URL) === self::APP_STORE_URL;

if (!$appStoreEnabled) {
$output->writeln('App store access is disabled');
return 1;
}

if (!$internetAvailable && $isDefaultAppStore) {
$output->writeln('This instance has no internet connection to access the default App store');
return 1;
}

$singleAppId = $input->getArgument('app-id');
$updateFound = false;

Expand Down

0 comments on commit 24a5bfc

Please sign in to comment.