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

Revision: 73190
Author:   kaldari
Date:     2010-09-17 00:19:21 +0000 (Fri, 17 Sep 2010)

Log Message:
-----------
fix for no campaigns running, fix global var assignments for SpecialBannerLoader

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

Modified: trunk/extensions/CentralNotice/CentralNotice.db.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.db.php 2010-09-17 00:16:59 UTC 
(rev 73189)
+++ trunk/extensions/CentralNotice/CentralNotice.db.php 2010-09-17 00:19:21 UTC 
(rev 73190)
@@ -124,29 +124,31 @@
        static function selectTemplatesAssigned( $campaigns ) {
                $dbr = wfGetDB( DB_SLAVE );
 
-               // Pull templates based on join with assignments
-               $res = $dbr->select(
-                       array(
-                               'cn_notices',
-                               'cn_assignments',
-                               'cn_templates'
-                       ),
-                       array(
-                               'tmp_name',
-                               'SUM(tmp_weight) AS total_weight',
-                               'tmp_display_anon',
-                               'tmp_display_account'
-                       ),
-                       array(
-                               'cn_notices.not_id' => $campaigns,
-                               'cn_notices.not_id = cn_assignments.not_id',
-                               'cn_assignments.tmp_id = cn_templates.tmp_id'
-                       ),
-                       __METHOD__,
-                       array(
-                               'GROUP BY' => 'tmp_name'
-                       )
-               );
+               if ( $campaigns ) {
+                       // Pull templates based on join with assignments
+                       $res = $dbr->select(
+                               array(
+                                       'cn_notices',
+                                       'cn_assignments',
+                                       'cn_templates'
+                               ),
+                               array(
+                                       'tmp_name',
+                                       'SUM(tmp_weight) AS total_weight',
+                                       'tmp_display_anon',
+                                       'tmp_display_account'
+                               ),
+                               array(
+                                       'cn_notices.not_id' => $campaigns,
+                                       'cn_notices.not_id = 
cn_assignments.not_id',
+                                       'cn_assignments.tmp_id = 
cn_templates.tmp_id'
+                               ),
+                               __METHOD__,
+                               array(
+                                       'GROUP BY' => 'tmp_name'
+                               )
+                       );
+               }
                $templates = array();
                foreach ( $res as $row ) {
                        $template = array();

Modified: trunk/extensions/CentralNotice/SpecialCentralNotice.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialCentralNotice.php     2010-09-17 
00:16:59 UTC (rev 73189)
+++ trunk/extensions/CentralNotice/SpecialCentralNotice.php     2010-09-17 
00:19:21 UTC (rev 73190)
@@ -937,7 +937,7 @@
 
                        $viewPage = $this->getTitleFor( 'NoticeTemplate', 
'view' );
                        $render = new SpecialBannerLoader();
-                       $render->project = 'wikipedia';
+                       $render->siteName = 'Wikipedia';
                        global $wgRequest;
                        $render->language = $wgRequest->getVal( 
'wpUserLanguage' );
                        $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
@@ -1066,8 +1066,10 @@
                }
                
                $templates = array();
-               // Pull all banners assigned to the campaigns
-               $templates = CentralNoticeDB::selectTemplatesAssigned( 
$campaigns );
+               if ( $campaigns ) {
+                       // Pull all banners assigned to the campaigns
+                       $templates = CentralNoticeDB::selectTemplatesAssigned( 
$campaigns );
+               }
                return $templates;
        }
 
@@ -1872,7 +1874,7 @@
                // Link and Preview
                $viewPage = SpecialPage::getTitleFor( 'NoticeTemplate', 'view' 
);
                $render = new SpecialBannerLoader();
-               $render->project = 'wikipedia';
+               $render->siteName = 'Wikipedia';
                $render->language = $this->mRequest->getVal( 'wpUserLanguage' );
                $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
                        $this->getSkin()->makeLinkObj( $this->viewPage,



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

Reply via email to