diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-06-08 14:30:05 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-06-08 14:30:05 +0000 |
commit | 37ee9eed2eac0726ee39a8396d9d5feffbf1baf9 (patch) | |
tree | adff3cb2b8d3d2e3d69fe229f231c491a389f337 | |
parent | 291d119b259d9a1bc05f473a8446563afb054dbc (diff) | |
download | brdo-37ee9eed2eac0726ee39a8396d9d5feffbf1baf9.tar.gz brdo-37ee9eed2eac0726ee39a8396d9d5feffbf1baf9.tar.bz2 |
- Bugfix: we now keep a per-node $date cache in comment_is_new(). Suggested
by Natrak.
-rw-r--r-- | modules/comment.module | 8 | ||||
-rw-r--r-- | modules/comment/comment.module | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/modules/comment.module b/modules/comment.module index 509341ede..22c7c8aaa 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -73,17 +73,17 @@ function comment_is_new($comment) { global $user; static $date; - if (!$date) { + if (!$date[$comment->nid]) { if ($user->uid) { $history = db_fetch_object(db_query("SELECT timestamp FROM history WHERE uid = '$user->uid' AND nid = '$comment->nid'")); - $date = $history->timestamp ? $history->timestamp : 0; + $date[$comment->nid] = $history->timestamp ? $history->timestamp : 0; } else { - $date = time(); + $date[$comment->nid] = time(); } } - if ($comment->timestamp > $date) { + if ($comment->timestamp > $date[$comment->nid]) { return 1; } else { diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 509341ede..22c7c8aaa 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -73,17 +73,17 @@ function comment_is_new($comment) { global $user; static $date; - if (!$date) { + if (!$date[$comment->nid]) { if ($user->uid) { $history = db_fetch_object(db_query("SELECT timestamp FROM history WHERE uid = '$user->uid' AND nid = '$comment->nid'")); - $date = $history->timestamp ? $history->timestamp : 0; + $date[$comment->nid] = $history->timestamp ? $history->timestamp : 0; } else { - $date = time(); + $date[$comment->nid] = time(); } } - if ($comment->timestamp > $date) { + if ($comment->timestamp > $date[$comment->nid]) { return 1; } else { |