public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Tom Knight (tomk)" <tomk@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-projects commit in forums/htdocs: search.php
Date: Tue, 01 Jul 2008 20:33:53 +0000	[thread overview]
Message-ID: <E1KDmXx-0000f6-LR@stork.gentoo.org> (raw)

tomk        08/07/01 20:33:53

  Modified:             search.php
  Log:
  Prevent searches hitting the php memory limit

Revision  Changes    Path
1.23                 forums/htdocs/search.php

file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.23&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.23&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?r1=1.22&r2=1.23

Index: search.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/search.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- search.php	19 Aug 2007 13:20:17 -0000	1.22
+++ search.php	1 Jul 2008 20:33:53 -0000	1.23
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: search.php,v 1.22 2007/08/19 13:20:17 tomk Exp $
+ *   $Id: search.php,v 1.23 2008/07/01 20:33:53 tomk Exp $
  *
  *
  ***************************************************************************/
@@ -636,31 +636,16 @@
 		// Finish building query (for all combinations)
 		// and run it ...
 		//
-		$sql = "SELECT session_id 
-			FROM " . SESSIONS_TABLE;
-		if ( $result = $db->sql_query($sql) )
-		{
-			$delete_search_ids = array();
-			while( $row = $db->sql_fetchrow($result) )
-			{
-				$delete_search_ids[] = "'" . $row['session_id'] . "'";
-			}
 
-			if ( count($delete_search_ids) )
-			{
-				$sql = "DELETE FROM " . SEARCH_TABLE . " 
-					WHERE session_id NOT IN (" . phpbb_implode(", ", $delete_search_ids) . ")";
-				if ( !$result = $db->sql_query($sql) )
-				{
-					message_die(GENERAL_ERROR, 'Could not delete old search id sessions', '', __LINE__, __FILE__, $sql);
-				}
-
-				// 2007-08-19 tomk - these vars aren't used any more so free up some memory
-				unset($delete_search_ids);
-				unset($sql);
-			}
+		// 2008-07-01 tomk - use subquery to prevent hitting memory limit
+		$sql = "DELETE FROM " . SEARCH_TABLE . " 
+			WHERE session_id NOT IN (SELECT session_id FROM " . SESSIONS_TABLE . ")";
+		if ( !$result = $db->sql_query($sql) )
+		{
+			message_die(GENERAL_ERROR, 'Could not delete old search id sessions', '', __LINE__, __FILE__, $sql);
+		}
+   			}
 		}
-
 		//
 		// Store new result data
 		//



-- 
gentoo-commits@lists.gentoo.org mailing list



             reply	other threads:[~2008-07-01 20:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 20:33 Tom Knight (tomk) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-07-01 21:09 [gentoo-commits] gentoo-projects commit in forums/htdocs: search.php Tom Knight (tomk)
2008-07-01 21:35 Tom Knight (tomk)
2008-07-01 21:59 Tom Knight (tomk)
2009-08-18  5:36 Robin H. Johnson (robbat2)
2009-08-18  5:38 Robin H. Johnson (robbat2)
2010-07-23  6:49 Dean Stephens (desultory)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1KDmXx-0000f6-LR@stork.gentoo.org \
    --to=tomk@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox