From ab24e5d4174c3ffa1d6dbf02a0801c1fc358513e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 30 Mar 2015 11:13:46 -0700 Subject: [PATCH] Made User::getFormerGroups load properly Change-Id: I5c752f9446ef78f08c457e9758ebf9e0b79a0c37 --- includes/User.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } -- 2.20.1