r100319 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100318‎ | r100319 | r100320 >
Date:01:31, 20 October 2011
Author:reedy
Status:old
Tags:
Comment:
1.18wmf1 MFT r100314, r100316
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/Contest (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/Contest.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/api/ApiMailContestants.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/includes/ContestContestant.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/includes/ContestReminderJob.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/Contest/Contest.php
@@ -101,6 +101,9 @@
102102 $wgAPIListModules['contestcomments'] = 'ApiQueryContestComments';
103103 $wgAPIListModules['contests'] = 'ApiQueryContests';
104104
 105+// Jobs
 106+$wgJobClasses['ContestReminderJob'] = 'ContestReminderJob';
 107+
105108 // Hooks
106109 $wgHooks['LoadExtensionSchemaUpdates'][] = 'ContestHooks::onSchemaUpdate';
107110 $wgHooks['UnitTestsList'][] = 'ContestHooks::registerUnitTests';
Index: branches/wmf/1.18wmf1/extensions/Contest/includes/ContestReminderJob.php
@@ -22,8 +22,8 @@
2323 * * contest, Contest, required
2424 */
2525 public function __construct( Title $title, array $params ) {
26 - parent::__construct( 'ContestReminderJob', $title, $params );
27 - $this->params['emailText'] = ContestUtils::getParsedArticleContent( $this->params['reminder_email'] );
 26+ parent::__construct( __CLASS__, $title, $params );
 27+ $this->params['emailText'] = ContestUtils::getParsedArticleContent( $this->params['contest']->getField( 'reminder_email' ) );
2828 $this->params['daysLeft'] = $this->params['contest']->getDaysLeft();
2929 }
3030
Index: branches/wmf/1.18wmf1/extensions/Contest/includes/ContestContestant.php
@@ -571,6 +571,15 @@
572572 */
573573 public function getUser() {
574574 if ( is_null( $this->user ) ) {
 575+ if ( !$this->hasField( 'user_id' ) ) {
 576+ if ( is_null( $this->getId() ) ) {
 577+ throw new MWException( 'Can not get an user object when the user_id field is not set.' );
 578+ }
 579+ else {
 580+ $this->loadFields( 'user_id' );
 581+ }
 582+ }
 583+
575584 $this->user = User::newFromId( $this->getField( 'user_id' ) );
576585 }
577586
Index: branches/wmf/1.18wmf1/extensions/Contest/api/ApiMailContestants.php
@@ -78,7 +78,7 @@
7979 $limit = count( $contestants );
8080
8181 for ( $i = 0; $i <= $limit; $i += $setSize ) {
82 - $this->createReminderJob( array_splice( $contestants, $i, $setSize ) );
 82+ $this->createReminderJob( array_slice( $contestants, $i, $setSize ) );
8383 }
8484 }
8585 else {
Property changes on: branches/wmf/1.18wmf1/extensions/Contest
___________________________________________________________________
Modified: svn:mergeinfo
8686 Merged /trunk/extensions/Contest:r100314,100316

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r100314slice, not splice and made getUser a bit more robustjeroendedauw01:05, 20 October 2011
r100316minor fixesjeroendedauw01:24, 20 October 2011

Status & tagging log