|
12 | 12 | use OC\Installer; |
13 | 13 | use OCP\App\AppPathNotFoundException; |
14 | 14 | use OCP\App\IAppManager; |
| 15 | +use OCP\IConfig; |
15 | 16 | use Psr\Log\LoggerInterface; |
16 | 17 | use Symfony\Component\Console\Command\Command; |
17 | 18 | use Symfony\Component\Console\Input\InputArgument; |
|
20 | 21 | use Symfony\Component\Console\Output\OutputInterface; |
21 | 22 |
|
22 | 23 | class Update extends Command { |
| 24 | + public const APP_STORE_URL = 'https://apps.nextcloud.com/api/v1'; |
| 25 | + |
23 | 26 | public function __construct( |
24 | 27 | protected IAppManager $manager, |
| 28 | + protected IConfig $config, |
25 | 29 | private Installer $installer, |
26 | 30 | private LoggerInterface $logger, |
27 | 31 | ) { |
@@ -67,6 +71,19 @@ protected function configure(): void { |
67 | 71 |
|
68 | 72 | #[\Override] |
69 | 73 | protected function execute(InputInterface $input, OutputInterface $output): int { |
| 74 | + $appStoreEnabled = $this->config->getSystemValueBool('appstoreenabled', true); |
| 75 | + if ($appStoreEnabled === false) { |
| 76 | + $output->writeln('App store access is disabled'); |
| 77 | + return 1; |
| 78 | + } |
| 79 | + |
| 80 | + $internetAvailable = $this->config->getSystemValueBool('has_internet_connection', true); |
| 81 | + $isDefaultAppStore = $this->config->getSystemValueString('appstoreurl', self::APP_STORE_URL) === self::APP_STORE_URL; |
| 82 | + if ($internetAvailable === false && $isDefaultAppStore === true) { |
| 83 | + $output->writeln('Internet connection is disabled, and therefore the default public App store is not reachable'); |
| 84 | + return 1; |
| 85 | + } |
| 86 | + |
70 | 87 | $singleAppId = $input->getArgument('app-id'); |
71 | 88 | $updateFound = false; |
72 | 89 | $showOnly = $input->getOption('showonly') || $input->getOption('showcurrent'); |
|
0 commit comments