|
10 | 10 |
|
11 | 11 | use OC\Installer; |
12 | 12 | use OCP\App\IAppManager; |
| 13 | +use OCP\IConfig; |
13 | 14 | use Psr\Log\LoggerInterface; |
14 | 15 | use Symfony\Component\Console\Command\Command; |
15 | 16 | use Symfony\Component\Console\Input\InputArgument; |
|
18 | 19 | use Symfony\Component\Console\Output\OutputInterface; |
19 | 20 |
|
20 | 21 | class Update extends Command { |
| 22 | + public const APP_STORE_URL = 'https://apps.nextcloud.com/api/v1'; |
| 23 | + |
21 | 24 | public function __construct( |
22 | 25 | protected IAppManager $manager, |
| 26 | + protected IConfig $config, |
23 | 27 | private Installer $installer, |
24 | 28 | private LoggerInterface $logger, |
25 | 29 | ) { |
@@ -57,6 +61,20 @@ protected function configure(): void { |
57 | 61 | } |
58 | 62 |
|
59 | 63 | protected function execute(InputInterface $input, OutputInterface $output): int { |
| 64 | + $appStoreEnabled = $this->config->getSystemValueBool('appstoreenabled', true); |
| 65 | + $internetAvailable = $this->config->getSystemValueBool('has_internet_connection', true); |
| 66 | + $isDefaultAppStore = $this->config->getSystemValueString('appstoreurl', self::APP_STORE_URL) === self::APP_STORE_URL; |
| 67 | + |
| 68 | + if (!$appStoreEnabled) { |
| 69 | + $output->writeln('App store access is disabled'); |
| 70 | + return 1; |
| 71 | + } |
| 72 | + |
| 73 | + if (!$internetAvailable && $isDefaultAppStore) { |
| 74 | + $output->writeln('This instance has no internet connection to access the default App store'); |
| 75 | + return 1; |
| 76 | + } |
| 77 | + |
60 | 78 | $singleAppId = $input->getArgument('app-id'); |
61 | 79 | $updateFound = false; |
62 | 80 |
|
|
0 commit comments