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

Loek Hilgersom loek at netcoop.nl
Fri Aug 26 12:30:02 CEST 2011


Hi Bernd,

I had a similar problem with my mail2news extension, but I used clear_cacheCmd. 
Until TYPO3 4.4 it worked like this:

	function clearpagecache($pid_list) {
		$tce = t3lib_div::makeInstance('t3lib_TCEmain');
		$pid_array = explode(',', $pid_list);
		foreach ($pid_array as $pid) {
			$tce->clear_cacheCmd($pid);
		}
	}

but in 4.5 something was changed in the clear_cacheCmd methods, which no longer 
allowed these to be used in FE-plugins [1]. 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).

After some more searching and experimenting I found that this does work:

	function clearpagecache($pid_list) {
		$tce = t3lib_div::makeInstance('t3lib_TCEmain');
		$tce->start('', '');
		$pid_array = explode(',', $pid_list);
		foreach ($pid_array as $pid) {
			$tce->clear_cacheCmd($pid);
		}
	}

Hth,
Loek


[1] http://bugs.typo3.org/view.php?id=17683 and related bugs


On 08/26/2011 11:57 AM, Bernd Wilke wrote:
> On 08/26/2011 11:24 AM, Kay Strobach wrote:
>> Hi guys,
>>
>> I think you need an be user to achieve that - don't you ?!
>>
> scheduler is running (needed) BE-User '_cli_scheduler'.
> Any task started by scheduler have this user?
> it seems: no :-(
>
> bernd




More information about the TYPO3-dev mailing list