Index: modules/statistics/statistics.module =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.module,v retrieving revision 1.280 diff -u -r1.280 statistics.module --- modules/statistics/statistics.module 21 Aug 2008 19:36:38 -0000 1.280 +++ modules/statistics/statistics.module 6 Sep 2008 04:10:18 -0000 @@ -55,7 +55,7 @@ 'daycount' => 1, 'totalcount' => 1, 'nid' => arg(1), - 'timestamp' => time(), + 'timestamp' => drupal_time(), ); db_merge('node_counter') ->fields($fields) @@ -68,13 +68,13 @@ // Log this page access. db_insert('accesslog')->fields(array( 'title' => strip_tags(drupal_get_title()), - 'path' => $_GET['q'], - 'url' => referer_uri(), - 'hostname' => ip_address(), - 'uid' => $user->uid, - 'sid' => session_id(), - 'timer' => timer_read('page'), - 'timestamp' => time(), + 'path' => $_GET['q'], + 'url' => referer_uri(), + 'hostname' => ip_address(), + 'uid' => $user->uid, + 'sid' => session_id(), + 'timer' => timer_read('page'), + 'timestamp' => drupal_time(), ))->execute(); } } @@ -188,14 +188,14 @@ function statistics_cron() { $statistics_timestamp = variable_get('statistics_day_timestamp', ''); - if ((time() - $statistics_timestamp) >= 86400) { + if ((drupal_time() - $statistics_timestamp) >= 86400) { // Reset day counts. db_query('UPDATE {node_counter} SET daycount = 0'); - variable_set('statistics_day_timestamp', time()); + variable_set('statistics_day_timestamp', drupal_time()); } // Clean up expired access logs. - db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get('statistics_flush_accesslog_timer', 259200)); + db_query('DELETE FROM {accesslog} WHERE timestamp < %d', drupal_time() - variable_get('statistics_flush_accesslog_timer', 259200)); } /** Index: modules/statistics/statistics.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.admin.inc,v retrieving revision 1.9 diff -u -r1.9 statistics.admin.inc --- modules/statistics/statistics.admin.inc 21 Aug 2008 19:36:38 -0000 1.9 +++ modules/statistics/statistics.admin.inc 6 Sep 2008 04:10:18 -0000 @@ -122,7 +122,7 @@ $rows = array(); while ($referrer = db_fetch_object($result)) { - $rows[] = array($referrer->hits, _statistics_link($referrer->url), t('@time ago', array('@time' => format_interval(time() - $referrer->last)))); + $rows[] = array($referrer->hits, _statistics_link($referrer->url), t('@time ago', array('@time' => format_interval(drupal_time() - $referrer->last)))); } if (empty($rows)) { Index: modules/statistics/statistics.test =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.test,v retrieving revision 1.2 diff -u -r1.2 statistics.test --- modules/statistics/statistics.test 10 May 2008 07:32:02 -0000 1.2 +++ modules/statistics/statistics.test 6 Sep 2008 04:10:18 -0000 @@ -23,7 +23,7 @@ $this->blocking_user = $this->drupalCreateUser(array('block IP addresses', 'access statistics')); // Insert dummy access by anonymous user into access log. - db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", 'test', 'node/1', 'http://example.com', '192.168.1.1', '0', '10', '10', time()); + db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", 'test', 'node/1', 'http://example.com', '192.168.1.1', '0', '10', '10', drupal_time()); } /** Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.973 diff -u -r1.973 node.module --- modules/node/node.module 31 Aug 2008 15:50:35 -0000 1.973 +++ modules/node/node.module 6 Sep 2008 04:10:18 -0000 @@ -13,7 +13,7 @@ * Nodes changed after this time may be marked new, updated, or read, depending * on their state for the current user. Defaults to 30 days ago. */ -define('NODE_NEW_LIMIT', time() - 30 * 24 * 60 * 60); +define('NODE_NEW_LIMIT', drupal_time() - 30 * 24 * 60 * 60); /** * Node is being built before being viewed normally. @@ -188,10 +188,10 @@ if ($user->uid) { if (node_last_viewed($nid)) { - db_query('UPDATE {history} SET timestamp = %d WHERE uid = %d AND nid = %d', time(), $user->uid, $nid); + db_query('UPDATE {history} SET timestamp = %d WHERE uid = %d AND nid = %d', drupal_time(), $user->uid, $nid); } else { - @db_query('INSERT INTO {history} (uid, nid, timestamp) VALUES (%d, %d, %d)', $user->uid, $nid, time()); + @db_query('INSERT INTO {history} (uid, nid, timestamp) VALUES (%d, %d, %d)', $user->uid, $nid, drupal_time()); } } } @@ -880,7 +880,7 @@ $node->uid = 0; } } - $node->created = !empty($node->date) ? strtotime($node->date) : time(); + $node->created = !empty($node->date) ? strtotime($node->date) : drupal_time(); $node->validated = TRUE; return $node; @@ -932,12 +932,12 @@ // Set some required fields: if (empty($node->created)) { - $node->created = time(); + $node->created = drupal_time(); } // The changed timestamp is always updated for bookkeeping purposes (revisions, searching, ...) - $node->changed = time(); + $node->changed = drupal_time(); - $node->timestamp = time(); + $node->timestamp = drupal_time(); $node->format = isset($node->format) ? $node->format : FILTER_FORMAT_DEFAULT; $update_node = TRUE; @@ -1221,7 +1221,7 @@ return t('Content'); case 'reset': - db_query("UPDATE {search_dataset} SET reindex = %d WHERE type = 'node'", time()); + db_query("UPDATE {search_dataset} SET reindex = %d WHERE type = 'node'", drupal_time()); return; case 'status': Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.34 diff -u -r1.34 node.pages.inc --- modules/node/node.pages.inc 31 Aug 2008 09:15:12 -0000 1.34 +++ modules/node/node.pages.inc 6 Sep 2008 04:10:18 -0000 @@ -80,7 +80,7 @@ } global $user; $node->uid = $user->uid; - $node->created = time(); + $node->created = drupal_time(); } else { $node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O'); @@ -361,7 +361,7 @@ $node->picture = $user->picture; } - $node->changed = time(); + $node->changed = drupal_time(); // Extract a teaser, if it hasn't been set (e.g. by a module-provided // 'teaser' form item). Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.224 diff -u -r1.224 filter.module --- modules/filter/filter.module 5 Sep 2008 09:25:52 -0000 1.224 +++ modules/filter/filter.module 6 Sep 2008 04:10:18 -0000 @@ -446,7 +446,7 @@ // Store in cache with a minimum expiration time of 1 day. if ($cache) { - cache_set($cache_id, $text, 'cache_filter', time() + (60 * 60 * 24)); + cache_set($cache_id, $text, 'cache_filter', drupal_time() + (60 * 60 * 24)); } } else { Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.129 diff -u -r1.129 file.inc --- includes/file.inc 5 Sep 2008 09:25:51 -0000 1.129 +++ includes/file.inc 6 Sep 2008 04:10:18 -0000 @@ -613,7 +613,7 @@ // If we made it this far it's safe to record this file in the database. $file->uid = $user->uid; $file->status = FILE_STATUS_TEMPORARY; - $file->timestamp = time(); + $file->timestamp = drupal_time(); drupal_write_record('files', $file); // Add file to the cache. Index: includes/cache.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/cache.inc,v retrieving revision 1.21 diff -u -r1.21 cache.inc --- includes/cache.inc 21 Aug 2008 19:36:36 -0000 1.21 +++ includes/cache.inc 6 Sep 2008 04:10:17 -0000 @@ -17,7 +17,7 @@ // Garbage collection necessary when enforcing a minimum cache lifetime $cache_flush = variable_get('cache_flush', 0); - if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= time())) { + if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= drupal_time())) { // Reset the variable immediately to prevent a meltdown in heavy load situations. variable_set('cache_flush', 0); // Time to flush old cache data @@ -101,7 +101,7 @@ function cache_set($cid, $data, $table = 'cache', $expire = CACHE_PERMANENT, $headers = NULL) { $fields = array( 'serialized' => 0, - 'created' => time(), + 'created' => drupal_time(), 'expire' => $expire, 'headers' => $headers, ); @@ -152,23 +152,23 @@ // will be saved into the sessions table by sess_write(). We then // simulate that the cache was flushed for this user by not returning // cached data that was cached before the timestamp. - $user->cache = time(); + $user->cache = drupal_time(); $cache_flush = variable_get('cache_flush', 0); if ($cache_flush == 0) { // This is the first request to clear the cache, start a timer. - variable_set('cache_flush', time()); + variable_set('cache_flush', drupal_time()); } - else if (time() > ($cache_flush + variable_get('cache_lifetime', 0))) { + else if (drupal_time() > ($cache_flush + variable_get('cache_lifetime', 0))) { // Clear the cache for everyone, cache_flush_delay seconds have // passed since the first request to clear the cache. - db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); + db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, drupal_time()); variable_set('cache_flush', 0); } } else { // No minimum cache lifetime, flush all temporary cache entries now. - db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); + db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, drupal_time()); } } else { @@ -185,4 +185,3 @@ } } } - Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.788 diff -u -r1.788 common.inc --- includes/common.inc 21 Aug 2008 19:36:36 -0000 1.788 +++ includes/common.inc 6 Sep 2008 04:10:18 -0000 @@ -873,7 +873,7 @@ * The name of an event. */ function flood_register_event($name) { - db_query("INSERT INTO {flood} (event, hostname, timestamp) VALUES ('%s', '%s', %d)", $name, ip_address(), time()); + db_query("INSERT INTO {flood} (event, hostname, timestamp) VALUES ('%s', '%s', %d)", $name, ip_address(), drupal_time()); } /** @@ -890,7 +890,7 @@ * True if the user did not exceed the hourly threshold. False otherwise. */ function flood_is_allowed($name, $threshold) { - $number = db_result(db_query("SELECT COUNT(*) FROM {flood} WHERE event = '%s' AND hostname = '%s' AND timestamp > %d", $name, ip_address(), time() - 3600)); + $number = db_result(db_query("SELECT COUNT(*) FROM {flood} WHERE event = '%s' AND hostname = '%s' AND timestamp > %d", $name, ip_address(), drupal_time() - 3600)); return ($number < $threshold ? TRUE : FALSE); } @@ -2074,7 +2074,7 @@ // browser-caching. The string changes on every update or full cache // flush, forcing browsers to load a new copy of the files, as the // URL changed. Files that should not be cached (see drupal_add_js()) - // get time() as query-string instead, to enforce reload on every + // get drupal_time() as query-string instead, to enforce reload on every // page request. $query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1); @@ -2101,7 +2101,7 @@ // Additionally, go through any remaining scripts if JS preprocessing is on and output the non-cached ones. foreach ($data as $path => $info) { if (!$info['preprocess'] || !$is_writable || !$preprocess_js) { - $no_preprocess[$type] .= '\n"; + $no_preprocess[$type] .= '\n"; } else { $files[$path] = $info; @@ -2553,7 +2553,7 @@ $semaphore = variable_get('cron_semaphore', FALSE); if ($semaphore) { - if (time() - $semaphore > 3600) { + if (drupal_time() - $semaphore > 3600) { // Either cron has been running for more than an hour or the semaphore // was not reset due to a database error. watchdog('cron', 'Cron has been running for more than an hour and is most likely stuck.', array(), WATCHDOG_ERROR); @@ -2571,13 +2571,13 @@ register_shutdown_function('drupal_cron_cleanup'); // Lock cron semaphore - variable_set('cron_semaphore', time()); + variable_set('cron_semaphore', drupal_time()); // Iterate through the modules calling their cron handlers (if any): module_invoke_all('cron'); // Record cron time - variable_set('cron_last', time()); + variable_set('cron_last', drupal_time()); watchdog('cron', 'Cron run completed.', array(), WATCHDOG_NOTICE); // Release cron semaphore Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.220 diff -u -r1.220 bootstrap.inc --- includes/bootstrap.inc 21 Aug 2008 19:36:36 -0000 1.220 +++ includes/bootstrap.inc 6 Sep 2008 04:10:17 -0000 @@ -717,6 +717,13 @@ } /** + * Return the timestamp of the start of the request. + */ +function drupal_time() { + return isset($_SERVER['REQUEST_TIME']) ? $_SERVER['REQUEST_TIME'] : $_SERVER['REQUEST_TIME'] = time(); +} + +/** * Encode special characters in a plain-text string for display as HTML. * * Uses drupal_validate_utf8 to prevent cross site scripting attacks on @@ -827,7 +834,7 @@ 'request_uri' => $base_root . request_uri(), 'referer' => referer_uri(), 'ip' => ip_address(), - 'timestamp' => time(), + 'timestamp' => drupal_time(), ); // Call the logging hooks to log/process the message Index: includes/session.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/session.inc,v retrieving revision 1.53 diff -u -r1.53 session.inc --- includes/session.inc 31 Aug 2008 12:50:45 -0000 1.53 +++ includes/session.inc 6 Sep 2008 04:10:18 -0000 @@ -73,17 +73,17 @@ // and gives more useful statistics. We can't eliminate anonymous session // table rows without breaking "Who's Online" block. if ($user->uid || $value || count($_COOKIE)) { - db_query("INSERT INTO {sessions} (sid, uid, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $user->uid, isset($user->cache) ? $user->cache : 0, ip_address(), $value, time()); + db_query("INSERT INTO {sessions} (sid, uid, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $user->uid, isset($user->cache) ? $user->cache : 0, ip_address(), $value, drupal_time()); } } else { - db_query("UPDATE {sessions} SET uid = %d, cache = %d, hostname = '%s', session = '%s', timestamp = %d WHERE sid = '%s'", $user->uid, isset($user->cache) ? $user->cache : 0, ip_address(), $value, time(), $key); + db_query("UPDATE {sessions} SET uid = %d, cache = %d, hostname = '%s', session = '%s', timestamp = %d WHERE sid = '%s'", $user->uid, isset($user->cache) ? $user->cache : 0, ip_address(), $value, drupal_time(), $key); if (db_affected_rows()) { // Last access time is updated no more frequently than once every 180 seconds. // This reduces contention in the users table. - if ($user->uid && time() - $user->access > variable_get('session_write_interval', 180)) { - db_query("UPDATE {users} SET access = %d WHERE uid = %d", time(), $user->uid); + if ($user->uid && drupal_time() - $user->access > variable_get('session_write_interval', 180)) { + db_query("UPDATE {users} SET access = %d WHERE uid = %d", drupal_time(), $user->uid); } } } @@ -143,7 +143,7 @@ // for three weeks before deleting them, you need to set gc_maxlifetime // to '1814400'. At that value, only after a user doesn't log in after // three weeks (1814400 seconds) will his/her session be removed. - db_query("DELETE FROM {sessions} WHERE timestamp < %d", time() - $lifetime); + db_query("DELETE FROM {sessions} WHERE timestamp < %d", drupal_time() - $lifetime); return TRUE; } Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.281 diff -u -r1.281 form.inc --- includes/form.inc 17 Aug 2008 11:08:23 -0000 1.281 +++ includes/form.inc 6 Sep 2008 04:10:18 -0000 @@ -235,9 +235,9 @@ // 6 hours cache life time for forms should be plenty. $expire = 21600; - cache_set('form_' . $form_build_id, $form, 'cache_form', time() + $expire); + cache_set('form_' . $form_build_id, $form, 'cache_form', drupal_time() + $expire); if (!empty($form_state['storage'])) { - cache_set('storage_' . $form_build_id, $form_state['storage'], 'cache_form', time() + $expire); + cache_set('storage_' . $form_build_id, $form_state['storage'], 'cache_form', drupal_time() + $expire); } } @@ -1645,9 +1645,9 @@ function form_process_date($element) { // Default to current date if (empty($element['#value'])) { - $element['#value'] = array('day' => format_date(time(), 'custom', 'j'), - 'month' => format_date(time(), 'custom', 'n'), - 'year' => format_date(time(), 'custom', 'Y')); + $element['#value'] = array('day' => format_date(drupal_time(), 'custom', 'j'), + 'month' => format_date(drupal_time(), 'custom', 'n'), + 'year' => format_date(drupal_time(), 'custom', 'Y')); } $element['#tree'] = TRUE; @@ -2483,7 +2483,7 @@ // Initiate db storage in order to get a batch id. We have to provide // at least an empty string for the (not null) 'token' column. - db_query("INSERT INTO {batch} (token, timestamp) VALUES ('', %d)", time()); + db_query("INSERT INTO {batch} (token, timestamp) VALUES ('', %d)", drupal_time()); $batch['id'] = db_last_insert_id('batch', 'bid'); // Now that we have a batch id, we can generate the redirection link in Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.461 diff -u -r1.461 forum.module --- modules/forum/forum.module 11 Aug 2008 21:57:40 -0000 1.461 +++ modules/forum/forum.module 6 Sep 2008 04:10:18 -0000 @@ -908,7 +908,7 @@ */ function template_preprocess_forum_submitted(&$variables) { $variables['author'] = isset($variables['topic']->uid) ? theme('username', $variables['topic']) : ''; - $variables['time'] = isset($variables['topic']->timestamp) ? format_interval(time() - $variables['topic']->timestamp) : ''; + $variables['time'] = isset($variables['topic']->timestamp) ? format_interval(drupal_time() - $variables['topic']->timestamp) : ''; } function _forum_user_last_visit($nid) { Index: modules/update/update.fetch.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.fetch.inc,v retrieving revision 1.9 diff -u -r1.9 update.fetch.inc --- modules/update/update.fetch.inc 14 Apr 2008 17:48:43 -0000 1.9 +++ modules/update/update.fetch.inc 6 Sep 2008 04:10:18 -0000 @@ -52,8 +52,8 @@ } if (!empty($available) && is_array($available)) { $frequency = variable_get('update_check_frequency', 1); - cache_set('update_info', $available, 'cache_update', time() + (60 * 60 * 24 * $frequency)); - variable_set('update_last_check', time()); + cache_set('update_info', $available, 'cache_update', drupal_time() + (60 * 60 * 24 * $frequency)); + variable_set('update_last_check', drupal_time()); watchdog('update', 'Fetched information about all available new releases and updates.', array(), WATCHDOG_NOTICE, l(t('view'), 'admin/reports/updates')); } else { Index: modules/update/update.compare.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.compare.inc,v retrieving revision 1.11 diff -u -r1.11 update.compare.inc --- modules/update/update.compare.inc 28 Aug 2008 08:12:28 -0000 1.11 +++ modules/update/update.compare.inc 6 Sep 2008 04:10:18 -0000 @@ -30,7 +30,7 @@ _update_process_info_list($projects, module_rebuild_cache(), 'module'); _update_process_info_list($projects, system_theme_data(), 'theme'); // Set the projects array into the cache table. - cache_set('update_project_projects', $projects, 'cache_update', time() + 3600); + cache_set('update_project_projects', $projects, 'cache_update', drupal_time() + 3600); } } return $projects; @@ -551,7 +551,7 @@ drupal_alter('update_status', $projects); // Set the projects array into the cache table. - cache_set('update_project_data', $projects, 'cache_update', time() + 3600); + cache_set('update_project_data', $projects, 'cache_update', drupal_time() + 3600); return $projects; } @@ -588,7 +588,7 @@ } else { $cache = cache_get($cid, 'cache_update'); - if (!empty($cache->data) && $cache->expire > time()) { + if (!empty($cache->data) && $cache->expire > drupal_time()) { $projects = $cache->data; } } Index: modules/update/update.report.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.report.inc,v retrieving revision 1.13 diff -u -r1.13 update.report.inc --- modules/update/update.report.inc 28 Aug 2008 08:12:29 -0000 1.13 +++ modules/update/update.report.inc 6 Sep 2008 04:10:18 -0000 @@ -27,7 +27,7 @@ */ function theme_update_report($data) { $last = variable_get('update_last_check', 0); - $output = '
' . ($last ? t('Last checked: @time ago', array('@time' => format_interval(time() - $last))) : t('Last checked: never')); + $output = '
' . ($last ? t('Last checked: @time ago', array('@time' => format_interval(drupal_time() - $last))) : t('Last checked: never')); $output .= ' (' . l(t('Check manually'), 'admin/reports/updates/check') . ')'; $output .= "
\n"; Index: modules/update/update.module =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.module,v retrieving revision 1.21 diff -u -r1.21 update.module --- modules/update/update.module 22 Aug 2008 12:30:19 -0000 1.21 +++ modules/update/update.module 6 Sep 2008 04:10:18 -0000 @@ -276,7 +276,7 @@ function update_cron() { $frequency = variable_get('update_check_frequency', 1); $interval = 60 * 60 * 24 * $frequency; - if (time() - variable_get('update_last_check', 0) > $interval) { + if (drupal_time() - variable_get('update_last_check', 0) > $interval) { update_refresh(); _update_cron_notify(); } @@ -342,7 +342,7 @@ } } if (!$needs_refresh && ($cache = cache_get('update_info', 'cache_update')) - && $cache->expire > time()) { + && $cache->expire > drupal_time()) { $available = $cache->data; } elseif ($needs_refresh || $refresh) { Index: modules/aggregator/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v retrieving revision 1.390 diff -u -r1.390 aggregator.module --- modules/aggregator/aggregator.module 3 Sep 2008 19:25:08 -0000 1.390 +++ modules/aggregator/aggregator.module 6 Sep 2008 04:10:18 -0000 @@ -281,7 +281,7 @@ * Checks news feeds for updates once their refresh interval has elapsed. */ function aggregator_cron() { - $result = db_query('SELECT * FROM {aggregator_feed} WHERE checked + refresh < %d', time()); + $result = db_query('SELECT * FROM {aggregator_feed} WHERE checked + refresh < %d', drupal_time()); while ($feed = db_fetch_array($result)) { aggregator_refresh($feed); } @@ -592,7 +592,7 @@ // Process HTTP response code. switch ($result->code) { case 304: - db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', time(), $feed['fid']); + db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', drupal_time(), $feed['fid']); drupal_set_message(t('There is no new syndicated content from %site.', array('%site' => $feed['title']))); break; case 301: @@ -606,7 +606,7 @@ // data. If both are equal we say that feed is not updated. $md5 = md5($result->data); if ($feed['hash'] == $md5) { - db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', time(), $feed['fid']); + db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', drupal_time(), $feed['fid']); drupal_set_message(t('There is no new syndicated content from %site.', array('%site' => $feed['title']))); break; } @@ -636,7 +636,7 @@ $etag = empty($result->headers['ETag']) ? '' : $result->headers['ETag']; // Update the feed data. - db_query("UPDATE {aggregator_feed} SET url = '%s', checked = %d, link = '%s', description = '%s', image = '%s', hash = '%s', etag = '%s', modified = %d WHERE fid = %d", $feed['url'], time(), $channel['LINK'], $channel['DESCRIPTION'], $image, $md5, $etag, $modified, $feed['fid']); + db_query("UPDATE {aggregator_feed} SET url = '%s', checked = %d, link = '%s', description = '%s', image = '%s', hash = '%s', etag = '%s', modified = %d WHERE fid = %d", $feed['url'], drupal_time(), $channel['LINK'], $channel['DESCRIPTION'], $image, $md5, $etag, $modified, $feed['fid']); // Clear the cache. cache_clear_all(); @@ -803,14 +803,14 @@ } if (!$timestamp) { - $timestamp = isset($entry->timestamp) ? $entry->timestamp : time(); + $timestamp = isset($entry->timestamp) ? $entry->timestamp : drupal_time(); } $item += array('AUTHOR' => '', 'DESCRIPTION' => ''); aggregator_save_item(array('iid' => (isset($entry->iid) ? $entry->iid : ''), 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => $item['AUTHOR'], 'description' => $item['DESCRIPTION'], 'guid' => $guid)); } // Remove all items that are older than flush item timer. - $age = time() - variable_get('aggregator_clear', 9676800); + $age = drupal_time() - variable_get('aggregator_clear', 9676800); $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d AND timestamp < %d', $feed['fid'], $age); $items = array(); Index: modules/aggregator/aggregator.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.pages.inc,v retrieving revision 1.16 diff -u -r1.16 aggregator.pages.inc --- modules/aggregator/aggregator.pages.inc 16 Aug 2008 21:13:32 -0000 1.16 +++ modules/aggregator/aggregator.pages.inc 6 Sep 2008 04:10:18 -0000 @@ -265,7 +265,7 @@ $variables['source_title'] = check_plain($item->ftitle); } if (date('Ymd', $item->timestamp) == date('Ymd')) { - $variables['source_date'] = t('%ago ago', array('%ago' => format_interval(time() - $item->timestamp))); + $variables['source_date'] = t('%ago ago', array('%ago' => format_interval(drupal_time() - $item->timestamp))); } else { $variables['source_date'] = format_date($item->timestamp, 'custom', variable_get('date_format_medium', 'D, m/d/Y - H:i')); @@ -462,7 +462,7 @@ $variables['feed_url'] = check_url($item->link); $variables['feed_title'] = check_plain($item->title); - $variables['feed_age'] = t('%age old', array('%age' => format_interval(time() - $item->timestamp))); + $variables['feed_age'] = t('%age old', array('%age' => format_interval(drupal_time() - $item->timestamp))); $variables['source_url'] = ''; $variables['source_title'] = ''; @@ -486,7 +486,7 @@ $variables['source_url'] = check_url(url($feed->link, array('absolute' => TRUE))); if ($feed->checked) { - $variables['last_checked'] = t('@time ago', array('@time' => format_interval(time() - $feed->checked))); + $variables['last_checked'] = t('@time ago', array('@time' => format_interval(drupal_time() - $feed->checked))); } else { $variables['last_checked'] = t('never'); Index: modules/aggregator/aggregator.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.admin.inc,v retrieving revision 1.14 diff -u -r1.14 aggregator.admin.inc --- modules/aggregator/aggregator.admin.inc 16 Aug 2008 14:48:17 -0000 1.14 +++ modules/aggregator/aggregator.admin.inc 6 Sep 2008 04:10:18 -0000 @@ -27,7 +27,7 @@ $header = array(t('Title'), t('Items'), t('Last update'), t('Next update'), array('data' => t('Operations'), 'colspan' => '3')); $rows = array(); while ($feed = db_fetch_object($result)) { - $rows[] = array(l($feed->title, "aggregator/sources/$feed->fid"), format_plural($feed->items, '1 item', '@count items'), ($feed->checked ? t('@time ago', array('@time' => format_interval(time() - $feed->checked))) : t('never')), ($feed->checked ? t('%time left', array('%time' => format_interval($feed->checked + $feed->refresh - time()))) : t('never')), l(t('edit'), "admin/content/aggregator/edit/feed/$feed->fid"), l(t('remove items'), "admin/content/aggregator/remove/$feed->fid"), l(t('update items'), "admin/content/aggregator/update/$feed->fid")); + $rows[] = array(l($feed->title, "aggregator/sources/$feed->fid"), format_plural($feed->items, '1 item', '@count items'), ($feed->checked ? t('@time ago', array('@time' => format_interval(drupal_time() - $feed->checked))) : t('never')), ($feed->checked ? t('%time left', array('%time' => format_interval($feed->checked + $feed->refresh - drupal_time()))) : t('never')), l(t('edit'), "admin/content/aggregator/edit/feed/$feed->fid"), l(t('remove items'), "admin/content/aggregator/remove/$feed->fid"), l(t('update items'), "admin/content/aggregator/update/$feed->fid")); } $output .= theme('table', $header, $rows); Index: modules/search/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.module,v retrieving revision 1.263 diff -u -r1.263 search.module --- modules/search/search.module 21 Aug 2008 19:36:38 -0000 1.263 +++ modules/search/search.module 6 Sep 2008 04:10:18 -0000 @@ -570,8 +570,8 @@ // Insert results into search index foreach ($results[0] as $word => $score) { - // If a word already exists in the database, its score gets increased - // appropriately. If not, we create a new record with the appropriate + // If a word already exists in the database, its score gets increased + // appropriately. If not, we create a new record with the appropriate // starting score. db_merge('search_index')->key(array( 'word' => $word, @@ -622,7 +622,7 @@ * The nid of the node that needs reindexing. */ function search_touch_node($nid) { - db_query("UPDATE {search_dataset} SET reindex = %d WHERE sid = %d AND type = 'node'", time(), $nid); + db_query("UPDATE {search_dataset} SET reindex = %d WHERE sid = %d AND type = 'node'", drupal_time(), $nid); } /** Index: modules/search/search.test =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.test,v retrieving revision 1.6 diff -u -r1.6 search.test --- modules/search/search.test 5 Jun 2008 21:55:45 -0000 1.6 +++ modules/search/search.test 6 Sep 2008 04:10:18 -0000 @@ -236,7 +236,7 @@ $settings['body'] .= " really rocks"; break; case 'recent': - $settings['created'] = time() + 3600; + $settings['created'] = drupal_time() + 3600; break; case 'comments': $settings['comment'] = 2; Index: modules/simpletest/tests/session.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/session.test,v retrieving revision 1.1 diff -u -r1.1 session.test --- modules/simpletest/tests/session.test 16 Aug 2008 21:11:02 -0000 1.1 +++ modules/simpletest/tests/session.test 6 Sep 2008 04:10:18 -0000 @@ -113,7 +113,7 @@ $this->assertEqual($authenticated, $this->session_count_authenticated, t('Correctly counted @count authenticated sessions.', array('@count' => $authenticated)), t('Session')); // Should return 0 sessions from 1 second from now. - $this->assertEqual(sess_count(time() + 1), 0, t('Correctly returned 0 sessions newer than the current time.'), t('Session')); + $this->assertEqual(sess_count(drupal_time() + 1), 0, t('Correctly returned 0 sessions newer than the current time.'), t('Session')); } Index: modules/simpletest/tests/xmlrpc.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/xmlrpc.test,v retrieving revision 1.1 diff -u -r1.1 xmlrpc.test --- modules/simpletest/tests/xmlrpc.test 9 Aug 2008 12:41:22 -0000 1.1 +++ modules/simpletest/tests/xmlrpc.test 6 Sep 2008 04:10:18 -0000 @@ -66,7 +66,7 @@ $bool_5 = (($int_5 % 2) == 0); $string_5 = $this->randomName(); $double_5 = (double)(mt_rand(-1000,1000) / 100); - $time_5 = time(); + $time_5 = drupal_time(); $base64_5 = $this->randomName(100); $l_res_5 = xmlrpc_test_manyTypesTest($int_5, $bool_5, $string_5, $double_5, xmlrpc_date($time_5), $base64_5); $l_res_5[5] = $l_res_5[5]->data; /* override warpping */ Index: modules/blogapi/blogapi.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.module,v retrieving revision 1.122 diff -u -r1.122 blogapi.module --- modules/blogapi/blogapi.module 5 Sep 2008 09:25:51 -0000 1.122 +++ modules/blogapi/blogapi.module 6 Sep 2008 04:10:18 -0000 @@ -218,7 +218,7 @@ } if (user_access('administer nodes') && !isset($edit['date'])) { - $edit['date'] = format_date(time(), 'custom', 'Y-m-d H:i:s O'); + $edit['date'] = format_date(drupal_time(), 'custom', 'Y-m-d H:i:s O'); } node_invoke_nodeapi($edit, 'blogapi new'); Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.647 diff -u -r1.647 comment.module --- modules/comment/comment.module 21 Aug 2008 19:36:36 -0000 1.647 +++ modules/comment/comment.module 6 Sep 2008 04:10:18 -0000 @@ -378,7 +378,7 @@ $items = array(); $number = variable_get('comment_block_count', 10); foreach (comment_get_recent($number) as $comment) { - $items[] = l($comment->subject, 'node/' . $comment->nid, array('fragment' => 'comment-' . $comment->cid)) . '
' . t('@time ago', array('@time' => format_interval(time() - $comment->timestamp))); + $items[] = l($comment->subject, 'node/' . $comment->nid, array('fragment' => 'comment-' . $comment->cid)) . '
' . t('@time ago', array('@time' => format_interval(drupal_time() - $comment->timestamp))); } if ($items) { @@ -712,7 +712,7 @@ } if (empty($edit['timestamp'])) { - $edit['timestamp'] = time(); + $edit['timestamp'] = drupal_time(); } if ($edit['uid'] === $user->uid) { // '===' Need to modify anonymous users as well. @@ -1448,7 +1448,7 @@ $comment->name = variable_get('anonymous', t('Anonymous')); } - $comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : time(); + $comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : drupal_time(); $output .= theme('comment_view', $comment, $node); } @@ -1490,7 +1490,7 @@ foreach (array('name', 'homepage', 'mail') as $field) { // Set cookie for 365 days. if (isset($form_state['values'][$field])) { - setcookie('comment_info_' . $field, $form_state['values'][$field], time() + 31536000, '/'); + setcookie('comment_info_' . $field, $form_state['values'][$field], drupal_time() + 31536000, '/'); } } } Index: modules/comment/comment.install =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v retrieving revision 1.24 diff -u -r1.24 comment.install --- modules/comment/comment.install 2 Aug 2008 20:29:43 -0000 1.24 +++ modules/comment/comment.install 6 Sep 2008 04:10:18 -0000 @@ -14,11 +14,11 @@ */ function comment_update_1() { // Change any future last comment timestamps to current time. - db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE last_comment_timestamp > %d', time(), time()); + db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE last_comment_timestamp > %d', drupal_time(), drupal_time()); // Unstuck node indexing timestamp if needed. if (($last = variable_get('node_cron_last', FALSE)) !== FALSE) { - variable_set('node_cron_last', min(time(), $last)); + variable_set('node_cron_last', min(drupal_time(), $last)); } return array(); Index: modules/poll/poll.module =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v retrieving revision 1.270 diff -u -r1.270 poll.module --- modules/poll/poll.module 24 Jul 2008 16:25:18 -0000 1.270 +++ modules/poll/poll.module 6 Sep 2008 04:10:18 -0000 @@ -161,7 +161,7 @@ * Closes polls that have exceeded their allowed runtime. */ function poll_cron() { - $result = db_query('SELECT p.nid FROM {poll} p INNER JOIN {node} n ON p.nid = n.nid WHERE (n.created + p.runtime) < ' . time() . ' AND p.active = 1 AND p.runtime != 0'); + $result = db_query('SELECT p.nid FROM {poll} p INNER JOIN {node} n ON p.nid = n.nid WHERE (n.created + p.runtime) < %d AND p.active = 1 AND p.runtime != 0', drupal_time()); while ($poll = db_fetch_object($result)) { db_query("UPDATE {poll} SET active = 0 WHERE nid = %d", $poll->nid); } Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.262 diff -u -r1.262 system.install --- modules/system/system.install 30 Aug 2008 10:03:57 -0000 1.262 +++ modules/system/system.install 6 Sep 2008 04:10:18 -0000 @@ -143,10 +143,10 @@ // Determine severity based on time since cron last ran. $severity = REQUIREMENT_OK; - if (time() - $cron_last > $threshold_error) { + if (drupal_time() - $cron_last > $threshold_error) { $severity = REQUIREMENT_ERROR; } - else if ($never_run || (time() - $cron_last > $threshold_warning)) { + else if ($never_run || (drupal_time() - $cron_last > $threshold_warning)) { $severity = REQUIREMENT_WARNING; } @@ -163,7 +163,7 @@ $description = $t('Cron has not run.') . ' ' . $help; } else { - $summary = $t('Last run !time ago', array('!time' => format_interval(time() - $cron_last))); + $summary = $t('Last run !time ago', array('!time' => format_interval(drupal_time() - $cron_last))); $description = ''; if ($severity != REQUIREMENT_OK) { $description = $t('Cron has not run recently.') . ' ' . $help; @@ -371,7 +371,7 @@ // 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', 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', drupal_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'", ''); @@ -3052,4 +3052,3 @@ * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ - Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.86 diff -u -r1.86 system.admin.inc --- modules/system/system.admin.inc 30 Aug 2008 09:49:43 -0000 1.86 +++ modules/system/system.admin.inc 6 Sep 2008 04:10:18 -0000 @@ -1557,13 +1557,13 @@ // Date settings: construct choices for user foreach ($date_short as $f) { - $date_short_choices[$f] = format_date(time(), 'custom', $f); + $date_short_choices[$f] = format_date(drupal_time(), 'custom', $f); } foreach ($date_medium as $f) { - $date_medium_choices[$f] = format_date(time(), 'custom', $f); + $date_medium_choices[$f] = format_date(drupal_time(), 'custom', $f); } foreach ($date_long as $f) { - $date_long_choices[$f] = format_date(time(), 'custom', $f); + $date_long_choices[$f] = format_date(drupal_time(), 'custom', $f); } $date_long_choices['custom'] = $date_medium_choices['custom'] = $date_short_choices['custom'] = t('Custom format'); @@ -1622,7 +1622,7 @@ '#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 PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(time(), 'custom', $default_short_custom))), + '#description' => t('A user-defined short date format. See the PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(drupal_time(), 'custom', $default_short_custom))), ); $date_format_medium = variable_get('date_format_medium', $date_medium[1]); @@ -1645,7 +1645,7 @@ '#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 PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(time(), 'custom', $default_medium_custom))), + '#description' => t('A user-defined medium date format. See the PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(drupal_time(), 'custom', $default_medium_custom))), ); $date_format_long = variable_get('date_format_long', $date_long[0]); @@ -1668,7 +1668,7 @@ '#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 PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(time(), 'custom', $default_long_custom))), + '#description' => t('A user-defined long date format. See the PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(drupal_time(), 'custom', $default_long_custom))), ); $form = system_settings_form($form); @@ -1697,7 +1697,7 @@ * Return the date for a given format string via Ajax. */ function system_date_time_lookup() { - $result = format_date(time(), 'custom', $_GET['format']); + $result = format_date(drupal_time(), 'custom', $_GET['format']); echo drupal_to_js($result); exit; } Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.616 diff -u -r1.616 system.module --- modules/system/system.module 5 Sep 2008 09:29:06 -0000 1.616 +++ modules/system/system.module 6 Sep 2008 04:10:18 -0000 @@ -1391,12 +1391,12 @@ */ function system_cron() { // Cleanup the flood. - db_query('DELETE FROM {flood} WHERE timestamp < %d', time() - 3600); + db_query('DELETE FROM {flood} WHERE timestamp < %d', drupal_time() - 3600); // Cleanup the batch table. - db_query('DELETE FROM {batch} WHERE timestamp < %d', time() - 864000); + db_query('DELETE FROM {batch} WHERE timestamp < %d', drupal_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, time() - DRUPAL_MAXIMUM_TEMP_FILE_AGE); + $result = db_query('SELECT * FROM {files} WHERE status = %d and timestamp < %d', FILE_STATUS_TEMPORARY, drupal_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 @@ -2027,7 +2027,7 @@ * Generate an array of time zones and their local time&date. */ function _system_zonelist() { - $timestamp = time(); + $timestamp = drupal_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) { Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.127 diff -u -r1.127 install.php --- install.php 28 Aug 2008 08:40:32 -0000 1.127 +++ install.php 6 Sep 2008 04:10:17 -0000 @@ -618,7 +618,7 @@ // Bootstrap newly installed Drupal, while preserving existing messages. $messages = isset($_SESSION['messages']) ? $_SESSION['messages'] : ''; drupal_install_init_database(); - + drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); $_SESSION['messages'] = $messages; @@ -1174,9 +1174,8 @@ $user->sid = session_id(); // Record when this install ran. - variable_set('install_time', time()); + variable_set('install_time', drupal_time()); } // Start the installer. install_main(); - Index: modules/openid/openid.module =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v retrieving revision 1.27 diff -u -r1.27 openid.module --- modules/openid/openid.module 24 Jul 2008 16:25:18 -0000 1.27 +++ modules/openid/openid.module 6 Sep 2008 04:10:18 -0000 @@ -333,7 +333,7 @@ module_load_include('inc', 'openid'); // Remove Old Associations: - db_query("DELETE FROM {openid_association} WHERE created + expires_in < %d", time()); + db_query("DELETE FROM {openid_association} WHERE created + expires_in < %d", drupal_time()); // Check to see if we have an association for this IdP already $assoc_handle = db_result(db_query("SELECT assoc_handle FROM {openid_association} WHERE idp_endpoint_uri = '%s'", $op_endpoint)); @@ -367,7 +367,7 @@ $assoc_response['mac_key'] = base64_encode(_openid_dh_xorsecret($shared, $enc_mac_key)); } db_query("INSERT INTO {openid_association} (idp_endpoint_uri, session_type, assoc_handle, assoc_type, expires_in, mac_key, created) VALUES('%s', '%s', '%s', '%s', %d, '%s', %d)", - $op_endpoint, $assoc_response['session_type'], $assoc_response['assoc_handle'], $assoc_response['assoc_type'], $assoc_response['expires_in'], $assoc_response['mac_key'], time()); + $op_endpoint, $assoc_response['session_type'], $assoc_response['assoc_handle'], $assoc_response['assoc_type'], $assoc_response['expires_in'], $assoc_response['mac_key'], drupal_time()); $assoc_handle = $assoc_response['assoc_handle']; } Index: modules/user/user.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v retrieving revision 1.24 diff -u -r1.24 user.admin.inc --- modules/user/user.admin.inc 24 Jul 2008 16:28:52 -0000 1.24 +++ modules/user/user.admin.inc 6 Sep 2008 04:10:18 -0000 @@ -180,8 +180,8 @@ } asort($users_roles); $form['roles'][$account->uid][0] = array('#markup' => theme('item_list', $users_roles)); - $form['member_for'][$account->uid] = array('#markup' => format_interval(time() - $account->created)); - $form['last_access'][$account->uid] = array('#markup' => $account->access ? t('@time ago', array('@time' => format_interval(time() - $account->access))) : t('never')); + $form['member_for'][$account->uid] = array('#markup' => format_interval(drupal_time() - $account->created)); + $form['last_access'][$account->uid] = array('#markup' => $account->access ? t('@time ago', array('@time' => format_interval(drupal_time() - $account->access))) : t('never')); $form['operations'][$account->uid] = array('#markup' => l(t('edit'), "user/$account->uid/edit", array('query' => $destination))); } $form['accounts'] = array( Index: modules/user/user.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v retrieving revision 1.15 diff -u -r1.15 user.pages.inc --- modules/user/user.pages.inc 21 Aug 2008 19:36:39 -0000 1.15 +++ modules/user/user.pages.inc 6 Sep 2008 04:10:19 -0000 @@ -84,7 +84,7 @@ else { // Time out, in seconds, until login URL expires. 24 hours = 86400 seconds. $timeout = 86400; - $current = time(); + $current = drupal_time(); // Some redundant checks for extra security ? if ($timestamp < $current && $account = user_load(array('uid' => $uid, 'status' => 1)) ) { // No time out for first time login. Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.917 diff -u -r1.917 user.module --- modules/user/user.module 21 Aug 2008 19:36:39 -0000 1.917 +++ modules/user/user.module 6 Sep 2008 04:10:19 -0000 @@ -240,7 +240,7 @@ // Consider users edited by an administrator as logged in, if they haven't // already, so anonymous users can view the profile (if allowed). if (empty($edit['access']) && empty($account->access) && user_access('administer users')) { - $edit['access'] = time(); + $edit['access'] = drupal_time(); } foreach ($edit as $key => $value) { // Fields that don't pertain to the users or user_roles @@ -302,12 +302,12 @@ else { // Allow 'created' to be set by the caller. if (!isset($edit['created'])) { - $edit['created'] = time(); + $edit['created'] = drupal_time(); } // Consider users created by an administrator as already logged in, so // anonymous users can view the profile (if allowed). if (empty($edit['access']) && user_access('administer users')) { - $edit['access'] = time(); + $edit['access'] = drupal_time(); } $success = drupal_write_record('users', $edit); @@ -653,7 +653,7 @@ $account->content['summary']['member_for'] = array( '#type' => 'user_profile_item', '#title' => t('Member for'), - '#markup' => format_interval(time() - $account->created), + '#markup' => format_interval(drupal_time() - $account->created), ); } if ($type == 'form' && $category == 'account') { @@ -788,7 +788,7 @@ case 'online': if (user_access('access content')) { // Count users active within the defined period. - $interval = time() - variable_get('user_block_seconds_online', 900); + $interval = drupal_time() - variable_get('user_block_seconds_online', 900); // Perform database queries to gather online user lists. We use s.timestamp // rather than u.access because it is much faster. @@ -1341,7 +1341,7 @@ watchdog('user', 'Session opened for %name.', array('%name' => $user->name)); // Update the user table timestamp noting user has logged in. // This is also used to invalidate one-time login links. - $user->login = time(); + $user->login = drupal_time(); db_query("UPDATE {users} SET login = %d WHERE uid = %d", $user->login, $user->uid); user_module_invoke('login', $edit, $user); sess_regenerate(); @@ -1380,7 +1380,7 @@ 'pass' => user_password(), 'init' => $name, 'status' => 1, - 'access' => time() + 'access' => drupal_time(), ); $account = user_save('', $userinfo); // Terminate if an error occured during user_save(). @@ -1395,7 +1395,7 @@ } function user_pass_reset_url($account) { - $timestamp = time(); + $timestamp = drupal_time(); return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE)); } @@ -2040,7 +2040,7 @@ '!uri' => $base_url, '!uri_brief' => preg_replace('!^https?://!', '', $base_url), '!mailto' => $account->mail, - '!date' => format_date(time(), 'medium', '', NULL, $language->language), + '!date' => format_date(drupal_time(), 'medium', '', NULL, $language->language), '!login_uri' => url('user', array('absolute' => TRUE, 'language' => $language)), '!edit_uri' => url('user/' . $account->uid . '/edit', array('absolute' => TRUE, 'language' => $language)), ); Index: modules/user/user.test =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.test,v retrieving revision 1.11 diff -u -r1.11 user.test --- modules/user/user.test 5 Sep 2008 09:55:08 -0000 1.11 +++ modules/user/user.test 6 Sep 2008 04:10:19 -0000 @@ -43,7 +43,7 @@ $this->assertEqual($user->mail, $mail, t('E-mail address matches.')); $this->assertEqual($user->theme, '', t('Correct theme field.')); $this->assertEqual($user->signature, '', t('Correct signature field.')); - $this->assertTrue(($user->created > time() - 20 ), t('Correct creation time.')); + $this->assertTrue(($user->created > drupal_time() - 20 ), t('Correct creation time.')); $this->assertEqual($user->status, variable_get('user_register', 1) == 1 ? 1 : 0, t('Correct status field.')); $this->assertEqual($user->timezone, variable_get('date_default_timezone', NULL), t('Correct timezone field.')); $this->assertEqual($user->language, '', t('Correct language field.')); @@ -494,7 +494,7 @@ $this->assertText($user_c->name, t('Found user C on admin users page')); $this->assertText($admin_user->name, t('Found Admin user on admin users page')); - // Filter the users by permission 'administer taxonomy'. + // Filter the users by permission 'administer taxonomy'. $edit = array(); $edit['filter'] = 'permission'; $edit['permission'] = 'administer taxonomy'; @@ -516,4 +516,3 @@ $this->assertEqual($account->status, 0, 'User B blocked'); } } - Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.36 diff -u -r1.36 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 30 Aug 2008 09:42:25 -0000 1.36 +++ modules/simpletest/drupal_web_test_case.php 6 Sep 2008 04:10:18 -0000 @@ -72,12 +72,12 @@ $db_prefix = $this->db_prefix_original; db_insert('simpletest')->fields(array( 'test_id' => $this->test_id, - 'test_class' => get_class($this), - 'status' => $status, + 'test_class' => get_class($this), + 'status' => $status, 'message' => substr($message, 0, 255), // Some messages are too long for the database. - 'message_group' => $group, - 'caller' => $function['function'], - 'line' => $function['line'], + 'message_group' => $group, + 'caller' => $function['function'], + 'line' => $function['line'], 'file' => $function['file'], ))->execute(); $this->_assertions[] = array( @@ -331,7 +331,7 @@ 'body' => $this->randomName(32), 'title' => $this->randomName(8), 'comment' => 2, - 'changed' => time(), + 'changed' => drupal_time(), 'format' => FILTER_FORMAT_DEFAULT, 'moderate' => 0, 'promote' => 0, @@ -405,7 +405,7 @@ node_types_rebuild(); $this->assertEqual($saved_type, SAVED_NEW, t('Created content type %type.', array('%type' => $type->type))); - + // Reset permissions so that permissions for this content type are available. $this->checkPermissions(array(), TRUE); @@ -645,7 +645,7 @@ // Generate temporary prefixed database to ensure that tests have a clean starting point. $db_prefix = 'simpletest' . mt_rand(1000, 1000000); - + include_once './includes/install.inc'; drupal_install_system(); @@ -659,7 +659,7 @@ // stale data for the previous run's database prefix and all // calls to it will fail. drupal_get_schema(NULL, TRUE); - + // Run default profile tasks. $task = 'profile'; default_profile_tasks($task, ''); Index: modules/tracker/tracker.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker/tracker.pages.inc,v retrieving revision 1.6 diff -u -r1.6 tracker.pages.inc --- modules/tracker/tracker.pages.inc 14 Apr 2008 17:48:42 -0000 1.6 +++ modules/tracker/tracker.pages.inc 6 Sep 2008 04:10:18 -0000 @@ -54,7 +54,7 @@ l($node->title, "node/$node->nid") . ' ' . theme('mark', node_mark($node->nid, $node->changed)), theme('username', $node), array('class' => 'replies', 'data' => $comments), - t('!time ago', array('!time' => format_interval(time() - $node->last_updated))) + t('!time ago', array('!time' => format_interval(drupal_time() - $node->last_updated))) ); } Index: modules/dblog/dblog.test =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.test,v retrieving revision 1.7 diff -u -r1.7 dblog.test --- modules/dblog/dblog.test 5 Sep 2008 19:04:26 -0000 1.7 +++ modules/dblog/dblog.test 6 Sep 2008 04:10:18 -0000 @@ -104,7 +104,7 @@ 'request_uri' => $base_root . request_uri(), 'referer' => referer_uri(), 'ip' => ip_address(), - 'timestamp' => time(), + 'timestamp' => drupal_time(), ); $message = 'Log entry added to test the dblog row limit.'; for ($i = 0; $i < $count; $i++) { Index: scripts/run-tests.sh =================================================================== RCS file: /cvs/drupal/drupal/scripts/run-tests.sh,v retrieving revision 1.7 diff -u -r1.7 run-tests.sh --- scripts/run-tests.sh 18 Aug 2008 18:52:31 -0000 1.7 +++ scripts/run-tests.sh 6 Sep 2008 04:10:19 -0000 @@ -115,13 +115,13 @@ --concurrency [num] Run tests in parallel, up to [num] tests at a time. This requires - the Process Control Extension (PCNTL) to be compiled in PHP, not + the Process Control Extension (PCNTL) to be compiled in PHP, not supported under Windows. --all Run all available tests. --class Run tests identified by specific class names, instead of group names. - + --file Run tests identifiled by specific file names, instead of group names. Specify the path and the extension (i.e. 'modules/user/user.test'). @@ -370,7 +370,7 @@ foreach ($args['test_names'] as $file) { $files[realpath($file)] = 1; } - + // Check for valid class names. foreach ($all_tests as $class_name => $instance) { $refclass = new ReflectionClass($class_name); @@ -423,7 +423,7 @@ echo "\n"; } - echo "Test run started: " . format_date(time(), 'long') . "\n"; + echo "Test run started: " . format_date(drupal_time(), 'long') . "\n"; echo "\n"; echo "Test summary:\n"; @@ -438,7 +438,7 @@ global $args, $test_id, $results_map; echo "\n"; - echo "Test run ended: " . format_date(time(), 'long') . "\n"; + echo "Test run ended: " . format_date(drupal_time(), 'long') . "\n"; echo "\n"; if ($args['verbose']) {