Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat(occ): Better handling of disabled or unreacheable App store
Signed-off-by: Git'Fellow <[email protected]>
  • Loading branch information
solracsf committed Dec 16, 2024
commit bcc9d07c1772a45567b7554fba80e84dc09b9e51
17 changes: 17 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,19 @@ protected function configure(): void {
}

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;

Expand Down
Loading