Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Per the talk by Rasmus at Drupalcon, we could avoid many, many, system calls by using $_SERVER['REQUEST_TIME']; rather than calling time().
To make for a better DX, we could either create a define or a wrapper function. e.g.:
define ('R_TIME', $_SERVER['REQUEST_TIME']);
or
function r_time() {
return $_SERVER['REQUEST_TIME'];
}
Comment | File | Size | Author |
---|---|---|---|
#5 | REQUEST_TIME-305645-4.patch | 60.33 KB | pwolanin |
Comments
Comment #1
kbahey CreditAttribution: kbahey commentedThis has already been implemented in core D7 in #302763.
However, I like the idea of a function or define, just because $_SERVER['blah ... is too verbose.
Comment #2
pwolanin CreditAttribution: pwolanin commentedre-opening for discussion of a define.
Comment #3
webchickr_time is not developer-friendly. I would need to consult documentation to know what that meant.
Since we don't abbreviate things, the shortest we can really go is REQUEST_TIME. TIME isn't specific enough, I don't think.
Comment #4
webchickComment #5
pwolanin CreditAttribution: pwolanin commentedTIME would be nicest (and I don't really think anyone would be confused), but even REQUEST_TIME is far easier on the eyes and fingers than what we have now.
Ran all tests with this patch- all pass (5599 passes, 0 fails, 0 exceptions).
Comment #6
RobLoachApplied patch, visited around the site, and then re-ran all tests with 100% passes.
Comment #7
Dries CreditAttribution: Dries commentedAgreed 100%. Committed to CVS HEAD. Thanks pwolanin.
Comment #8
dropcube CreditAttribution: dropcube commentedI have updated the documentation at Converting 6.x modules to 7.x
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.