r100314 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100313‎ | r100314 | r100315 >
Date:01:05, 20 October 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
slice, not splice and made getUser a bit more robust
Modified paths:
  • /trunk/extensions/Contest/api/ApiMailContestants.php (modified) (history)
  • /trunk/extensions/Contest/includes/ContestContestant.php (modified) (history)

Diff [purge]

Index: trunk/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: trunk/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 {

Follow-up revisions

RevisionCommit summaryAuthorDate
r1003191.18wmf1 MFT r100314, r100316reedy01:31, 20 October 2011

Status & tagging log