[TYPO3-core] RFC #8985: Enable USER object to become USER_INT on the fly
Dmitry Dulepov [typo3]
dmitry at typo3.org
Wed Jul 16 13:06:28 CEST 2008
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
More about TYPO3: http://typo3bloke.net/
Subscribe: http://typo3bloke.net/rss.xml
Latest article: http://typo3bloke.net/post-details/how_to_fill_realurl_cache/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 8985_user2int.diff
Type: text/x-diff
Size: 3898 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080716/b610a2ee/attachment-0001.diff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: T3X_user_user2int-0_0_0-z-200807161348.t3x
Type: application/octet-stream
Size: 30062 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080716/b610a2ee/attachment-0001.obj
More information about the TYPO3-team-core
mailing list