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

Ernesto Baschny [cron IT] ernst at cron-it.de
Thu Jul 17 09:22:15 CEST 2008


Hi Dmitry,

I have been using a similar approach inside my plugins for some years 
now (USER object that recalls itself as USER_INT when needed), and I 
would love to see that feature in TYPO3. Haven't had time to really test 
your approach, but from my first scan through the patch (nice work!), it 
looks cool!

Will put some more thinking into it when I have the time, probably next 
week.

One thought came to my mind. What about USER-plugins that convert to 
USER_INT but which are already called from inside a COA_INT for example? 
Will that work as expected? Maybe the "conversion" is not even needed then?

Cheers,
Ernesto

Dmitry Dulepov [typo3] wrote: on 16.07.2008 13:06:
> 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).
> 


More information about the TYPO3-team-core mailing list