From f6d65e533c62f6deb21342d4901ece24497b433e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 4 Jun 2015 07:31:04 +0200 Subject: Update to MediaWiki 1.25.1 --- includes/UserArray.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'includes/UserArray.php') diff --git a/includes/UserArray.php b/includes/UserArray.php index 7da65827..31bd601c 100644 --- a/includes/UserArray.php +++ b/includes/UserArray.php @@ -27,7 +27,7 @@ abstract class UserArray implements Iterator { */ static function newFromResult( $res ) { $userArray = null; - if ( !wfRunHooks( 'UserArrayFromResult', array( &$userArray, $res ) ) ) { + if ( !Hooks::run( 'UserArrayFromResult', array( &$userArray, $res ) ) ) { return null; } if ( $userArray === null ) { @@ -56,6 +56,27 @@ abstract class UserArray implements Iterator { return self::newFromResult( $res ); } + /** + * @since 1.25 + * @param array $names + * @return UserArrayFromResult + */ + static function newFromNames( $names ) { + $names = array_map( 'strval', (array)$names ); // paranoia + if ( !$names ) { + // Database::select() doesn't like empty arrays + return new ArrayIterator( array() ); + } + $dbr = wfGetDB( DB_SLAVE ); + $res = $dbr->select( + 'user', + User::selectFields(), + array( 'user_name' => array_unique( $names ) ), + __METHOD__ + ); + return self::newFromResult( $res ); + } + /** * @param ResultWrapper $res * @return UserArrayFromResult -- cgit v1.2.3-54-g00ecf