Skip to content

Commit b92abe1

Browse files
feat(updatenotification): clearer update:check output + refactor to use attribute
Signed-off-by: Josh <josh.t.richards@gmail.com>
1 parent 1219c8e commit b92abe1

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

apps/updatenotification/lib/Command/Check.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@
1111
use OC\App\AppManager;
1212
use OC\Installer;
1313
use OCA\UpdateNotification\UpdateChecker;
14+
use Symfony\Component\Console\Attribute\AsCommand;
1415
use Symfony\Component\Console\Command\Command;
1516
use Symfony\Component\Console\Input\InputInterface;
1617
use Symfony\Component\Console\Output\OutputInterface;
1718

19+
#[AsCommand(
20+
name: 'update:check',
21+
description: 'Check for server and app updates',
22+
help: 'Checks for the availability of updates for server and all enabled apps.'
23+
)]
1824
class Check extends Command {
1925

2026
public function __construct(
@@ -25,24 +31,16 @@ public function __construct(
2531
parent::__construct();
2632
}
2733

28-
protected function configure(): void {
29-
$this
30-
->setName('update:check')
31-
->setDescription('Check for server and app updates')
32-
;
33-
}
34-
3534
protected function execute(InputInterface $input, OutputInterface $output): int {
3635
$updatesAvailableCount = 0;
3736

3837
// Server
3938
$r = $this->updateChecker->getUpdateState();
4039
if (isset($r['updateAvailable']) && $r['updateAvailable']) {
41-
$output->writeln($r['updateVersionString'] . ' is available. Get more information on how to update at ' . $r['updateLink'] . '.');
40+
$output->writeln('Update for server to version ' . $r['updateVersionString'] . ' is available. Get more information on how to update at ' . $r['updateLink'] . '.');
4241
$updatesAvailableCount += 1;
4342
}
4443

45-
4644
// Apps
4745
$apps = $this->appManager->getEnabledApps();
4846
foreach ($apps as $app) {

0 commit comments

Comments
 (0)