[TYPO3-dev] scheduler_task should clear cache for one page [solved]

Helmut Hummel helmut.hummel at typo3.org
Sun Aug 28 12:26:58 CEST 2011


Hi,

On 26.08.11 13:08, Bernd Wilke wrote:
> On 08/26/2011 12:30 PM, Loek Hilgersom wrote:

>> But, strange enough,
>> that also made it stop working in scheduler tasks (which should be BE,
>> but is not entirely the same as running a BE-module, apparently).

This is wrong.

> this might depend on the new mode CLI which is not BE.
>
>> After some more searching and experimenting I found that this does work:
>>
>> $tce = t3lib_div::makeInstance('t3lib_TCEmain');
>> $tce->start('', '');

[...]

calling start() is mandatory. If it worked without it before you were 
just lucky.

> my working solution:
> 	$TCE = t3lib_div::makeInstance('t3lib_TCEmain');
> 	// this seems to initalized a BE-User
> 	$TCE->start(Array(),Array());
> 	// so this line does not throw an error any more
> 	$TCE->clear_cache('tt_news',$oneRecordId);
>
> with this I simulated one record-change
> and in combination with the Page-TSconfig:
> 	TCEMAIN.clearCacheCmd = 40

Looks strange...

If you call start() it should also work with

$TCE->clear_cache('pages',$viewPage);

if the cli user has the permission to clear the cache for pages, or you 
also add:

$TCE->admin = 1;

before calling ->clear_cache()

Kind regards,
Helmut

-- 
Helmut Hummel
TYPO3 Security Team Leader, TYPO3 v4 Core Team Member

TYPO3 .... inspiring people to share!
Get involved: typo3.org




More information about the TYPO3-dev mailing list