aimeos / ai-typo3

TYPO3 adapter for Aimeos web shops and e-commerce solutions
https://aimeos.org/TYPO3
GNU Lesser General Public License v3.0
72 stars 6 forks source link

[Feature] Cache deactivation through shift-reload #10

Closed s-diez closed 5 years ago

s-diez commented 5 years ago

TYPO3 has a mechanism which allows to temporarily deactivate the frontend cache if a backend user is logged in and the page is requested with a no-cache Header, for example through shift-reload.

From https://github.com/TYPO3/TYPO3.CMS/blob/36994dd3cc28ecca23b42a62d33ae08b54261c3b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php#L2465-L2471

    /**
     * Detecting if shift-reload has been clicked
     * Will not be called if re-generation of page happens by other reasons (for instance that the page is not in cache yet!)
     * Also, a backend user MUST be logged in for the shift-reload to be detected due to DoS-attack-security reasons.
     *
     * @return bool If shift-reload in client browser has been clicked, disable getting cached page (and regenerate it).
     */
    public function headerNoCache()

For Development it would be nice, if Aimeos would check this aswell. I thought about something like the following snippet in \Aimeos\Aimeos\Base\Context::addCache:

$cacheName = \Aimeos\Aimeos\Base::getExtConfig( 'cacheName', 'Typo3' );
if ($GLOBALS['TSFE'] && $GLOBALS['TSFE']->headerNoCache()) {
    $cacheName = 'None';
}

I can make a pull request if the snippet above would be accepted.

aimeos commented 5 years ago

Yes, please provide a PR

s-diez commented 5 years ago

I just realized, this is the wrong repository. See https://github.com/aimeos/aimeos-typo3/pull/101