/**
  * @param $row
  */
 function setCurrent($row)
 {
     parent::setCurrent($row);
     if ($row !== false) {
         $caRow = isset($this->globalData[$row->user_name]) ? $this->globalData[$row->user_name] : false;
         $this->current->centralAuthObj = CentralAuthUser::newFromRow($caRow);
     }
 }
 /**
  * @param $row
  */
 function setCurrent($row)
 {
     parent::setCurrent($row);
     if ($row !== false) {
         if (isset($this->globalData[$row->user_name])) {
             $caRow = $this->globalData[$row->user_name];
             // Like taken from GlobalRenameUserStatus::getNames
             $renameUser = array();
             if ($caRow->ru_oldname) {
                 $renameUser = array($caRow->ru_oldname, $caRow->ru_newname);
             }
             $this->current->centralAuthObj = CentralAuthUser::newFromRow($caRow, $renameUser);
         } else {
             $this->current->centralAuthObj = CentralAuthUser::newUnattached($row->user_name);
         }
     }
 }
예제 #3
0
파일: User.php 프로젝트: paladox/mediawiki
 /**
  * Return the users who are members of the given group(s). In case of multiple groups,
  * users who are members of at least one of them are returned.
  *
  * @param string|array $groups A single group name or an array of group names
  * @param int $limit Max number of users to return. The actual limit will never exceed 5000
  *   records; larger values are ignored.
  * @param int $after ID the user to start after
  * @return UserArrayFromResult
  */
 public static function findUsersByGroup($groups, $limit = 5000, $after = null)
 {
     if ($groups === []) {
         return UserArrayFromResult::newFromIDs([]);
     }
     $groups = array_unique((array) $groups);
     $limit = min(5000, $limit);
     $conds = ['ug_group' => $groups];
     if ($after !== null) {
         $conds[] = 'ug_user > ' . (int) $after;
     }
     $dbr = wfGetDB(DB_REPLICA);
     $ids = $dbr->selectFieldValues('user_groups', 'ug_user', $conds, __METHOD__, ['DISTINCT' => true, 'ORDER BY' => 'ug_user', 'LIMIT' => $limit]) ?: [];
     return UserArray::newFromIDs($ids);
 }