01022: Provide better timeout info for recipes & PageIndexUpdate()
Description: Various recipes and scripts work to control timeouts, particularly the ini_get("max_execution_time"). The difficulty is that because they each assume they have the whole time they can end up stepping on one another. (For instance recipe A calculates how much time it can use but doesn't take into account the fact that scripts/pagelist:PageIndexUpdate() is going to use up to 10 seconds at the end.)
My proposal is to have a core global set early on as this:
$PHP_TIMEOUT = microtime(true) + ini_get('max_execution_time');
(Perhaps if there are other timeouts these could be figured in there as well - I've heard there's an apache timeout that needs to be observed.)
Then recipes and PageIndexUpdate() could refer to this variable and compare it to microtime(true) to see how much time they have left. This will help different parts of the code work better together.
At a minimum PageIndexUpdate() should honor the actual timeout setting rather than assuming it has 10 seconds to play with...
(I understand windows and linux boxes treat this max_execution_timeout differently, but the treatment above gives the more conservative approach...)
I note that import.php has the same difficulty in that it assumes it is the only guy on the block messing with the timeout. If PageIndexUpdate() and import.php are both set with a significant task to do you are almost certainly going to get ugly timeout conditions with the current way it is implemented.