[TYPO3-core] RFC #11430: Use $_SERVER['REQUEST_TIME'] instead of time() where it makes sense

Michael Stucki michael at typo3.org
Sun Jun 28 18:05:21 CEST 2009


Hi Niels,

I did not yet test your patch but have two comments already:

1. SIM_EXEC_TIME is used for simulating a different time, e.g. in  the 
Frontend using the admin panel (preview => simulate time...). I do not 
think that there is a use of overriding this time key within the 
backend, however in case that it ever might happen, I would recommend 
using EXEC_TIME instead, which is the original time. For everything 
except the frontend rendering, I would say that this is always the value 
which we expect to get here.

2. Please add a fallback in case $_SERVER['REQUEST_TIME'] is not set 
(just fall back to time()).

- michael

Niels Pardon schrieb:
> This is an SVN patch request.
> 
> Type: New feature/Code cleanup
> 
> Bugtracker references:
> http://bugs.typo3.org/view.php?id=11430
> 
> Branches:
> trunk
> 
> Problem:
> There are a lot calls to time() spread all over the core. According to
> [1] calls to time() are expensive and should be avoided if possible. [1]
> suggests to use $_SERVER['REQUEST_TIME'] instead.
> 
> Solution:
> Use $_SERVER['REQUEST_TIME'] in config_default.php to set
> $GLOBALS['EXEC_TIME'] and use $GLOBALS['SIM_EXEC_TIME'] in the other
> places in the core.
> 
> Notes:
> I left out 3rd party libraries like OpenID or AdoDB.
> 
> [1] http://ilia.ws/files/phptek2007_performance.pdf
> 
> 


-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/


More information about the TYPO3-team-core mailing list