diff options
author | Dries Buytaert <dries@buytaert.net> | 2011-02-19 13:24:32 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2011-02-19 13:24:32 +0000 |
commit | 3e914018def1d59501a65857eb923f60f72afb79 (patch) | |
tree | 716b6ff31c592968001896a8acd9aed37c267015 /includes/bootstrap.inc | |
parent | 570dcc57529acce8d6ced538af003afd140538fe (diff) | |
download | brdo-3e914018def1d59501a65857eb923f60f72afb79.tar.gz brdo-3e914018def1d59501a65857eb923f60f72afb79.tar.bz2 |
- Patch #880278 by RoboPhred: cleanup _locale_import_read_po().
Diffstat (limited to 'includes/bootstrap.inc')
-rw-r--r-- | includes/bootstrap.inc | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 0739332a4..a8ef38a5b 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -1136,6 +1136,7 @@ function drupal_serve_page_from_cache(stdClass $cache) { $etag = '"' . $cache->created . '-' . intval($return_compressed) . '"'; header('Etag: ' . $etag); + drupal_set_configured_timezone(); // See if the client has provided the required HTTP headers. $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : FALSE; $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : FALSE; @@ -1943,9 +1944,26 @@ function drupal_get_user_timezone() { return $user->timezone; } else { - // Ignore PHP strict notice if time zone has not yet been set in the php.ini - // configuration. - return variable_get('date_default_timezone', @date_default_timezone_get()); + // Note that is no site-wide timezone is set, and date.timezone is not set + // in php.ini, then calling date functions will cause a system call and + // PHP will issue an E_STRICT or E_WARNING error depending on PHP version. + // @todo: consider always setting the date_default_timezone variable from + // the installer. + return variable_get('date_default_timezone'); + } +} + +/** + * Set the timezone for a request when configured. + */ +function drupal_set_configured_timezone() { + $configured_timezone = drupal_get_user_timezone(); + $system_timezone = ini_get('date.timezone'); + // There is no point setting the timezone if it is configured the same + // as date.timezone in php.ini. Also date_default_timezone_set() validates + // the timezone, which relies on a system call to get the timezone database. + if ($configured_timezone != $system_timezone) { + date_default_timezone_set($configured_timezone); } } @@ -2046,7 +2064,6 @@ function _drupal_bootstrap_page_cache() { // Restore the metadata cached with the page. $_GET['q'] = $cache->data['path']; drupal_set_title($cache->data['title'], PASS_THROUGH); - date_default_timezone_set(drupal_get_user_timezone()); // If the skipping of the bootstrap hooks is not enforced, call // hook_boot. if (variable_get('page_cache_invoke_hooks', TRUE)) { |