Project

General

Profile

Actions

Bug #24406

closed

error when using t3lib_TCEmain->clear_cacheCmd in frontend

Added by Krystian Szymukowicz almost 14 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Should have
Category:
Communication
Target version:
-
Start date:
2010-12-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

16832.patch (737 Bytes) 16832.patch Administrator Admin, 2010-12-25 18:58

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #25114: [Patch] Fatal error in /t3lib/class.t3lib_tcemain.php on line 6774Closed2011-02-20

Actions
Related to TYPO3 Core - Bug #28007: TCEmain::clear_cacheCmd relies on active BE_USERClosed2011-07-08

Actions
Actions #1

Updated by Steffen Gebert almost 14 years ago

Krystian, could you please provide a patch against SVN trunk and send it to the core list?

Actions #2

Updated by Krystian Szymukowicz almost 14 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.

Actions #3

Updated by Steffen Gebert almost 14 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

Actions #4

Updated by Krystian Szymukowicz almost 14 years ago

Right. - so here is the patch and I wil post in the core list in minute.

Actions #5

Updated by Krystian Szymukowicz almost 14 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.

Actions #6

Updated by Steffen Gebert almost 14 years ago

So please use the correct API in your extensions.
Bug is closed, but #16843 for EXT:comments is opened.

RFC dropped.

Actions #7

Updated by Steffen Gebert almost 14 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.

Actions #8

Updated by Nikolas Hagelstein over 13 years ago

Hmmm does not work from cli scripts as well :<

Actions #9

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.

Actions #10

Updated by Klaus Hinum about 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?

Actions

Also available in: Atom PDF