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 04:34:29 -0000
@@ -62,7 +62,7 @@ function comment_admin_overview($form, &
'subject' => array('data' => t('Subject'), 'field' => 'subject'),
'author' => array('data' => t('Author'), 'field' => 'name'),
'posted_in' => array('data' => t('Posted in'), 'field' => 'node_title'),
- 'time' => array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc'),
+ 'time' => array('data' => t('Time'), 'field' => 'comment_timestamp', 'sort' => 'desc'),
'operations' => array('data' => t('Operations')),
);
@@ -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.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.api.php,v
retrieving revision 1.11
diff -u -p -r1.11 comment.api.php
--- modules/comment/comment.api.php 17 Aug 2009 13:10:45 -0000 1.11
+++ modules/comment/comment.api.php 20 Sep 2009 04:34:29 -0000
@@ -69,7 +69,7 @@ function hook_comment_load($comments) {
*/
function hook_comment_view($comment) {
// how old is the comment
- $comment->time_ago = time() - $comment->timestamp;
+ $comment->time_ago = time() - $comment->comment_timestamp;
}
/**
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 04:34:29 -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 04:34:30 -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,14 +2239,14 @@ 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();
db_update('node_comment_statistics')
->fields( array(
'comment_count' => $count,
- 'last_comment_timestamp' => $last_reply->timestamp,
+ 'last_comment_timestamp' => $last_reply->comment_timestamp,
'last_comment_name' => $last_reply->uid ? '' : $last_reply->name,
'last_comment_uid' => $last_reply->uid,
))
Index: modules/comment/comment.tokens.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.tokens.inc,v
retrieving revision 1.1
diff -u -p -r1.1 comment.tokens.inc
--- modules/comment/comment.tokens.inc 19 Aug 2009 20:19:36 -0000 1.1
+++ modules/comment/comment.tokens.inc 20 Sep 2009 04:34:30 -0000
@@ -200,7 +200,7 @@ function comment_tokens($type, $tokens,
break;
case 'created':
- $replacements[$original] = format_date($comment->timestamp, 'medium', '', NULL, $language_code);
+ $replacements[$original] = format_date($comment->comment_timestamp, 'medium', '', NULL, $language_code);
break;
case 'node':
@@ -217,7 +217,7 @@ function comment_tokens($type, $tokens,
}
if ($date_tokens = token_find_with_prefix($tokens, 'created')) {
- $replacements += token_generate('date', $date_tokens, array('date' => $comment->timestamp), $options);
+ $replacements += token_generate('date', $date_tokens, array('date' => $comment->comment_timestamp), $options);
}
if (($parent_tokens = token_find_with_prefix($tokens, 'parent')) && $parent = comment_load($comment->pid)) {
Index: modules/tracker/tracker.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/tracker/tracker.module,v
retrieving revision 1.163
diff -u -p -r1.163 tracker.module
--- modules/tracker/tracker.module 18 Sep 2009 00:04:23 -0000 1.163
+++ modules/tracker/tracker.module 20 Sep 2009 04:34:30 -0000
@@ -187,7 +187,7 @@ function tracker_comment_update($comment
// comment_save() calls hook_comment_publish() for all published comments
// so we to handle all other values here.
if ($comment['status'] != COMMENT_PUBLISHED) {
- _tracker_remove($comment['nid'], $comment['uid'], $comment['timestamp']);
+ _tracker_remove($comment['nid'], $comment['uid'], $comment['comment_timestamp']);
}
}
@@ -198,21 +198,21 @@ function tracker_comment_update($comment
* comment_save() calls hook_comment_publish() for all published comments.
*/
function tracker_comment_publish($comment) {
- _tracker_add($comment->nid, $comment->uid, $comment->timestamp);
+ _tracker_add($comment->nid, $comment->uid, $comment->comment_timestamp);
}
/**
* Implement hook_comment_unpublish().
*/
function tracker_comment_unpublish($comment) {
- _tracker_remove($comment->nid, $comment->uid, $comment->timestamp);
+ _tracker_remove($comment->nid, $comment->uid, $comment->comment_timestamp);
}
/**
* Implement hook_comment_delete().
*/
function tracker_comment_delete($comment) {
- _tracker_remove($comment->nid, $comment->uid, $comment->timestamp);
+ _tracker_remove($comment->nid, $comment->uid, $comment->comment_timestamp);
}
/**
@@ -266,12 +266,12 @@ function _tracker_add($nid, $uid, $chang
*/
function _tracker_calculate_changed($nid) {
$changed = db_query('SELECT changed FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetchField();
- $latest_comment = db_query_range('SELECT cid, timestamp FROM {comment} WHERE nid = :nid AND status = :status ORDER BY timestamp DESC', 0, 1, array(
+ $latest_comment = db_query_range('SELECT cid, comment_timestamp FROM {comment} WHERE nid = :nid AND status = :status ORDER BY timestamp DESC', 0, 1, array(
':nid' => $nid,
':status' => COMMENT_PUBLISHED,
))->fetchObject();
- if ($latest_comment && $latest_comment->timestamp > $changed) {
- $changed = $latest_comment->timestamp;
+ if ($latest_comment && $latest_comment->comment_timestamp > $changed) {
+ $changed = $latest_comment->comment_timestamp;
}
return $changed;
}