r71608 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71607‎ | r71608 | r71609 >
Date:00:46, 25 August 2010
Author:kaldari
Status:resolved (Comments)
Tags:
Comment:
new query added in r71580 doesn't work correctly, fixing (albeit with an ugly fix)
Modified paths:
  • /trunk/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -1085,7 +1085,10 @@
10861086 }
10871087 }
10881088
1089 - function getNoticeId ( $noticeName ) {
 1089+ /**
 1090+ * Lookup the ID for a campaign based on the campaign name
 1091+ */
 1092+ public function getNoticeId( $noticeName ) {
10901093 $dbr = wfGetDB( DB_SLAVE );
10911094 $eNoticeName = htmlspecialchars( $noticeName );
10921095 $res = $dbr->select( 'cn_notices', 'not_id', array( 'not_name' => $eNoticeName ) );
@@ -1341,19 +1344,16 @@
13421345 */
13431346 function getQueryInfo() {
13441347 $notice = $this->mRequest->getVal( 'notice' );
 1348+ $noticeId = CentralNotice::getNoticeId( $notice );
13451349 // Return all the banners not already assigned to the current campaign
13461350 return array(
1347 - 'tables' => array( 'cn_templates', 'cn_assignments', 'cn_notices' ),
 1351+ 'tables' => array( 'cn_assignments', 'cn_templates' ),
13481352 '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' ),
13501354 'join_conds' => array(
13511355 'cn_assignments' => array(
13521356 '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"
13581358 )
13591359 )
13601360 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r71633function declaration clean-up, see comment at r71608kaldari17:39, 25 August 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r71580Moving banner paging for notices to a subclass so we don't have a dozen switc...kaldari20:34, 24 August 2010

Comments

#Comment by Catrope (talk | contribs)   16:15, 25 August 2010
+		$noticeId = CentralNotice::getNoticeId( $notice );

getNoticeId() is not declared as static, so calling it statically results in an E_STRICT warning. It looks like the function doesn't use $this, though, so you can declare it as static and it'll be all good.

#Comment by Kaldari (talk | contribs)   17:39, 25 August 2010

fixed in r71633

Status & tagging log