http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100314

Revision: 100314
Author:   jeroendedauw
Date:     2011-10-20 01:05:52 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
slice, not splice and made getUser a bit more robust

Modified Paths:
--------------
    trunk/extensions/Contest/api/ApiMailContestants.php
    trunk/extensions/Contest/includes/ContestContestant.php

Modified: trunk/extensions/Contest/api/ApiMailContestants.php
===================================================================
--- trunk/extensions/Contest/api/ApiMailContestants.php 2011-10-20 01:03:40 UTC 
(rev 100313)
+++ trunk/extensions/Contest/api/ApiMailContestants.php 2011-10-20 01:05:52 UTC 
(rev 100314)
@@ -78,7 +78,7 @@
                        $limit = count( $contestants );
 
                        for ( $i = 0; $i <= $limit; $i += $setSize ) {
-                               $this->createReminderJob( array_splice( 
$contestants, $i, $setSize ) );
+                               $this->createReminderJob( array_slice( 
$contestants, $i, $setSize ) );
                        }
                }
                else {

Modified: trunk/extensions/Contest/includes/ContestContestant.php
===================================================================
--- trunk/extensions/Contest/includes/ContestContestant.php     2011-10-20 
01:03:40 UTC (rev 100313)
+++ trunk/extensions/Contest/includes/ContestContestant.php     2011-10-20 
01:05:52 UTC (rev 100314)
@@ -571,6 +571,15 @@
         */
        public function getUser() {
                if ( is_null( $this->user ) ) {
+                       if ( !$this->hasField( 'user_id' ) ) {
+                               if ( is_null( $this->getId() ) ) {
+                                       throw new MWException( 'Can not get an 
user object when the user_id field is not set.' );
+                               }
+                               else {
+                                       $this->loadFields( 'user_id' );
+                               }
+                       }
+                       
                        $this->user = User::newFromId( $this->getField( 
'user_id' ) );
                }
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to