[TYPO3-dev] enableDomainLookup in RealURL

Dmitry Dulepov dmitry at typo3.org
Tue Dec 19 08:48:03 CET 2006


Hi!

Jeff Segars wrote:
> Thanks for the followup Dimitry! Didn't mean to sound like I was 
> bringing up a new or unfixed issue with the documentation...I was just 
> slow in finding it :)

It's ok :)

> The code between lines 1290 and 1305 in class.tx_realurl.php is part of 
> the decodeSpURL_decodeCache() function so it appears that this only 
> comes into play when looking up a URL that is already cached.

Not really. RealURL always tries to fetch entry from cache first. So, it 
always calls decodeSpURL_decodeCache() to see if entry is there.

decodeSpURL_decodeCache() checks if it runs in multidomain environment 
and, if true, checks if valid rootpage_id is present for current domain. 
If not, it finds it (those lines that I point to). Then it attempts to 
fetch entry from cache.

If cached information is found, realurl skips real resolving and returns 
cached information. Otherwise it calls decodeSpURL_doDecode() to do real 
resolving and then calls decodeSpURL_decodeCache() to store decoded 
information.

So, rootpage_id in multidomain environment works but only if decode 
cache is enabled, which should be always true for production environment 
due to performance reasons.

> The issue 
>  I'm having is when accessing a page before its URL has been cached at 
> all. I guess I was expecting to see similar code in 
> tx_realurl_advanced->pagePathtoID() or 
> tx_realurl->decodeSpURL_idFromPath() ... anywhere that is part of the 
> initial decoding from an uncached pagepath to an ID.  Instead, it looks 
> like the pagepath decoding relies on the rootpage_id.

Yes, it does, but decodeSpURL_decodeCache() should be already called 
befpre that and set rootpage_id if necessary.

> Is there any domain lookup when pagepaths have not been cached, and if 
> not, is it something worth adding in the future?

I think the only thing worth to change is to enable domain lookups to 
work regardless of caching.

I think your problem happens due to another reason: you may be logged in 
to BE. In such case all caches are automatically disabled, so 
rootpage_id resolution will not work.

And even more, I do not recommend to use that automatic resolution 
because it is extra query to each request to realurl and there can be 
several such request during single page generation. So performance will 
be less than it could be if you enter rootpage_id manually.

> Thanks again for your help :)
It's a pleasure! ;)

-- 
Dmitry Dulepov

Web: http://typo3bloke.net/
Skype: callto:liels_bugs

"It is our choices, that show what we truly are,
far more than our abilities." (A.P.W.B.D.)




More information about the TYPO3-dev mailing list