This is the diff of Display.controller.php that I am testing. I have removed topicseen and the cache. I have not bothered to go clean it out from the rest of the code yet.
diff Display.controller.php{,.orig}
478c478
< if ($mark_at_msg >= $topicinfo['new_from']) {
---
> if ($mark_at_msg >= $topicinfo['new_from'])
479a480,489
>
> updateReadNotificationsFor($topic, $board);
>
> // Have we recently cached the number of new topics in this board, and it's still a lot?
> if (isset($_REQUEST['topicseen']) && isset($_SESSION['topicseen_cache'][$board]) && $_SESSION['topicseen_cache'][$board] > 5)
> $_SESSION['topicseen_cache'][$board]--;
> // Mark board as seen if this is the only new topic.
> elseif (isset($_REQUEST['topicseen']))
> {
> // Use the mark read tables... and the last visit to figure out if this should be read or not.
480a491,492
>
> // If there're no real new topics in this board, mark the board as seen.
482a495,496
> else
> $_SESSION['topicseen_cache'][$board] = $numNewTopics;
484,485c498,500
<
< updateReadNotificationsFor($topic, $board);
---
> // Probably one less topic - maybe not, but even if we decrease this too fast it will only make us look more often.
> elseif (isset($_SESSION['topicseen_cache'][$board]))
> $_SESSION['topicseen_cache'][$board]--;
Or for clarity.
if ($mark_at_msg >= $topicinfo['new_from'])
markTopicsRead(array($user_info['id'], $topic, $mark_at_msg, $topicinfo['unwatched']), $topicinfo['new_from'] !== 0);
updateReadNotificationsFor($topic, $board);
// Have we recently cached the number of new topics in this board, and it's still a lot?
if (isset($_REQUEST['topicseen']) && isset($_SESSION['topicseen_cache'][$board]) && $_SESSION['topicseen_cache'][$board] > 5)
$_SESSION['topicseen_cache'][$board]--;
// Mark board as seen if this is the only new topic.
elseif (isset($_REQUEST['topicseen']))
{
// Use the mark read tables... and the last visit to figure out if this should be read or not.
$numNewTopics = getUnreadCountSince($board, empty($_SESSION['id_msg_last_visit']) ? 0 : $_SESSION['id_msg_last_visit']);
// If there're no real new topics in this board, mark the board as seen.
if (empty($numNewTopics))
$_REQUEST['boardseen'] = true;
else
$_SESSION['topicseen_cache'][$board] = $numNewTopics;
}
// Probably one less topic - maybe not, but even if we decrease this too fast it will only make us look more often.
elseif (isset($_SESSION['topicseen_cache'][$board]))
$_SESSION['topicseen_cache'][$board]--;
// Mark board as seen if we came using last post link from BoardIndex. (or other places...)
if (isset($_REQUEST['boardseen']))
{
if ($mark_at_msg >= $topicinfo['new_from']) {
markTopicsRead(array($user_info['id'], $topic, $mark_at_msg, $topicinfo['unwatched']), $topicinfo['new_from'] !== 0);
$numNewTopics = getUnreadCountSince($board, empty($_SESSION['id_msg_last_visit']) ? 0 : $_SESSION['id_msg_last_visit']);
if (empty($numNewTopics))
$_REQUEST['boardseen'] = true;
}
updateReadNotificationsFor($topic, $board);
// Mark board as seen if we came using last post link from BoardIndex. (or other places...)
if (isset($_REQUEST['boardseen']))
{