summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-01-07 22:18:56 -0500
committerDavid Rothstein <drothstein@gmail.com>2013-01-07 22:18:56 -0500
commit3d169b3bb6491e8ebc69194c717ed61ad894c5d8 (patch)
treefbbaf0981fec91c0263da6d93527b44d610ad10f /modules/comment/comment.module
parent286deb81ecc1569a08ab25c13762dda7a24ce9f7 (diff)
downloadbrdo-3d169b3bb6491e8ebc69194c717ed61ad894c5d8.tar.gz
brdo-3d169b3bb6491e8ebc69194c717ed61ad894c5d8.tar.bz2
Issue #1857956 by catch, David_Rothstein: Do not re-prepare comment update timestamp if it's the same as the created timestamp (performance improvement).
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 8b51f7662..46115be04 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -2288,8 +2288,16 @@ function template_preprocess_comment(&$variables) {
$variables['comment'] = $comment;
$variables['node'] = $node;
$variables['author'] = theme('username', array('account' => $comment));
+
$variables['created'] = format_date($comment->created);
- $variables['changed'] = format_date($comment->changed);
+
+ // Avoid calling format_date() twice on the same timestamp.
+ if ($comment->changed == $comment->created) {
+ $variables['changed'] = $variables['created'];
+ }
+ else {
+ $variables['changed'] = format_date($comment->changed);
+ }
$variables['new'] = !empty($comment->new) ? t('new') : '';
$variables['picture'] = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', array('account' => $comment)) : '';