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

Dmitry Dulepov [typo3] dmitry at typo3.org
Tue Aug 12 15:45:50 CEST 2008


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).
> 


-- 
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/post-details/typo3_code_formatting_in_eclipse/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 8985_user2int_current.diff
Type: text/x-diff
Size: 4302 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080812/c7d89e00/attachment-0001.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: T3X_user_user2int-0_2_0-z-200808121640.t3x
Type: application/octet-stream
Size: 30080 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080812/c7d89e00/attachment-0001.obj 


More information about the TYPO3-team-core mailing list