X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fdrush%2Fdrush%2Flib%2FDrush%2FUser%2FUserList.php;fp=vendor%2Fdrush%2Fdrush%2Flib%2FDrush%2FUser%2FUserList.php;h=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=3c38e2132d7a30b1d4ca6767e348ddd67aef6715;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/vendor/drush/drush/lib/Drush/User/UserList.php b/vendor/drush/drush/lib/Drush/User/UserList.php deleted file mode 100644 index 3c38e2132..000000000 --- a/vendor/drush/drush/lib/Drush/User/UserList.php +++ /dev/null @@ -1,134 +0,0 @@ -accounts = $this->getFromOptions() + $this->getFromParameters($inputs)) { - return $this; - } - else { - throw new UserListException('Unable to find a matching user.'); - } - } - - /** - * Iterate over each account and call the specified method. - * - * @param $method - * A method on a UserSingleBase object. - * @param array $params - * An array of params to pass to the method. - * @return array - * An associate array of values keyed by account ID. - */ - public function each($method, array $params = array()) { - foreach ($this->accounts as $account) { - $return[$account->id()] = call_user_func_array(array($account, $method), $params); - } - return $return; - } - - /* - * Check common options for specifying users. If valid, return the accounts. - * - * @return \Drush\User\UserSingleBase[] - */ - function getFromOptions() { - $accounts = array(); - $userversion = drush_user_get_class(); - if ($mails = _convert_csv_to_array(drush_get_option('mail'))) { - foreach ($mails as $mail) { - if ($account = $userversion->load_by_mail($mail)) { - $single = drush_usersingle_get_class($account); - $accounts[$single->id()] = $single; - } - else { - throw new UserListException('Unable to find a matching user for ' . $mail . '.'); - } - } - } - if ($names = _convert_csv_to_array(drush_get_option('name'))) { - foreach ($names as $name) { - if ($account = $userversion->load_by_name($name)) { - $single = drush_usersingle_get_class($account); - $accounts[$single->id()] = $single; - } - else { - throw new UserListException('Unable to find a matching user for ' . $name . '.'); - } - } - } - if ($userids = _convert_csv_to_array(drush_get_option('uid'))) { - foreach ($userids as $userid) { - if (is_numeric($userid) && $account = $userversion->load_by_uid($userid)) { - $single = drush_usersingle_get_class($account); - $accounts[$single->id()] = $single; - } - else { - throw new UserListException('Unable to find a matching user for ' . $userid . '.'); - } - } - } - return $accounts; - } - - /** - * Given a comma-separated list of inputs, return accounts - * for users that match by uid,name or email address. - * - * @param string $inputs - * A comma delimited string (or array) of arguments, specifying user account(s). - * - * @throws UserListException - * If any input is unmatched, an exception is thrown. - * - * @return \Drush\User\UserSingleBase[] - * An associative array of UserSingleBase objects, keyed by user id. - */ - public static function getFromParameters($inputs) { - $accounts = array(); - $userversion = drush_user_get_class(); - if ($inputs && $userversion) { - $inputs = _convert_csv_to_array($inputs); - foreach($inputs as $input) { - if (is_numeric($input) && $account = $userversion->load_by_uid($input)) { - - } - elseif ($account = $userversion->load_by_name($input)) { - - } - elseif ($account = $userversion->load_by_mail($input)) { - - } - else { - // Unable to load an account for the input. - throw new UserListException('Unable to find a matching user for ' . $input . '.'); - } - // Populate $accounts with a UserSingle object. Will go into $this->accounts. - $single = drush_usersingle_get_class($account); - $accounts[$single->id()] = $single; - } - } - return $accounts; - } - - /* - * A comma delimited list of names built from $this->accounts. - */ - public function names() { - $names = array(); - foreach ($this->accounts as $account) { - $names[] = $account->getUsername(); - } - return implode(', ', $names); - } -}