Browse Source

Quick Fix

Removed some testing code that didn't trigger on forums with less than
100000 posts.
cooliojazz 10 years ago
parent
commit
3afe0fcd7e
2 changed files with 2 additions and 63 deletions
  1. 1 62
      mod/modification.xml
  2. 1 1
      mod/package-info.xml

+ 1 - 62
mod/modification.xml

@@ -231,67 +231,7 @@ function RecentPosts2() {
 				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,
 				IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from, SUBSTRING(ml.body, 1, 385) AS last_body,
 				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';
-
-	if ($context['showing_all_topics']) {
-		if (!empty($board)) {
-			$request = $smcFunc['db_query']('', '
-				SELECT MIN(id_msg)
-				FROM {db_prefix}log_mark_read
-				WHERE id_member = {int:current_member}
-					AND id_board = {int:current_board}',
-				array(
-					'current_board' => $board,
-					'current_member' => $user_info['id'],
-				)
-			);
-			list ($earliest_msg) = $smcFunc['db_fetch_row']($request);
-			$smcFunc['db_free_result']($request);
-		} else {
-			$request = $smcFunc['db_query']('', '
-				SELECT MIN(lmr.id_msg)
-				FROM {db_prefix}boards AS b
-					LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})
-				WHERE {query_see_board}',
-				array(
-					'current_member' => $user_info['id'],
-				)
-			);
-			list ($earliest_msg) = $smcFunc['db_fetch_row']($request);
-			$smcFunc['db_free_result']($request);
-		}
-
-		// This is needed in case of topics marked unread.
-		if (empty($earliest_msg)) {
-                    $earliest_msg = 0;
-                } else {
-			// Using caching, when possible, to ignore the below slow query.
-			if (isset($_SESSION['cached_log_time']) && $_SESSION['cached_log_time'][0] + 45 > time())
-				$earliest_msg2 = $_SESSION['cached_log_time'][1];
-			else
-			{
-				// This query is pretty slow, but it's needed to ensure nothing crucial is ignored.
-				$request = $smcFunc['db_query']('', '
-					SELECT MIN(id_msg)
-					FROM {db_prefix}log_topics
-					WHERE id_member = {int:current_member}',
-					array(
-						'current_member' => $user_info['id'],
-					)
-				);
-				list ($earliest_msg2) = $smcFunc['db_fetch_row']($request);
-				$smcFunc['db_free_result']($request);
-
-				// In theory this could be zero, if the first ever post is unread, so fudge it ;)
-				if ($earliest_msg2 == 0)
-					$earliest_msg2 = -1;
-
-				$_SESSION['cached_log_time'] = array(time(), $earliest_msg2);
-			}
-
-			$earliest_msg = min($earliest_msg2, $earliest_msg);
-		}
-	}
-
+                            
 	// !!! Add modified_time in for log_time check?
 
 	if ($modSettings['totalMessages'] > 100000) {
@@ -316,7 +256,6 @@ function RecentPosts2() {
 				'db_error_skip' => true,
 			))
 		) !== false;
-                echo "have_temp_table = $have_temp_table";
 	} else {
 		$have_temp_table = false;
         }

+ 1 - 1
mod/package-info.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
 <package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
-	<id>cooliojazz:recentposts</id>
+	<id>cooliojazz:RecentPosts</id>
 	<name>Recent Posts Mod</name>
 	<type>modification</type>
 	<version>0.1</version>