# HG changeset patch
# User Dan
# Date 1241562952 0
# Node ID 93c01ea4366b385fb6597fb6315d1d50b4ce8413
# Parent 8205e4ca237e2b823ff6566f96419cfa4baf5b70
Main portal query is now buffered (but limits selection size) to fix some 1.1.6 issues
diff -r 8205e4ca237e -r 93c01ea4366b plugins/Newsboy.php
--- a/plugins/Newsboy.php Tue May 05 00:21:13 2009 -0400
+++ b/plugins/Newsboy.php Tue May 05 22:35:52 2009 +0000
@@ -439,7 +439,9 @@
echo '
Latest news
';
}
- $q = $db->sql_unbuffered_query('SELECT p.*, COUNT(c.comment_id) AS num_comments, t.page_text, l.time_id, l.author, u.user_level FROM '.table_prefix.'pages AS p
+ $num_articles = intval(getConfig('nb_portal_num_articles', 5));
+
+ $q = $db->sql_query('SELECT p.*, COUNT(c.comment_id) AS num_comments, t.page_text, l.time_id, l.author, u.user_level FROM '.table_prefix.'pages AS p
LEFT JOIN '.table_prefix.'comments AS c
ON ( c.page_id=p.urlname AND c.namespace=p.namespace )
LEFT JOIN '.table_prefix.'page_text AS t
@@ -453,13 +455,12 @@
AND p.urlname!=\'Announce\'
AND p.visible=1
GROUP BY p.urlname
- ORDER BY urlname DESC;');
+ ORDER BY urlname DESC
+ LIMIT ' . ($num_articles + 1) . ';');
if ( !$q )
$db->_die();
- $num_articles = intval(getConfig('nb_portal_num_articles', 5));
-
- if ( $row = $db->fetchrow() )
+ if ( $row = $db->fetchrow($q) )
{
$i = 0;
do
@@ -514,7 +515,7 @@
break;
}
$i++;
- } while ( $row = $db->fetchrow() );
+ } while ( $row = $db->fetchrow($q) );
}
else
{