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

Revision: 97795
Author:   tstarling
Date:     2011-09-22 06:17:26 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
Fixed User::getGroups(), apparently broken since r33333. User::load() doesn't 
load groups anymore, so calling $this->getGroups() was the same as just 
accessing $this->mGroups. Usually it doesn't matter, since most factory 
functions are funnelled into loadFromId() which calls loadGroups() or loads the 
groups from the cache, but loadFromRow() was potentially broken.

It's necessary for User::loadFromRow() to set $this->mGroups to null, same as 
the calling code in User::loadFromDatabase(), so that they will be loaded 
dynamically when User::newFromRow() is called.

No bugs found that are caused by this but it couldn't hurt to have working 
accessors. Tested from eval.php.

Modified Paths:
--------------
    trunk/phase3/includes/User.php

Modified: trunk/phase3/includes/User.php
===================================================================
--- trunk/phase3/includes/User.php      2011-09-22 06:10:45 UTC (rev 97794)
+++ trunk/phase3/includes/User.php      2011-09-22 06:17:26 UTC (rev 97795)
@@ -1053,6 +1053,8 @@
        public function loadFromRow( $row ) {
                $all = true;
 
+               $this->mGroups = null; // deferred
+
                if ( isset( $row->user_name ) ) {
                        $this->mName = $row->user_name;
                        $this->mFrom = 'name';
@@ -2312,6 +2314,7 @@
         */
        public function getGroups() {
                $this->load();
+               $this->loadGroups();
                return $this->mGroups;
        }
 


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

Reply via email to