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

Revision: 90642
Author:   kaldari
Date:     2011-06-23 00:55:30 +0000 (Thu, 23 Jun 2011)
Log Message:
-----------
pull banners with a single db query per comment at r89294

Modified Paths:
--------------
    trunk/extensions/CentralNotice/CentralNotice.db.php

Modified: trunk/extensions/CentralNotice/CentralNotice.db.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.db.php 2011-06-23 00:54:24 UTC 
(rev 90641)
+++ trunk/extensions/CentralNotice/CentralNotice.db.php 2011-06-23 00:55:30 UTC 
(rev 90642)
@@ -132,40 +132,39 @@
                $templates = array();
 
                if ( $campaigns ) {
-                       foreach ( $campaigns as $campaignId ) {
-                               $res = $dbr->select(
-                                       array(
-                                               'cn_notices',
-                                               'cn_assignments',
-                                               'cn_templates'
-                                       ),
-                                       array(
-                                               'tmp_name',
-                                               'tmp_weight',
-                                               'tmp_display_anon',
-                                               'tmp_display_account',
-                                               'tmp_fundraising',
-                                               'tmp_landing_pages'
-                                       ),
-                                       array(
-                                               'cn_notices.not_id' => 
$campaignId,
-                                               'cn_notices.not_id = 
cn_assignments.not_id',
-                                               'cn_assignments.tmp_id = 
cn_templates.tmp_id'
-                                       ),
-                                       __METHOD__
+                       $res = $dbr->select(
+                               array(
+                                       'cn_notices',
+                                       'cn_assignments',
+                                       'cn_templates'
+                               ),
+                               array(
+                                       'tmp_name',
+                                       'tmp_weight',
+                                       'tmp_display_anon',
+                                       'tmp_display_account',
+                                       'tmp_fundraising',
+                                       'tmp_landing_pages',
+                                       'not_name'
+                               ),
+                               array(
+                                       'cn_notices.not_id' => $campaigns,
+                                       'cn_notices.not_id = 
cn_assignments.not_id',
+                                       'cn_assignments.tmp_id = 
cn_templates.tmp_id'
+                               ),
+                               __METHOD__
+                       );
+
+                       foreach ( $res as $row ) {
+                               $templates[] = array(
+                                       'name' => $row->tmp_name,
+                                       'weight' => intval( $row->tmp_weight ),
+                                       'display_anon' => intval( 
$row->tmp_display_anon ),
+                                       'display_account' => intval( 
$row->tmp_display_account ),
+                                       'fundraising' => intval( 
$row->tmp_fundraising ),
+                                       'landing_pages' => 
$row->tmp_landing_pages,
+                                       'campaign' => $row->not_name
                                );
-       
-                               foreach ( $res as $row ) {
-                                       $templates[] = array(
-                                               'name' => $row->tmp_name,
-                                               'weight' => intval( 
$row->tmp_weight ),
-                                               'display_anon' => intval( 
$row->tmp_display_anon ),
-                                               'display_account' => intval( 
$row->tmp_display_account ),
-                                               'fundraising' => intval( 
$row->tmp_fundraising ),
-                                               'landing_pages' => 
$row->tmp_landing_pages,
-                                               'campaign' => 
CentralNotice::getNoticeName( $campaignId )
-                                       );
-                               }
                        }
                }
                return $templates;


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

Reply via email to