Index: modules/comment/comment.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v retrieving revision 1.32 diff -u -p -r1.32 comment.admin.inc --- modules/comment/comment.admin.inc 18 Sep 2009 00:12:45 -0000 1.32 +++ modules/comment/comment.admin.inc 20 Sep 2009 03:56:40 -0000 @@ -72,7 +72,7 @@ function comment_admin_overview($form, & $query->addField('u', 'name', 'registered_name'); $query->addField('n', 'title', 'node_title'); $result = $query - ->fields('c', array('subject', 'nid', 'cid', 'comment', 'timestamp', 'status', 'name', 'homepage')) + ->fields('c', array('subject', 'nid', 'cid', 'comment', 'comment_timestamp', 'status', 'name', 'homepage')) ->fields('u', array('uid')) ->condition('c.status', $status) ->limit(50) @@ -89,7 +89,7 @@ function comment_admin_overview($form, & 'subject' => l($comment->subject, 'comment/' . $comment->cid, array('attributes' => array('title' => truncate_utf8($comment->comment, 128)), 'fragment' => 'comment-' . $comment->cid)), 'author' => theme('username', $comment), 'posted_in' => l($comment->node_title, 'node/' . $comment->nid), - 'time' => format_date($comment->timestamp, 'short'), + 'time' => format_date($comment->comment_timestamp, 'short'), 'operations' => l(t('edit'), 'comment/edit/' . $comment->cid, array('query' => $destination)), ); } Index: modules/comment/comment.install =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v retrieving revision 1.46 diff -u -p -r1.46 comment.install --- modules/comment/comment.install 18 Sep 2009 00:04:22 -0000 1.46 +++ modules/comment/comment.install 20 Sep 2009 03:56:40 -0000 @@ -134,6 +134,17 @@ function comment_update_7006() { } /** + * Rename timestamp to comment_timestamp + */ +function comment_update_7007() { + $ret = array(); + db_change_field($ret, 'comment', 'timestamp', 'comment_timestamp', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); + db_drop_index($ret, 'comment', 'comment_num_new'); + db_add_index($ret, 'comment', 'comment_num_new', array('nid', 'comment_timestamp', 'status')); + return $ret; +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ @@ -188,7 +199,7 @@ function comment_schema() { 'default' => '', 'description' => "The author's host name.", ), - 'timestamp' => array( + 'comment_timestamp' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 0, @@ -236,7 +247,7 @@ function comment_schema() { ), 'indexes' => array( 'comment_status_pid' => array('pid', 'status'), - 'comment_num_new' => array('nid', 'timestamp', 'status'), + 'comment_num_new' => array('nid', 'comment_timestamp', 'status'), 'comment_uid' => array('uid'), ), 'primary key' => array('cid'), @@ -295,4 +306,4 @@ function comment_schema() { ); return $schema; -} \ No newline at end of file +} Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.772 diff -u -p -r1.772 comment.module --- modules/comment/comment.module 19 Sep 2009 11:07:36 -0000 1.772 +++ modules/comment/comment.module 20 Sep 2009 03:56:41 -0000 @@ -388,7 +388,7 @@ function comment_get_recent($number = 10 $query = db_select('comment', 'c'); $query->innerJoin('node', 'n', 'n.nid = c.nid'); return $query - ->fields('c', array('nid', 'subject', 'cid', 'timestamp')) + ->fields('c', array('nid', 'subject', 'cid', 'comment_timestamp')) ->condition('c.nid', $nids, 'IN') ->condition('c.status', COMMENT_PUBLISHED) ->condition('n.status', 1) @@ -434,7 +434,7 @@ function comment_new_page_count($num_com FROM {comment} WHERE nid = :nid AND status = 0 - ORDER BY timestamp DESC) AS thread + ORDER BY comment_timestamp DESC) AS thread ORDER BY SUBSTRING(thread, 1, (LENGTH(thread) - 1))', 0, $new_replies, array(':nid' => $node->nid))->fetchField(); $thread = substr($result, 0, -1); $count = db_query('SELECT COUNT(*) FROM {comment} WHERE nid = :nid AND status = 0 AND SUBSTRING(thread, 1, (LENGTH(thread) - 1)) < :thread', array( @@ -462,7 +462,7 @@ function theme_comment_block() { $items = array(); $number = variable_get('comment_block_count', 10); foreach (comment_get_recent($number) as $comment) { - $items[] = l($comment->subject, 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)) . '
' . t('@time ago', array('@time' => format_interval(REQUEST_TIME - $comment->timestamp))); + $items[] = l($comment->subject, 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)) . '
' . t('@time ago', array('@time' => format_interval(REQUEST_TIME - $comment->comment_timestamp))); } if ($items) { @@ -1263,7 +1263,7 @@ function comment_save($comment) { db_update('comment') ->fields(array( 'status' => $comment->status, - 'timestamp' => $comment->timestamp, + 'comment_timestamp' => $comment->comment_timestamp, 'subject' => $comment->subject, 'comment' => $comment->comment, 'format' => $comment->comment_format, @@ -1322,8 +1322,8 @@ function comment_save($comment) { } } - if (empty($comment->timestamp)) { - $comment->timestamp = REQUEST_TIME; + if (empty($comment->comment_timestamp)) { + $comment->comment_timestamp = REQUEST_TIME; } if ($comment->uid === $user->uid && isset($user->name)) { // '===' Need to modify anonymous users as well. @@ -1339,7 +1339,7 @@ function comment_save($comment) { 'comment' => $comment->comment, 'format' => $comment->comment_format, 'hostname' => ip_address(), - 'timestamp' => $comment->timestamp, + 'comment_timestamp' => $comment->comment_timestamp, 'status' => $comment->status, 'thread' => $thread, 'name' => $comment->name, @@ -1487,7 +1487,7 @@ class CommentController extends DrupalDe foreach ($comments as $key => $comment) { $comment = drupal_unpack($comment); $comment->name = $comment->uid ? $comment->registered_name : $comment->name; - $comment->new = node_mark($comment->nid, $comment->timestamp); + $comment->new = node_mark($comment->nid, $comment->comment_timestamp); $comment->node_type = 'comment_node_' . $comment->node_type; $comments[$key] = $comment; } @@ -1536,7 +1536,7 @@ function comment_num_new($nid, $timestam $timestamp = ($timestamp > NODE_NEW_LIMIT ? $timestamp : NODE_NEW_LIMIT); // Use the timestamp to retrieve the number of new comments. - return db_query('SELECT COUNT(cid) FROM {comment} WHERE nid = :nid AND timestamp > :timestamp AND status = :status', array( + return db_query('SELECT COUNT(cid) FROM {comment} WHERE nid = :nid AND comment_timestamp > :timestamp AND status = :status', array( ':nid' => $nid, ':timestamp' => $timestamp, ':status' => COMMENT_PUBLISHED, @@ -1661,7 +1661,7 @@ function comment_form($form, &$form_stat $date = $comment->date; } else { - $date = format_date($comment->timestamp, 'custom', 'Y-m-d H:i O'); + $date = format_date($comment->comment_timestamp, 'custom', 'Y-m-d H:i O'); } $form['admin'] = array( @@ -1906,7 +1906,7 @@ function comment_preview($comment) { $comment->name = variable_get('anonymous', t('Anonymous')); } - $comment->timestamp = !empty($comment->timestamp) ? $comment->timestamp : REQUEST_TIME; + $comment->comment_timestamp = !empty($comment->comment_timestamp) ? $comment->comment_timestamp : REQUEST_TIME; $comment->in_preview = TRUE; $comment_build = comment_build($comment, $node); $comment_build += array( @@ -2011,7 +2011,7 @@ function comment_submit($comment) { $comment['date'] = 'now'; } - $comment['timestamp'] = strtotime($comment['date']); + $comment['comment_timestamp'] = strtotime($comment['date']); if (isset($comment['author'])) { $account = user_load_by_name($comment['author']); $comment['uid'] = $account->uid; @@ -2089,7 +2089,7 @@ function template_preprocess_comment(&$v $variables['comment'] = $comment; $variables['node'] = $node; $variables['author'] = theme('username', $comment); - $variables['date'] = format_date($comment->timestamp); + $variables['date'] = format_date($comment->comment_timestamp); $variables['new'] = !empty($comment->new) ? t('new') : ''; $variables['picture'] = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $comment) : ''; $variables['signature'] = $comment->signature; @@ -2239,7 +2239,7 @@ function _comment_update_node_statistics if ($count > 0) { // Comments exist. - $last_reply = db_query_range('SELECT cid, name, timestamp, uid FROM {comment} WHERE nid = :nid AND status = :status ORDER BY cid DESC', 0, 1, array( + $last_reply = db_query_range('SELECT cid, name, comment_timestamp, uid FROM {comment} WHERE nid = :nid AND status = :status ORDER BY cid DESC', 0, 1, array( ':nid' => $nid, ':status' => COMMENT_PUBLISHED, ))->fetchObject();