diff --git a/Classes/CacheManager.php b/Classes/CacheManager.php index 89fa65d..fa4162c 100644 --- a/Classes/CacheManager.php +++ b/Classes/CacheManager.php @@ -2,6 +2,7 @@ namespace Macopedia\CachePurger; +use CurlHandle; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -14,14 +15,12 @@ use function curl_getinfo; use function curl_init; use function curl_multi_add_handle; -use function curl_multi_close; use function curl_multi_exec; use function curl_multi_init; use function curl_multi_remove_handle; use function curl_multi_select; use function curl_setopt; use function is_array; -use function is_resource; use const CURLM_CALL_MULTI_PERFORM; use const CURLM_OK; use const CURLOPT_CUSTOMREQUEST; @@ -71,14 +70,10 @@ public function execute(): void $multiHandle = curl_multi_init(); - if (!is_resource($multiHandle)) { - return; - } - foreach ($this->settings['varnish.'] as $varnishInstance) { foreach ($this->clearQueue as $tag) { $ch = $this->getCurlHandleForCacheClearingAsTag($tag, $varnishInstance); - if (!is_resource($ch)) { + if (!$ch) { continue; } $curlHandles[] = $ch; @@ -87,7 +82,6 @@ public function execute(): void } if (count($curlHandles) === 0) { - curl_multi_close($multiHandle); return; } @@ -113,10 +107,6 @@ public function execute(): void } foreach ($curlHandles as $ch) { - if (!is_resource($ch)) { - continue; - } - if (curl_errno($ch) !== 0) { $this->logger->error('error: ' . curl_error($ch)); } else { @@ -127,8 +117,6 @@ public function execute(): void curl_close($ch); } - curl_multi_close($multiHandle); - $this->clearQueue = []; } @@ -162,7 +150,7 @@ public function clearCache(?string $cmd): void /** * @param string $tag * @param string $varnishUrl - * @return false|resource + * @return false|CurlHandle */ protected function getCurlHandleForCacheClearingAsTag(string $tag, string $varnishUrl) { @@ -172,7 +160,7 @@ protected function getCurlHandleForCacheClearingAsTag(string $tag, string $varni /** * @param string $varnishUrl * @param string $header - * @return false|resource + * @return false|CurlHandle */ protected function createCurlHandle(string $varnishUrl, string $header, string $method = 'BAN') { diff --git a/README.md b/README.md index d43df9a..91f6a81 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# CachePurger for Varnish +# CachePurger for Varnish - supports clear per page or all pages -- supports TYPO3 9.5-10.4 -- requires php >= 7.4 +- supports TYPO3 >= 11.5 +- requires php >= 8.1 # Example configuration in Typoscript ``` diff --git a/composer.json b/composer.json index 74163c6..41e266c 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license": ["GPL-2.0+"], "keywords": ["TYPO3 CMS", "Purge"], "require": { - "typo3/cms-core": "^9.5 || ^10.4 || ^11.5" + "typo3/cms-core": "^11.5" }, "autoload": { "psr-4": { diff --git a/ext_emconf.php b/ext_emconf.php index 03a8596..6f51999 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -4,12 +4,12 @@ 'title' => 'Cache Purger', 'description' => 'Purge cached URLs within Varnish instances', 'category' => 'misc', - 'version' => '1.0.5', + 'version' => '2.0.0', 'state' => 'stable', 'clearCacheOnLoad' => 0, 'constraints' => [ 'depends' => [ - 'typo3' => '9.5.0-11.5.99', + 'typo3' => '11.5.0-11.5.99', ], 'conflicts' => [], 'suggests' => [],