Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Inject TYPO3's client into sub-command #478

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
$subCommandInput = $this->initializeSubCommandInput($subCommand, $input);
$subCommandInput->setInteractive(false);

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

Check warning on line 197 in Classes/Command/WarmupCommand.php

View check run for this annotation

Codecov / codecov/patch

Classes/Command/WarmupCommand.php#L195-L197

Added lines #L195 - L197 were not covered by tests
}

$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