xperseguers / t3ext-cloudflare

The Cloudflare TYPO3 extension ensures your TYPO3 website is running optimally on the Cloudflare platform.
https://extensions.typo3.org/extension/cloudflare
GNU General Public License v3.0
7 stars 11 forks source link

Clear Cloudflare cache for single pages #3

Closed rickfeuerabend closed 2 months ago

rickfeuerabend commented 6 years ago

Hi,

it would be nice if the cloudflare cache for a single page could be purged. ("Clear cache for this page")

At the moment the complete page cache is purged in the function clearCloudflareCache (TCEmain.php)

Is this feature planned in the next time?

Thanks for feedback.

xperseguers commented 6 years ago

There is an option (enablePurgeSingleFile) in EM. Did you try it?

rickfeuerabend commented 6 years ago

Hi, thanks for fast answer.

Yes I tested it but: When I read your code correct then you hook into the global clear cache function in ext_localconf.php: with:

// Register additional clear_cache method
--
11 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'][] = \Causal\Cloudflare\Hooks\TCEmain::class . '->clear_cacheCmd';

In this function you check if it is requested for ALL pages if (GeneralUtility::inList('all,pages', $params['cacheCmd'])) {

or not. In the else case you are using your suggested parameter.

But it can only reach the first case because you never hook into the "Clear cache for this page" command.

Is that right?

Thanks for help and hopefully I'm wrong and it is already possible to use ;)

rickfeuerabend commented 6 years ago

Or is this $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'][] hook responsible for both cache clear ways?

xperseguers commented 6 years ago

In my tests, when I switch to Web > List and use the "clear cache for this page" button, the hook is properly invoked:

typo3_v9__typo3_cms_9_5_1-dev_
rickfeuerabend commented 6 years ago

Hm, ok exactly in this way I tested it. Then I need to debug in the code why it is not working. But again thanks for your fast help!

xperseguers commented 2 months ago

I confirm this works as expected with latest version, but the actual cache flush fails as described in #21. I'm currently working on it. Closing this ticket as that part "works" :)