Bug #24406
closederror when using t3lib_TCEmain->clear_cacheCmd in frontend
0%
Description
PROBLEM:
in rev. 8481 there has been added writelog when clearing the cache.
public function clear_cacheCmd($cacheCmd) {
$this->BE_USER->writelog(..........
But some extesions like Dmitry Dulepov 'comments' are using 'clear_cacheCmd' from frontend where $this->BE_USER is not initialised.
So we get:
Fatal error: Call to a member function writelog() on a non-object in T:\workspace-typo3\typo3\typo3_src-svn-trunk\t3lib\class.t3lib_tcemain.php on line 6761
SOLUTION:
Check if we are in BE mode while writing the log.
if (TYPO3_MODE === 'BE') {
$this->BE_USER->writelog(....
}
(issue imported from #M16832)
Files
Updated by Steffen Gebert over 13 years ago
Krystian, could you please provide a patch against SVN trunk and send it to the core list?
Updated by Krystian Szymukowicz over 13 years ago
Sure - I am waiting becasue I thought that Steffan Kamper wants to make some wrapper for frontend cache clearing.
But if the above is still a valid solution then I will prepare the patch.
Updated by Steffen Gebert over 13 years ago
Ah, okay.. however I wonder, when Steffen wants to do this (AFAIK he's on holiday soon) and we already have feature freeze.. so I would expect the wrapper for 4.6
Updated by Krystian Szymukowicz over 13 years ago
Right. - so here is the patch and I wil post in the core list in minute.
Updated by Krystian Szymukowicz over 13 years ago
At core list Steffen Kamper found out that there are special functions for clearing the cache in the frontend so using t3lib_TCEmain for this is not quite proper.
This is a bug of extension "comments" then not the core and this bug can be closed.
Post of Steffen Kamper:
------------------------------------------------------------------------------------------
i investigated this issue, and it's nonsense to call tcemain from FE as
this is not intended to do so.
Clearing cache in FE is possible as it's built in. The only senseful is
clearing page cache, configuration cache or rte cache is not allowed
from FE context.
To clear cahce in FE there are two functions available:
$GLOBALS['TSFE']->clearPageCacheContent() <= clears all page cache
$GLOBALS['TSFE']->clearPageCacheContent_pidList($pidList) <= clears
cache of pages for given uid's
So this is all what is needed for FE. For own cache using cache
framework there are the built in functions from cache framework.
Updated by Steffen Gebert over 13 years ago
So please use the correct API in your extensions.
Bug is closed, but #16843 for EXT:comments is opened.
RFC dropped.
Updated by Steffen Gebert over 13 years ago
Just a note: That's not true:
$GLOBALS['TSFE']->clearPageCacheContent() <= clears all page cache
It only clears the cache of this particular page, also dependent on the allowed FE user groups.
Updated by Nikolas Hagelstein over 13 years ago
Hmmm does not work from cli scripts as well :<
Updated by Nikolas Hagelstein over 13 years ago
Nikolas Hagelstein wrote:
Hmmm does not work from cli scripts as well :<
Forget about this comment i just forgot to call the start method.
Updated by Klaus Hinum almost 13 years ago
Nikolas Hagelstein wrote:
Nikolas Hagelstein wrote:
Hmmm does not work from cli scripts as well :<
Forget about this comment i just forgot to call the start method.
My CLI script also won't work any more with clear_cacheCmd($cacheCmd) and exits with the error from this bug report. How to clear the cache for a specific page now using CLI?