diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-09-17 07:11:59 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-09-17 07:11:59 +0000 |
commit | 7f29b142770cba60259a22f3760e2376b8e79790 (patch) | |
tree | d9ff4c7dfb29dfafb442c2cd1f2e91b2592e63bc /modules/system | |
parent | 6f8b5f9a5baaea6874ffe050ba0210b680070140 (diff) | |
download | brdo-7f29b142770cba60259a22f3760e2376b8e79790.tar.gz brdo-7f29b142770cba60259a22f3760e2376b8e79790.tar.bz2 |
- Patch #305645 by pwolanin: ['REQUEST_TIME'] -> REQUEST_TIME. Improved developer experience.
Diffstat (limited to 'modules/system')
-rw-r--r-- | modules/system/system.admin.inc | 14 | ||||
-rw-r--r-- | modules/system/system.install | 8 | ||||
-rw-r--r-- | modules/system/system.module | 8 |
3 files changed, 15 insertions, 15 deletions
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index 1cde4be2b..1a177cfef 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -1557,13 +1557,13 @@ function system_date_time_settings() { // Date settings: construct choices for user foreach ($date_short as $f) { - $date_short_choices[$f] = format_date($_SERVER['REQUEST_TIME'], 'custom', $f); + $date_short_choices[$f] = format_date(REQUEST_TIME, 'custom', $f); } foreach ($date_medium as $f) { - $date_medium_choices[$f] = format_date($_SERVER['REQUEST_TIME'], 'custom', $f); + $date_medium_choices[$f] = format_date(REQUEST_TIME, 'custom', $f); } foreach ($date_long as $f) { - $date_long_choices[$f] = format_date($_SERVER['REQUEST_TIME'], 'custom', $f); + $date_long_choices[$f] = format_date(REQUEST_TIME, 'custom', $f); } $date_long_choices['custom'] = $date_medium_choices['custom'] = $date_short_choices['custom'] = t('Custom format'); @@ -1622,7 +1622,7 @@ function system_date_time_settings() { '#title' => t('Custom short date format'), '#attributes' => array('class' => 'custom-format'), '#default_value' => $default_short_custom, - '#description' => t('A user-defined short date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date($_SERVER['REQUEST_TIME'], 'custom', $default_short_custom))), + '#description' => t('A user-defined short date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(REQUEST_TIME, 'custom', $default_short_custom))), ); $date_format_medium = variable_get('date_format_medium', $date_medium[1]); @@ -1645,7 +1645,7 @@ function system_date_time_settings() { '#title' => t('Custom medium date format'), '#attributes' => array('class' => 'custom-format'), '#default_value' => $default_medium_custom, - '#description' => t('A user-defined medium date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date($_SERVER['REQUEST_TIME'], 'custom', $default_medium_custom))), + '#description' => t('A user-defined medium date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(REQUEST_TIME, 'custom', $default_medium_custom))), ); $date_format_long = variable_get('date_format_long', $date_long[0]); @@ -1668,7 +1668,7 @@ function system_date_time_settings() { '#title' => t('Custom long date format'), '#attributes' => array('class' => 'custom-format'), '#default_value' => $default_long_custom, - '#description' => t('A user-defined long date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date($_SERVER['REQUEST_TIME'], 'custom', $default_long_custom))), + '#description' => t('A user-defined long date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(REQUEST_TIME, 'custom', $default_long_custom))), ); $form = system_settings_form($form); @@ -1697,7 +1697,7 @@ function system_date_time_settings_submit($form, &$form_state) { * Return the date for a given format string via Ajax. */ function system_date_time_lookup() { - $result = format_date($_SERVER['REQUEST_TIME'], 'custom', $_GET['format']); + $result = format_date(REQUEST_TIME, 'custom', $_GET['format']); echo drupal_to_js($result); exit; } diff --git a/modules/system/system.install b/modules/system/system.install index af2ceab33..45a690198 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -143,10 +143,10 @@ function system_requirements($phase) { // Determine severity based on time since cron last ran. $severity = REQUIREMENT_OK; - if ($_SERVER['REQUEST_TIME'] - $cron_last > $threshold_error) { + if (REQUEST_TIME - $cron_last > $threshold_error) { $severity = REQUIREMENT_ERROR; } - else if ($never_run || ($_SERVER['REQUEST_TIME'] - $cron_last > $threshold_warning)) { + else if ($never_run || (REQUEST_TIME - $cron_last > $threshold_warning)) { $severity = REQUIREMENT_WARNING; } @@ -163,7 +163,7 @@ function system_requirements($phase) { $description = $t('Cron has not run.') . ' ' . $help; } else { - $summary = $t('Last run !time ago', array('!time' => format_interval($_SERVER['REQUEST_TIME'] - $cron_last))); + $summary = $t('Last run !time ago', array('!time' => format_interval(REQUEST_TIME - $cron_last))); $description = ''; if ($severity != REQUIREMENT_OK) { $description = $t('Cron has not run recently.') . ' ' . $help; @@ -371,7 +371,7 @@ function system_install() { // presumed to be a serialized array. Install will change uid 1 immediately // anyways. So we insert the superuser here, the uid is 2 here for now, but // very soon it will be changed to 1. - db_query("INSERT INTO {users} (name, mail, created, data) VALUES('%s', '%s', %d, '%s')", 'placeholder-for-uid-1', 'placeholder-for-uid-1', $_SERVER['REQUEST_TIME'], serialize(array())); + db_query("INSERT INTO {users} (name, mail, created, data) VALUES('%s', '%s', %d, '%s')", 'placeholder-for-uid-1', 'placeholder-for-uid-1', REQUEST_TIME, serialize(array())); // This sets the above two users uid 0 (anonymous). We avoid an explicit 0 // otherwise MySQL might insert the next auto_increment value. db_query("UPDATE {users} SET uid = uid - uid WHERE name = '%s'", ''); diff --git a/modules/system/system.module b/modules/system/system.module index 6bc1bfc46..87ad201ab 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -1397,12 +1397,12 @@ function system_get_module_admin_tasks($module) { */ function system_cron() { // Cleanup the flood. - db_query('DELETE FROM {flood} WHERE timestamp < %d', $_SERVER['REQUEST_TIME'] - 3600); + db_query('DELETE FROM {flood} WHERE timestamp < %d', REQUEST_TIME - 3600); // Cleanup the batch table. - db_query('DELETE FROM {batch} WHERE timestamp < %d', $_SERVER['REQUEST_TIME'] - 864000); + db_query('DELETE FROM {batch} WHERE timestamp < %d', REQUEST_TIME - 864000); // Remove temporary files that are older than DRUPAL_MAXIMUM_TEMP_FILE_AGE. - $result = db_query('SELECT * FROM {files} WHERE status = %d and timestamp < %d', FILE_STATUS_TEMPORARY, $_SERVER['REQUEST_TIME'] - DRUPAL_MAXIMUM_TEMP_FILE_AGE); + $result = db_query('SELECT * FROM {files} WHERE status = %d and timestamp < %d', FILE_STATUS_TEMPORARY, REQUEST_TIME - DRUPAL_MAXIMUM_TEMP_FILE_AGE); while ($file = db_fetch_object($result)) { if (file_exists($file->filepath)) { // If files that exist cannot be deleted, continue so the database remains @@ -2033,7 +2033,7 @@ function system_block_ip_action() { * Generate an array of time zones and their local time&date. */ function _system_zonelist() { - $timestamp = $_SERVER['REQUEST_TIME']; + $timestamp = REQUEST_TIME; $zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14); $zones = array(); foreach ($zonelist as $offset) { |