r91522 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91521‎ | r91522 | r91523 >
Date:03:50, 6 July 2011
Author:kaldari
Status:resolved (Comments)
Tags:
Comment:
CentralNotice settings log - adding projects, languages, and countries
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.db.php (modified) (history)
  • /trunk/extensions/CentralNotice/special/SpecialCentralNotice.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/special/SpecialCentralNotice.php
@@ -1331,7 +1331,7 @@
13321332 return null;
13331333 }
13341334
1335 - function getNoticeProjects( $noticeName ) {
 1335+ static function getNoticeProjects( $noticeName ) {
13361336 $dbr = wfGetDB( DB_SLAVE );
13371337 $eNoticeName = htmlspecialchars( $noticeName );
13381338 $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 'not_name' => $eNoticeName ) );
@@ -1346,7 +1346,7 @@
13471347 return $projects;
13481348 }
13491349
1350 - function getNoticeLanguages( $noticeName ) {
 1350+ static function getNoticeLanguages( $noticeName ) {
13511351 $dbr = wfGetDB( DB_SLAVE );
13521352 $eNoticeName = htmlspecialchars( $noticeName );
13531353 $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 'not_name' => $eNoticeName ) );
@@ -1361,7 +1361,7 @@
13621362 return $languages;
13631363 }
13641364
1365 - function getNoticeCountries( $noticeName ) {
 1365+ static function getNoticeCountries( $noticeName ) {
13661366 $dbr = wfGetDB( DB_SLAVE );
13671367 $eNoticeName = htmlspecialchars( $noticeName );
13681368 $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 'not_name' => $eNoticeName ) );
Index: trunk/extensions/CentralNotice/CentralNotice.db.php
@@ -156,7 +156,14 @@
157157 'geo' => $row->not_geo
158158 );
159159 }
160 - // TODO: Add languages, projects, and countries
 160+
 161+ $projects = CentralNotice::getNoticeProjects( $campaignName );
 162+ $languages = CentralNotice::getNoticeLanguages( $campaignName );
 163+ $geo_countries = CentralNotice::getNoticeCountries( $campaignName );
 164+ $campaign['projects'] = implode( ", ", $projects );
 165+ $campaign['languages'] = implode( ", ", $languages );
 166+ $campaign['countries'] = implode( ", ", $geo_countries );
 167+
161168 return $campaign;
162169 }
163170

Follow-up revisions

RevisionCommit summaryAuthorDate
r92214follow-up to r91522, calling static methods as static methodskaldari23:09, 14 July 2011

Comments

#Comment by Awjrichards (talk | contribs)   21:00, 14 July 2011

With your static methods, be sure you're calling them as static methods elsewhere in code.

#Comment by 😂 (talk | contribs)   21:01, 14 July 2011

It looks nicer yes, but isn't required :)

#Comment by Kaldari (talk | contribs)   23:10, 14 July 2011

Fixed anyway in r92214.

Status & tagging log