From: Aaron Schulz Date: Mon, 30 Mar 2015 18:13:46 +0000 (-0700) Subject: Made User::getFormerGroups load properly X-Git-Tag: 1.31.0-rc.0~11937^2 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=ab24e5d4174c3ffa1d6dbf02a0801c1fc358513e;p=lhc%2Fweb%2Fwiklou.git Made User::getFormerGroups load properly Change-Id: I5c752f9446ef78f08c457e9758ebf9e0b79a0c37 --- diff --git a/includes/User.php b/includes/User.php index 7f30263c86..ffe1d56728 100644 --- a/includes/User.php +++ b/includes/User.php @@ -3038,8 +3038,12 @@ class User implements IDBAccessObject { * @return array Names of the groups the user has belonged to. */ public function getFormerGroups() { + $this->load(); + if ( is_null( $this->mFormerGroups ) ) { - $dbr = wfGetDB( DB_MASTER ); + $dbr = ( $this->queryFlagsUsed & self::READ_LATEST ) + ? wfGetDB( DB_MASTER ) + : wfGetDB( DB_SLAVE ); $res = $dbr->select( 'user_former_groups', array( 'ufg_group' ), array( 'ufg_user' => $this->mId ), @@ -3049,6 +3053,7 @@ class User implements IDBAccessObject { $this->mFormerGroups[] = $row->ufg_group; } } + return $this->mFormerGroups; }