Commit 37ee9eed authored by Dries's avatar Dries

- Bugfix: we now keep a per-node $date cache in comment_is_new(). Suggested

  by Natrak.
parent 291d119b
......@@ -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 {
......
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment