Skip to content

Commit 3afe0fc

Browse files
committed
Quick Fix
Removed some testing code that didn't trigger on forums with less than 100000 posts.
1 parent b6735ec commit 3afe0fc

File tree

2 files changed

+2
-63
lines changed

2 files changed

+2
-63
lines changed

mod/modification.xml

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -231,67 +231,7 @@ function RecentPosts2() {
231231
ml.icon AS last_icon, ms.icon AS first_icon, t.id_poll, t.is_sticky, t.locked, ml.modified_time AS last_modified_time,
232232
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from, SUBSTRING(ml.body, 1, 385) AS last_body,
233233
SUBSTRING(ms.body, 1, 385) AS first_body, ml.smileys_enabled AS last_smileys, ms.smileys_enabled AS first_smileys, t.id_first_msg, t.id_last_msg';
234-
235-
if ($context['showing_all_topics']) {
236-
if (!empty($board)) {
237-
$request = $smcFunc['db_query']('', '
238-
SELECT MIN(id_msg)
239-
FROM {db_prefix}log_mark_read
240-
WHERE id_member = {int:current_member}
241-
AND id_board = {int:current_board}',
242-
array(
243-
'current_board' => $board,
244-
'current_member' => $user_info['id'],
245-
)
246-
);
247-
list ($earliest_msg) = $smcFunc['db_fetch_row']($request);
248-
$smcFunc['db_free_result']($request);
249-
} else {
250-
$request = $smcFunc['db_query']('', '
251-
SELECT MIN(lmr.id_msg)
252-
FROM {db_prefix}boards AS b
253-
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})
254-
WHERE {query_see_board}',
255-
array(
256-
'current_member' => $user_info['id'],
257-
)
258-
);
259-
list ($earliest_msg) = $smcFunc['db_fetch_row']($request);
260-
$smcFunc['db_free_result']($request);
261-
}
262-
263-
// This is needed in case of topics marked unread.
264-
if (empty($earliest_msg)) {
265-
$earliest_msg = 0;
266-
} else {
267-
// Using caching, when possible, to ignore the below slow query.
268-
if (isset($_SESSION['cached_log_time']) && $_SESSION['cached_log_time'][0] + 45 > time())
269-
$earliest_msg2 = $_SESSION['cached_log_time'][1];
270-
else
271-
{
272-
// This query is pretty slow, but it's needed to ensure nothing crucial is ignored.
273-
$request = $smcFunc['db_query']('', '
274-
SELECT MIN(id_msg)
275-
FROM {db_prefix}log_topics
276-
WHERE id_member = {int:current_member}',
277-
array(
278-
'current_member' => $user_info['id'],
279-
)
280-
);
281-
list ($earliest_msg2) = $smcFunc['db_fetch_row']($request);
282-
$smcFunc['db_free_result']($request);
283-
284-
// In theory this could be zero, if the first ever post is unread, so fudge it ;)
285-
if ($earliest_msg2 == 0)
286-
$earliest_msg2 = -1;
287-
288-
$_SESSION['cached_log_time'] = array(time(), $earliest_msg2);
289-
}
290-
291-
$earliest_msg = min($earliest_msg2, $earliest_msg);
292-
}
293-
}
294-
234+
295235
// !!! Add modified_time in for log_time check?
296236
297237
if ($modSettings['totalMessages'] > 100000) {
@@ -316,7 +256,6 @@ function RecentPosts2() {
316256
'db_error_skip' => true,
317257
))
318258
) !== false;
319-
echo "have_temp_table = $have_temp_table";
320259
} else {
321260
$have_temp_table = false;
322261
}

mod/package-info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
33
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
4-
<id>cooliojazz:recentposts</id>
4+
<id>cooliojazz:RecentPosts</id>
55
<name>Recent Posts Mod</name>
66
<type>modification</type>
77
<version>0.1</version>

0 commit comments

Comments
 (0)