http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95758

Revision: 95758
Author:   nikerabbit
Date:     2011-08-30 11:55:32 +0000 (Tue, 30 Aug 2011)
Log Message:
-----------
Simplify translationChanges()

Modified Paths:
--------------
    trunk/extensions/Translate/TranslateUtils.php

Modified: trunk/extensions/Translate/TranslateUtils.php
===================================================================
--- trunk/extensions/Translate/TranslateUtils.php       2011-08-30 11:44:41 UTC 
(rev 95757)
+++ trunk/extensions/Translate/TranslateUtils.php       2011-08-30 11:55:32 UTC 
(rev 95758)
@@ -119,6 +119,9 @@
                $cutoff = $dbr->timestamp( $cutoff_unixtime );
 
                $namespaces = $dbr->makeList( $wgTranslateMessageNamespaces );
+               if ( $ns ) {
+                       $namespaces = $dbr->makeList( $ns );
+               }
 
                $fields = 'rc_title, rc_timestamp, rc_user_text, rc_namespace';
 
@@ -126,18 +129,11 @@
                $sql = "SELECT $fields, substring_index(rc_title, '/', -1) as 
lang FROM $recentchanges " .
                "WHERE rc_timestamp >= '{$cutoff}' " .
                ( $bots ? '' : 'AND rc_bot = 0 ' ) .
-               ( $ns ? 'AND rc_namespace IN (' . implode( ',', $ns ) . ') ' : 
"AND rc_namespace in ($namespaces) " ) .
+               "AND rc_namespace in ($namespaces) " .
                "ORDER BY lang ASC, rc_timestamp DESC";
 
                $res = $dbr->query( $sql, __METHOD__ );
-
-               // Fetch results, prepare a batch link existence check query.
-               $rows = array();
-               foreach( $res as $row ) {
-                       $rows[] = $row;
-               }
-               $dbr->freeResult( $res );
-
+               $rows = iterator_to_array( $res ); 
                return $rows;
        }
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to