[TYPO3-core] RFC #8985: Enable USER object to become USER_INT on the fly

Christian Kuhn lolli at schwarzbu.ch
Mon Aug 18 19:05:10 CEST 2008


Hi Dmitry.


Dmitry Dulepov [typo3] wrote:
> This is a reminder. I also attach the patch and the test extension again 
> (current version).
> 
> Dmitry Dulepov [typo3] wrote:
>> Hi!
>>
>> This is SVN patch request.
>>
>> Type: feature
>>
>> Branches: trunk
>>
>> BT reference: http://bugs.typo3.org/view.php?id=8985
>>
>> Problem: some extension (for example, tt_news) have an option to 
>> disallow caching. At the moment they simply call $TSFE->set_no_cache() 
>> disabling cache for the whole page. This has huge performance impact 
>> (as we all know). Just imagine such plugin on every page of web site 
>> ("latest news"). TYPO3 so far did not provide any way for plugins to 
>> make them non-cachable on the fly. Objects can be set to USER_INT 
>> through TS but object itself will not have any idea in what mode it 
>> runs (this is important sometimes).
>>
>> Solution: allow to switch from USER to USER_INT on the fly. Add two 
>> new methods and two public constants to tslib_cObj for this. Here is 
>> how easy extension can convert itself to USER_INT after applying this 
>> patch to core:
>> ==========================
>> if ($this->cObj->getUserObjType() == tslib_cObj::OT_USER) {
>>    $content = 'I am running as USER object now.';
>>    if (!$this->conf['allowCaching']) {
>>        $this->cObj->convertToUSER_INT();
>>        return '';
>>    }
>> }
>> else {
>>    $content .= 'I am running as USER_INT right now';
>> }
>> ==========================
>> The only requirements for extension are:
>> - check what mode they use right now (USER or USER_INT) before proceed 
>> with further work
>> - have "includeLibs" in TS setup (it is required for any USER_INT object)
>>
>> Next objects can be declared as USER and run normally. If admin sets 
>> allowCaching to 0 in TS, TYPO3 will clear cache and USER object will 
>> know it has to convert itself to USER_INT.
>>
>> The solution was cooking for some time and I think it is good. I also 
>> attach test extension here. It should be inserted on page and its TS 
>> added to main TS setup. Next you can experiment with plugin on the 
>> page. It will tell you what to do ;) It will show you current mode and 
>> proof that it runs as USER or USER_INT.
>>
>> getUserObjType() returns OT_USER or OT_USER_INT if called from the 
>> USER or USER_INT object. Otherwise it will return false.
>>
>> Possible question: how does it affect per-object caching idea? In no 
>> way. This is different from per object caching.
>>
>> Before this patch gets in, I'd like at least two +1s by *testing*. +1s 
>> by reading is not enough because the feature is complex (relates to 
>> caching).


+1 on testing.

Thanks especially for this excellent test extension!

For testers: Make sure in your template to "Include static (from 
extension)": Conversion (user_user2int).

Regards
Christian


More information about the TYPO3-team-core mailing list