Search code examples
cachinghooktypo3flush

typo3 flush cache additional action


How can I add a task to Typo3's "Clear all caches"-action?

I have written a frontend plugin with its own XML-file based caching system and I want to give the administrators the possibility to flush this cache by using the standard buttons.

Is there a possibility to register p.e. user_extension_pi1->flushAll() to system's caching mechanism?


Solution

  • You need to use hook for that.

    In ext_localconf.php write:

    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'][] = 'EXT:yourext/class.tx_yourext_hooks.php:tx_yourext_hooks->clearCachePostProc';
    

    Then in the class.tx_yourext_hooks.php create class tx_yourext_hooks with function clearCachePostProc

    function clearCachePostProc(&$params, &$pObj) {
    

    Debug $params to see what parameters you can use inside this function.