diff options
author | Dries Buytaert <dries@buytaert.net> | 2011-02-19 16:59:43 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2011-02-19 16:59:43 +0000 |
commit | 9c44a600456dd50c845eb4d3fd8ba547d46b0960 (patch) | |
tree | f3de85592d91582ae90caaee003776ff7116b724 | |
parent | e06aca78ece17aa3d1e301b3455de0d5f9ca79f7 (diff) | |
download | brdo-9c44a600456dd50c845eb4d3fd8ba547d46b0960.tar.gz brdo-9c44a600456dd50c845eb4d3fd8ba547d46b0960.tar.bz2 |
- Rollback of accidentical commit #1064882.
-rw-r--r-- | includes/bootstrap.inc | 25 | ||||
-rw-r--r-- | includes/session.inc | 4 | ||||
-rw-r--r-- | modules/simpletest/tests/common.test | 4 |
3 files changed, 8 insertions, 25 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index a8ef38a5b..0739332a4 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -1136,7 +1136,6 @@ 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; @@ -1944,26 +1943,9 @@ function drupal_get_user_timezone() { return $user->timezone; } else { - // 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); + // 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()); } } @@ -2064,6 +2046,7 @@ 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)) { diff --git a/includes/session.inc b/includes/session.inc index 478079b4f..23af6bd64 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -259,7 +259,7 @@ function drupal_session_initialize() { // a user becomes authenticated. session_id(drupal_hash_base64(uniqid(mt_rand(), TRUE))); } - drupal_set_configured_timezone(); + date_default_timezone_set(drupal_get_user_timezone()); } /** @@ -387,7 +387,7 @@ function drupal_session_regenerate() { drupal_session_start(); $user = $account; } - drupal_set_configured_timezone(); + date_default_timezone_set(drupal_get_user_timezone()); } /** diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 52a8a7fe2..f48497559 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -2226,7 +2226,7 @@ class FormatDateUnitTest extends DrupalWebTestCase { $real_language = $language->language; $language->language = $user->language; // Simulate a Drupal bootstrap with the logged-in user. - drupal_set_configured_timezone(); + date_default_timezone_set(drupal_get_user_timezone()); $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', t('Test a different language.')); $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London'), 'Monday, 26-Mar-07 01:00:00 BST', t('Test a different time zone.')); @@ -2240,7 +2240,7 @@ class FormatDateUnitTest extends DrupalWebTestCase { $user = $real_user; $language->language = $real_language; // Restore default time zone. - drupal_set_configured_timezone(); + date_default_timezone_set(drupal_get_user_timezone()); drupal_save_session(TRUE); } } |