Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r18385: LJSUP-8017 (New abuse/support tool for s...

Committer: ailyin
LJSUP-8017 (New abuse/support tool for searching comments)
U   trunk/cgi-bin/LJ/Comment.pm
Modified: trunk/cgi-bin/LJ/Comment.pm
===================================================================
--- trunk/cgi-bin/LJ/Comment.pm	2011-02-22 11:27:59 UTC (rev 18384)
+++ trunk/cgi-bin/LJ/Comment.pm	2011-02-22 11:34:31 UTC (rev 18385)
@@ -1709,6 +1709,7 @@
 # * entry (optional)
 # * before/after (jtalkids)
 # * limit (defaults to 1000)
+# * order: ASC/DESC (always orders by jtalkid, defaults to desc)
 #
 # returns: arrayref containing LJ::Comment objects
 sub select {
@@ -1717,6 +1718,7 @@
     $params ||= {};
 
     my $limit = int ( delete $params->{'limit'} || 1000 );
+    my $order = delete $params->{'order'} || 'DESC';
 
     my ( @where_sql, @where_binds );
 
@@ -1750,7 +1752,13 @@
     $udbr->{'RaiseError'} = 1;
 
     my $jtalkids = $udbr->selectcol_arrayref(
-        "SELECT jtalkid FROM talk2 WHERE $where_sql LIMIT $limit",
+        qq{
+            SELECT jtalkid
+            FROM talk2
+            WHERE $where_sql
+            ORDER BY jtalkid $order
+            LIMIT $limit
+        },
         undef, @where_binds
     );
 

Tags: andy, livejournal, pm
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments