From 222b01f5169f1c7e69762e0e8904c24f78f71882 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 28 Jul 2010 11:52:48 +0200 Subject: update to MediaWiki 1.16.0 --- includes/UserRightsProxy.php | 73 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 8 deletions(-) (limited to 'includes/UserRightsProxy.php') diff --git a/includes/UserRightsProxy.php b/includes/UserRightsProxy.php index 8a65a01a..0d6b8151 100644 --- a/includes/UserRightsProxy.php +++ b/includes/UserRightsProxy.php @@ -1,11 +1,21 @@ db = $db; $this->database = $database; @@ -13,15 +23,33 @@ class UserRightsProxy { $this->id = intval( $id ); } + /** + * Accessor for $this->database + * + * @return String: database name + */ + public function getDBName() { + return $this->database; + } + /** * Confirm the selected database name is a valid local interwiki database name. - * @return bool + * + * @param $database String: database name + * @return Boolean */ public static function validDatabase( $database ) { global $wgLocalDatabases; return in_array( $database, $wgLocalDatabases ); } + /** + * Same as User::whoIs() + * + * @param $database String: database name + * @param $id Integer: user ID + * @return String: user name or false if the user doesn't exist + */ public static function whoIs( $database, $id ) { $user = self::newFromId( $database, $id ); if( $user ) { @@ -33,12 +61,22 @@ class UserRightsProxy { /** * Factory function; get a remote user entry by ID number. + * + * @param $database String: database name + * @param $id Integer: user ID * @return UserRightsProxy or null if doesn't exist */ public static function newFromId( $database, $id ) { return self::newFromLookup( $database, 'user_id', intval( $id ) ); } + /** + * Factory function; get a remote user entry by name. + * + * @param $database String: database name + * @param $name String: user name + * @return UserRightsProxy or null if doesn't exist + */ public static function newFromName( $database, $name ) { return self::newFromLookup( $database, 'user_name', $name ); } @@ -62,8 +100,9 @@ class UserRightsProxy { /** * Open a database connection to work on for the requested user. * This may be a new connection to another database for remote users. - * @param $database string - * @return Database or null if invalid selection + * + * @param $database String + * @return DatabaseBase or null if invalid selection */ public static function getDB( $database ) { global $wgLocalDatabases, $wgDBname; @@ -86,15 +125,27 @@ class UserRightsProxy { return $this->getId() == 0; } + /** + * Same as User::getName() + * + * @return String + */ public function getName() { return $this->name . '@' . $this->database; } + /** + * Same as User::getUserPage() + * + * @return Title object + */ public function getUserPage() { return Title::makeTitle( NS_USER, $this->getName() ); } - // Replaces getUserGroups() + /** + * Replaces User::getUserGroups() + */ function getGroups() { $res = $this->db->select( 'user_groups', array( 'ug_group' ), @@ -107,7 +158,9 @@ class UserRightsProxy { return $groups; } - // replaces addUserGroup + /** + * Replaces User::addUserGroup() + */ function addGroup( $group ) { $this->db->insert( 'user_groups', array( @@ -118,7 +171,9 @@ class UserRightsProxy { array( 'IGNORE' ) ); } - // replaces removeUserGroup + /** + * Replaces User::removeUserGroup() + */ function removeGroup( $group ) { $this->db->delete( 'user_groups', array( @@ -128,7 +183,9 @@ class UserRightsProxy { __METHOD__ ); } - // replaces touchUser + /** + * Replaces User::touchUser() + */ function invalidateCache() { $this->db->update( 'user', array( 'user_touched' => $this->db->timestamp() ), -- cgit v1.2.3-54-g00ecf