[TYPO3-core] Idea for a new USER object

Martin Kutschker Martin.Kutschker at blackbox.net
Sat Nov 12 21:54:46 CET 2005


Hi!

Currently we have USER and USER_INT objects.

For semi-static plugins we have to use USER objects with cHash for the cached contents, but have to disable caching completely for the dynamic contents.

I propose therefor a new object called USER_EXT. This object may run either as USER or as USER_INT depending on it's own choice.

When it works as USER object it simply returns a string as usuasl. But if it wants to work as USER_INT it returns FALSE. We add a special config variable to its configuration, so that it knows on its next run that it has to work as USER_INT (ie from the page cache.

This should in theory speed up all pages with semi-dynamic contents as page caching is not disabled completely.

I've attached a modified version of tslib_cObj->USER that implements this idea.

Masi 
-------------- next part --------------

        function USER($conf,$ext='')    {
                $content='';
                switch($ext)    {
                        case 'EXT':
                                $c=$this->callUserFunction($conf['userFunc'],$conf,'');
					// plugin asks for caching of the content
				if (is_string($c))	{
					$content.=$c;
					break;
				}
					// plugin wants to deliver uncached content
					// (signal this fact for the next run)
				$conf['_NO_CACHE'] = 1;
				// fallthru
                        case 'INT':
                                $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
                                $content.='<!--'.$substKey.'-->';
                                $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
                                        'file' => $incFile,
                                        'conf' => $conf,
                                        'cObj' => serialize($this),
                                        'type' => 'FUNC'
                                );
                        break;
                        default:
                                $content.=$this->callUserFunction($conf['userFunc'],$conf,'');
                        break;
                }
                return $content;
        }


More information about the TYPO3-team-core mailing list