Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php |
— | — | @@ -1085,7 +1085,10 @@ |
1086 | 1086 | } |
1087 | 1087 | } |
1088 | 1088 | |
1089 | | - function getNoticeId ( $noticeName ) { |
| 1089 | + /** |
| 1090 | + * Lookup the ID for a campaign based on the campaign name |
| 1091 | + */ |
| 1092 | + public function getNoticeId( $noticeName ) { |
1090 | 1093 | $dbr = wfGetDB( DB_SLAVE ); |
1091 | 1094 | $eNoticeName = htmlspecialchars( $noticeName ); |
1092 | 1095 | $res = $dbr->select( 'cn_notices', 'not_id', array( 'not_name' => $eNoticeName ) ); |
— | — | @@ -1341,19 +1344,16 @@ |
1342 | 1345 | */ |
1343 | 1346 | function getQueryInfo() { |
1344 | 1347 | $notice = $this->mRequest->getVal( 'notice' ); |
| 1348 | + $noticeId = CentralNotice::getNoticeId( $notice ); |
1345 | 1349 | // Return all the banners not already assigned to the current campaign |
1346 | 1350 | return array( |
1347 | | - 'tables' => array( 'cn_templates', 'cn_assignments', 'cn_notices' ), |
| 1351 | + 'tables' => array( 'cn_assignments', 'cn_templates' ), |
1348 | 1352 | 'fields' => array( 'cn_templates.tmp_name', 'cn_templates.tmp_id' ), |
1349 | | - 'conds' => array( 'cn_notices.not_id IS NULL' ), |
| 1353 | + 'conds' => array( 'cn_assignments.tmp_id IS NULL' ), |
1350 | 1354 | 'join_conds' => array( |
1351 | 1355 | 'cn_assignments' => array( |
1352 | 1356 | 'LEFT JOIN', |
1353 | | - 'cn_assignments.tmp_id = cn_templates.tmp_id' |
1354 | | - ), |
1355 | | - 'cn_notices' => array( |
1356 | | - 'LEFT JOIN', |
1357 | | - "cn_notices.not_id = cn_assignments.not_id AND cn_notices.not_name = '$notice'" |
| 1357 | + "cn_assignments.tmp_id = cn_templates.tmp_id AND cn_assignments.not_id = $noticeId" |
1358 | 1358 | ) |
1359 | 1359 | ) |
1360 | 1360 | ); |