Skip to content

Commit eaf135e

Browse files
committed
Add output to packages:update command
1 parent 389f7d6 commit eaf135e

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

src/Command/PackagesUpdateCommand.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,29 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5050
return Command::FAILURE;
5151
}
5252

53+
$io->writeln("Scheduling package $packageName for update...");
54+
5355
$packages = [['id' => $package->getId()]];
5456

5557
$randomTimes = false;
5658
$reschedule = true;
5759
} elseif ($force) {
60+
$io->writeln('Scheduling all packages for update...');
5861
$packages = $this->packageRepository->getAllPackageIds();
5962

6063
$reschedule = true;
6164
} else {
62-
$packages = $this->packageRepository->getStalePackages();
65+
$io->writeln('Scheduling stale packages for update...');
66+
$packages = $this->packageRepository->getStalePackageIds();
6367
}
6468

6569
foreach ($packages as $package) {
6670
$this->messenger->dispatch(new SchedulePackageUpdate($package['id'], randomTime: $randomTimes, reschedule: $reschedule, forceRefresh: $force));
6771
}
6872

73+
$packageCount = count($packages);
74+
$io->success("Scheduled $packageCount package(s) for update.");;
75+
6976
return Command::SUCCESS;
7077
}
7178
}

src/Doctrine/Repository/PackageRepository.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,17 @@ public function findOneByName(string $name): ?Package
5757
/**
5858
* @return list<array{id: int}>
5959
*/
60-
public function getStalePackages(): array
60+
public function getAllPackageIds(): array
61+
{
62+
$connection = $this->getEntityManager()->getConnection();
63+
64+
return $connection->fetchAllAssociative('SELECT id FROM package ORDER BY id');
65+
}
66+
67+
/**
68+
* @return list<array{id: int}>
69+
*/
70+
public function getStalePackageIds(): array
6171
{
6272
$connection = $this->getEntityManager()->getConnection();
6373

@@ -75,16 +85,6 @@ public function getStalePackages(): array
7585
);
7686
}
7787

78-
/**
79-
* @return list<array{id: int}>
80-
*/
81-
public function getAllPackageIds(): array
82-
{
83-
$connection = $this->getEntityManager()->getConnection();
84-
85-
return $connection->fetchAllAssociative('SELECT id FROM package ORDER BY id');
86-
}
87-
8888
public function updatePackageLinks(int $packageId, int $versionId): void
8989
{
9090
$connection = $this->getEntityManager()->getConnection();

0 commit comments

Comments
 (0)