Skip to content

Commit

Permalink
Merge pull request #478 from eliashaeussler/fix/0.5/typo3-client
Browse files Browse the repository at this point in the history
[BUGFIX] Inject TYPO3's client into sub-command
  • Loading branch information
eliashaeussler committed Oct 10, 2023
2 parents c2b67ab + 9c084c9 commit 36bad75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Classes/Command/WarmupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use EliasHaeussler\Typo3Warming\Exception\UnsupportedSiteException;
use EliasHaeussler\Typo3Warming\Service\CacheWarmupService;
use EliasHaeussler\Typo3Warming\Sitemap\SitemapLocator;
use Psr\Http\Client\ClientInterface;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
Expand All @@ -37,6 +38,7 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Http\Client\GuzzleClientFactory;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
Expand Down Expand Up @@ -189,6 +191,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$subCommandInput = $this->initializeSubCommandInput($subCommand, $input);
$subCommandInput->setInteractive(false);

// Inject client
$client = GuzzleClientFactory::getClient();
if ($client instanceof ClientInterface) {
$subCommand->setClient($client);
}

$output->writeln('Running <info>cache warmup</info> by <info>Elias Häußler</info> and contributors.');

// Run cache warmup in sub command from eliashaeussler/cache-warmup
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"eliashaeussler/cache-warmup": ">= 0.5.0. < 1.0.0",
"guzzlehttp/guzzle": "^6.3 || ^7.0",
"guzzlehttp/psr7": "^1.4 || ^2.0",
"psr/http-client": "^1.0",
"psr/http-message": "^1.0",
"psr/log": "^1.0",
"symfony/console": "^4.4 || ^5.4 || ^6.0",
Expand Down

0 comments on commit 36bad75

Please sign in to comment.