* [gentoo-commits] gentoo-projects commit in forums/htdocs: search.php
@ 2009-08-18 5:36 Robin H. Johnson (robbat2)
0 siblings, 0 replies; 7+ messages in thread
From: Robin H. Johnson (robbat2) @ 2009-08-18 5:36 UTC (permalink / raw
To: gentoo-commits
robbat2 09/08/18 05:36:32
Modified: search.php
Log:
Indexed version of the searches cleanup. Approved by desultory.
Revision Changes Path
1.28 forums/htdocs/search.php
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.28&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.28&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?r1=1.27&r2=1.28
Index: search.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/search.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -p -w -b -B -u -u -r1.27 -r1.28
--- search.php 30 Jul 2009 06:38:50 -0000 1.27
+++ search.php 18 Aug 2009 05:36:32 -0000 1.28
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: search.php,v 1.27 2009/07/30 06:38:50 desultory Exp $
+ * $Id: search.php,v 1.28 2009/08/18 05:36:32 robbat2 Exp $
*
*
***************************************************************************/
@@ -638,8 +638,13 @@ else if ( $search_keywords != '' || $sea
//
// 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 . ")";
+ //$sql = "DELETE FROM " . SEARCH_TABLE . "
+ // WHERE session_id NOT IN (SELECT session_id FROM " . SESSIONS_TABLE . ")";
+ // 2009-08-17 robbat2 - use a JOIN to get 100% index hitrate.
+ $sql = 'DELETE sr FROM ' . SEARCH_TABLE . ' sr
+ LEFT JOIN ' . SESSIONS_TABLE . ' se USING (session_id)
+ WHERE se.session_id IS NULL;'
+
if ( ! ($result = $db->sql_query($sql)) )
{
// hackity hack hack
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs: search.php
@ 2010-07-23 6:49 Dean Stephens (desultory)
0 siblings, 0 replies; 7+ messages in thread
From: Dean Stephens (desultory) @ 2010-07-23 6:49 UTC (permalink / raw
To: gentoo-commits
desultory 10/07/23 06:49:15
Modified: search.php
Log:
Let php seed the rng. Cheaply swap replace for update, real fix to follow.
Revision Changes Path
1.30 forums/htdocs/search.php
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/search.php?rev=1.30&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/search.php?rev=1.30&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/search.php?r1=1.29&r2=1.30
Index: search.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/search.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- search.php 18 Aug 2009 05:38:52 -0000 1.29
+++ search.php 23 Jul 2010 06:49:15 -0000 1.30
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: search.php,v 1.29 2009/08/18 05:38:52 robbat2 Exp $
+ * $Id: search.php,v 1.30 2010/07/23 06:49:15 desultory Exp $
*
*
***************************************************************************/
@@ -697,7 +697,8 @@
// before trying to insert or update.
do
{
- mt_srand ((double) microtime() * 1000000);
+ // PHP after 4.4.2 seeds the pool automatically. -- desultory
+ //mt_srand ((double) microtime() * 1000000);
$search_id = mt_rand();
$sql="SELECT search_id from " . SEARCH_TABLE . " where search_id = $search_id";
@@ -710,12 +711,16 @@
while($row['search_id']);
// - end of changes
- $sql = "UPDATE " . SEARCH_TABLE . "
+ // More tweaking to keep from breaking db replication, real fix to follow. -- desultory
+ //$sql = "UPDATE " . SEARCH_TABLE . "
+ $sql = "REPLACE INTO " . SEARCH_TABLE . "
SET search_id = $search_id, search_time = $current_time, search_array = '" . str_replace("\'", "''", $result_array) . "'
WHERE session_id = '" . $userdata['session_id'] . "'";
if ( !($result = $db->sql_query($sql)) || !$db->sql_affectedrows() )
{
- $sql = "INSERT INTO " . SEARCH_TABLE . " (search_id, session_id, search_time, search_array)
+ // Overwrite duplicate search_id values, better fix to follow. -- desultory
+ //$sql = "INSERT INTO " . SEARCH_TABLE . " (search_id, session_id, search_time, search_array)
+ $sql = "REPLACE INTO " . SEARCH_TABLE . " (search_id, session_id, search_time, search_array)
VALUES($search_id, '" . $userdata['session_id'] . "', $current_time, '" . str_replace("\'", "''", $result_array) . "')";
if ( !($result = $db->sql_query($sql)) )
{
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs: search.php
@ 2009-08-18 5:38 Robin H. Johnson (robbat2)
0 siblings, 0 replies; 7+ messages in thread
From: Robin H. Johnson (robbat2) @ 2009-08-18 5:38 UTC (permalink / raw
To: gentoo-commits
robbat2 09/08/18 05:38:52
Modified: search.php
Log:
Missing semicolon.
Revision Changes Path
1.29 forums/htdocs/search.php
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.29&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.29&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?r1=1.28&r2=1.29
Index: search.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/search.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -p -w -b -B -u -u -r1.28 -r1.29
--- search.php 18 Aug 2009 05:36:32 -0000 1.28
+++ search.php 18 Aug 2009 05:38:52 -0000 1.29
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: search.php,v 1.28 2009/08/18 05:36:32 robbat2 Exp $
+ * $Id: search.php,v 1.29 2009/08/18 05:38:52 robbat2 Exp $
*
*
***************************************************************************/
@@ -643,8 +643,7 @@ else if ( $search_keywords != '' || $sea
// 2009-08-17 robbat2 - use a JOIN to get 100% index hitrate.
$sql = 'DELETE sr FROM ' . SEARCH_TABLE . ' sr
LEFT JOIN ' . SESSIONS_TABLE . ' se USING (session_id)
- WHERE se.session_id IS NULL;'
-
+ WHERE se.session_id IS NULL;';
if ( ! ($result = $db->sql_query($sql)) )
{
// hackity hack hack
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs: search.php
@ 2008-07-01 21:59 Tom Knight (tomk)
0 siblings, 0 replies; 7+ messages in thread
From: Tom Knight (tomk) @ 2008-07-01 21:59 UTC (permalink / raw
To: gentoo-commits
tomk 08/07/01 21:59:29
Modified: search.php
Log:
quick hack for now
Revision Changes Path
1.26 forums/htdocs/search.php
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.26&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.26&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?r1=1.25&r2=1.26
Index: search.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/search.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- search.php 1 Jul 2008 21:35:21 -0000 1.25
+++ search.php 1 Jul 2008 21:59:28 -0000 1.26
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: search.php,v 1.25 2008/07/01 21:35:21 tomk Exp $
+ * $Id: search.php,v 1.26 2008/07/01 21:59:28 tomk Exp $
*
*
***************************************************************************/
@@ -642,7 +642,8 @@
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);
+ // hackity hack hack
+ //message_die(GENERAL_ERROR, 'Could not delete old search id sessions', '', __LINE__, __FILE__, $sql);
}
//
--
gentoo-commits@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs: search.php
@ 2008-07-01 21:35 Tom Knight (tomk)
0 siblings, 0 replies; 7+ messages in thread
From: Tom Knight (tomk) @ 2008-07-01 21:35 UTC (permalink / raw
To: gentoo-commits
tomk 08/07/01 21:35:21
Modified: search.php
Log:
prevent errors
Revision Changes Path
1.25 forums/htdocs/search.php
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.25&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.25&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?r1=1.24&r2=1.25
Index: search.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/search.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- search.php 1 Jul 2008 21:09:52 -0000 1.24
+++ search.php 1 Jul 2008 21:35:21 -0000 1.25
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: search.php,v 1.24 2008/07/01 21:09:52 tomk Exp $
+ * $Id: search.php,v 1.25 2008/07/01 21:35:21 tomk Exp $
*
*
***************************************************************************/
@@ -640,7 +640,7 @@
// 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) )
+ if ( ! ($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not delete old search id sessions', '', __LINE__, __FILE__, $sql);
}
--
gentoo-commits@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs: search.php
@ 2008-07-01 21:09 Tom Knight (tomk)
0 siblings, 0 replies; 7+ messages in thread
From: Tom Knight (tomk) @ 2008-07-01 21:09 UTC (permalink / raw
To: gentoo-commits
tomk 08/07/01 21:09:53
Modified: search.php
Log:
Removed stray braces
Revision Changes Path
1.24 forums/htdocs/search.php
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.24&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?rev=1.24&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/forums/htdocs/search.php?r1=1.23&r2=1.24
Index: search.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/search.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- search.php 1 Jul 2008 20:33:53 -0000 1.23
+++ search.php 1 Jul 2008 21:09:52 -0000 1.24
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: search.php,v 1.23 2008/07/01 20:33:53 tomk Exp $
+ * $Id: search.php,v 1.24 2008/07/01 21:09:52 tomk Exp $
*
*
***************************************************************************/
@@ -644,8 +644,7 @@
{
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs: search.php
@ 2008-07-01 20:33 Tom Knight (tomk)
0 siblings, 0 replies; 7+ messages in thread
From: Tom Knight (tomk) @ 2008-07-01 20:33 UTC (permalink / raw
To: gentoo-commits
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-07-23 6:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-18 5:36 [gentoo-commits] gentoo-projects commit in forums/htdocs: search.php Robin H. Johnson (robbat2)
-- strict thread matches above, loose matches on Subject: below --
2010-07-23 6:49 Dean Stephens (desultory)
2009-08-18 5:38 Robin H. Johnson (robbat2)
2008-07-01 21:59 Tom Knight (tomk)
2008-07-01 21:35 Tom Knight (tomk)
2008-07-01 21:09 Tom Knight (tomk)
2008-07-01 20:33 Tom Knight (tomk)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox