r92461 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92460‎ | r92461 | r92462 >
Date:19:56, 18 July 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Set explicit public modifier

Swap @private to private
Modified paths:
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -168,7 +168,8 @@
169169 //@{
170170 var $mId, $mName, $mRealName, $mPassword, $mNewpassword, $mNewpassTime,
171171 $mEmail, $mTouched, $mToken, $mEmailAuthenticated,
172 - $mEmailToken, $mEmailTokenExpires, $mRegistration, $mGroups, $mOptionOverrides;
 172+ $mEmailToken, $mEmailTokenExpires, $mRegistration, $mGroups, $mOptionOverrides,
 173+ $mCookiePassword;
173174 //@}
174175
175176 /**
@@ -235,7 +236,7 @@
236237 /**
237238 * Load the user table data for this object from the source given by mFrom.
238239 */
239 - function load() {
 240+ public function load() {
240241 if ( $this->mLoadedItems === true ) {
241242 return;
242243 }
@@ -273,9 +274,8 @@
274275 /**
275276 * Load user table data, given mId has already been set.
276277 * @return Bool false if the ID does not exist, true otherwise
277 - * @private
278278 */
279 - function loadFromId() {
 279+ private function loadFromId() {
280280 global $wgMemc;
281281 if ( $this->mId == 0 ) {
282282 $this->loadDefaults();
@@ -311,7 +311,7 @@
312312 /**
313313 * Save user data to the shared cache
314314 */
315 - function saveToCache() {
 315+ public function saveToCache() {
316316 $this->load();
317317 $this->loadGroups();
318318 $this->loadOptions();
@@ -329,7 +329,6 @@
330330 $wgMemc->set( $key, $data );
331331 }
332332
333 -
334333 /** @name newFrom*() static factory methods */
335334 //@{
336335
@@ -349,7 +348,7 @@
350349 * username is not present in the database, the result will be a user object
351350 * with a name, zero user ID and default settings.
352351 */
353 - static function newFromName( $name, $validate = 'valid' ) {
 352+ public static function newFromName( $name, $validate = 'valid' ) {
354353 if ( $validate === true ) {
355354 $validate = 'valid';
356355 }
@@ -372,7 +371,7 @@
373372 * @param $id Int Valid user ID
374373 * @return User The corresponding User object
375374 */
376 - static function newFromId( $id ) {
 375+ public static function newFromId( $id ) {
377376 $u = new User;
378377 $u->mId = $id;
379378 $u->mFrom = 'id';
@@ -390,7 +389,7 @@
391390 * @param $code String Confirmation code
392391 * @return User
393392 */
394 - static function newFromConfirmationCode( $code ) {
 393+ public static function newFromConfirmationCode( $code ) {
395394 $dbr = wfGetDB( DB_SLAVE );
396395 $id = $dbr->selectField( 'user', 'user_id', array(
397396 'user_email_token' => md5( $code ),
@@ -411,7 +410,7 @@
412411 * ommited.
413412 * @return User
414413 */
415 - static function newFromSession( WebRequest $request = null ) {
 414+ public static function newFromSession( WebRequest $request = null ) {
416415 $user = new User;
417416 $user->mFrom = 'session';
418417 $user->mRequest = $request;
@@ -431,7 +430,7 @@
432431 * @param $row Array A row from the user table
433432 * @return User
434433 */
435 - static function newFromRow( $row ) {
 434+ public static function newFromRow( $row ) {
436435 $user = new User;
437436 $user->loadFromRow( $row );
438437 return $user;
@@ -456,7 +455,7 @@
457456 * @param $id Int User ID
458457 * @return String The corresponding user's real name
459458 */
460 - static function whoIsReal( $id ) {
 459+ public static function whoIsReal( $id ) {
461460 $dbr = wfGetDB( DB_SLAVE );
462461 return $dbr->selectField( 'user', 'user_real_name', array( 'user_id' => $id ), __METHOD__ );
463462 }
@@ -466,7 +465,7 @@
467466 * @param $name String Username
468467 * @return Int|Null The corresponding user's ID, or null if user is nonexistent
469468 */
470 - static function idFromName( $name ) {
 469+ public static function idFromName( $name ) {
471470 $nt = Title::makeTitleSafe( NS_USER, $name );
472471 if( is_null( $nt ) ) {
473472 # Illegal name
@@ -518,7 +517,7 @@
519518 * @param $name String to match
520519 * @return Bool
521520 */
522 - static function isIP( $name ) {
 521+ public static function isIP( $name ) {
523522 return preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/',$name) || IP::isIPv6($name);
524523 }
525524
@@ -533,7 +532,7 @@
534533 * @param $name String to match
535534 * @return Bool
536535 */
537 - static function isValidUserName( $name ) {
 536+ public static function isValidUserName( $name ) {
538537 global $wgContLang, $wgMaxNameChars;
539538
540539 if ( $name == ''
@@ -587,7 +586,7 @@
588587 * @param $name String to match
589588 * @return Bool
590589 */
591 - static function isUsableName( $name ) {
 590+ public static function isUsableName( $name ) {
592591 global $wgReservedUsernames;
593592 // Must be a valid username, obviously ;)
594593 if ( !self::isValidUserName( $name ) ) {
@@ -624,7 +623,7 @@
625624 * @param $name String to match
626625 * @return Bool
627626 */
628 - static function isCreatableName( $name ) {
 627+ public static function isCreatableName( $name ) {
629628 global $wgInvalidUsernameCharacters;
630629
631630 // Ensure that the username isn't longer than 235 bytes, so that
@@ -654,7 +653,7 @@
655654 * @param $password String Desired password
656655 * @return Bool
657656 */
658 - function isValidPassword( $password ) {
 657+ public function isValidPassword( $password ) {
659658 //simple boolean wrapper for getPasswordValidity
660659 return $this->getPasswordValidity( $password ) === true;
661660 }
@@ -665,7 +664,7 @@
666665 * @param $password String Desired password
667666 * @return mixed: true on success, string or array of error message on failure
668667 */
669 - function getPasswordValidity( $password ) {
 668+ public function getPasswordValidity( $password ) {
670669 global $wgMinimalPasswordLength, $wgContLang;
671670
672671 static $blockedLogins = array(
@@ -740,7 +739,7 @@
741740 * - 'usable' Valid for batch processes and login
742741 * - 'creatable' Valid for batch processes, login and account creation
743742 */
744 - static function getCanonicalName( $name, $validate = 'valid' ) {
 743+ public static function getCanonicalName( $name, $validate = 'valid' ) {
745744 # Force usernames to capital
746745 global $wgContLang;
747746 $name = $wgContLang->ucfirst( $name );
@@ -794,7 +793,7 @@
795794 * @param $uid Int User ID to check
796795 * @return Int the user's edit count
797796 */
798 - static function edits( $uid ) {
 797+ public static function edits( $uid ) {
799798 wfProfileIn( __METHOD__ );
800799 $dbr = wfGetDB( DB_SLAVE );
801800 // check if the user_editcount field has been initialized
@@ -830,7 +829,7 @@
831830 *
832831 * @return String new random password
833832 */
834 - static function randomPassword() {
 833+ public static function randomPassword() {
835834 global $wgMinimalPasswordLength;
836835 $pwchars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz';
837836 $l = strlen( $pwchars ) - 1;
@@ -849,9 +848,8 @@
850849 *
851850 * @note This no longer clears uncached lazy-initialised properties;
852851 * the constructor does that instead.
853 - * @private
854852 */
855 - function loadDefaults( $name = false ) {
 853+ private function loadDefaults( $name = false ) {
856854 wfProfileIn( __METHOD__ );
857855
858856 $this->mId = 0;
@@ -1007,9 +1005,8 @@
10081006 * $this->mId must be set, this is how the user is identified.
10091007 *
10101008 * @return Bool True if the user exists, false if the user is anonymous
1011 - * @private
10121009 */
1013 - function loadFromDatabase() {
 1010+ private function loadFromDatabase() {
10141011 # Paranoia
10151012 $this->mId = intval( $this->mId );
10161013
@@ -1043,7 +1040,7 @@
10441041 *
10451042 * @param $row Array Row from the user table to load.
10461043 */
1047 - function loadFromRow( $row ) {
 1044+ public function loadFromRow( $row ) {
10481045 $all = true;
10491046
10501047 if ( isset( $row->user_name ) ) {
@@ -1107,9 +1104,8 @@
11081105
11091106 /**
11101107 * Load the groups from the database if they aren't already loaded.
1111 - * @private
11121108 */
1113 - function loadGroups() {
 1109+ private function loadGroups() {
11141110 if ( is_null( $this->mGroups ) ) {
11151111 $dbr = wfGetDB( DB_MASTER );
11161112 $res = $dbr->select( 'user_groups',
@@ -1167,7 +1163,7 @@
11681164 * given source. May be "name", "id", "defaults", "session", or false for
11691165 * no reload.
11701166 */
1171 - function clearInstanceCache( $reloadFrom = false ) {
 1167+ public function clearInstanceCache( $reloadFrom = false ) {
11721168 $this->mNewtalk = -1;
11731169 $this->mDatePreference = null;
11741170 $this->mBlockedby = -1; # Unset
@@ -1188,7 +1184,7 @@
11891185 *
11901186 * @return Array of String options
11911187 */
1192 - static function getDefaultOptions() {
 1188+ public static function getDefaultOptions() {
11931189 global $wgNamespacesToBeSearchedDefault, $wgDefaultUserOptions, $wgContLang, $wgDefaultSkin;
11941190
11951191 $defOpt = $wgDefaultUserOptions;
@@ -1222,13 +1218,12 @@
12231219
12241220 /**
12251221 * Get blocking information
1226 - * @private
12271222 * @param $bFromSlave Bool Whether to check the slave database first. To
12281223 * improve performance, non-critical checks are done
12291224 * against slaves. Check when actually saving should be
12301225 * done against master.
12311226 */
1232 - function getBlockedStatus( $bFromSlave = true ) {
 1227+ private function getBlockedStatus( $bFromSlave = true ) {
12331228 global $wgProxyWhitelist, $wgUser;
12341229
12351230 if ( -1 != $this->mBlockedby ) {
@@ -1301,7 +1296,7 @@
13021297 * @param $checkWhitelist Bool: whether to check the whitelist first
13031298 * @return Bool True if blacklisted.
13041299 */
1305 - function isDnsBlacklisted( $ip, $checkWhitelist = false ) {
 1300+ public function isDnsBlacklisted( $ip, $checkWhitelist = false ) {
13061301 global $wgEnableSorbs, $wgEnableDnsBlacklist,
13071302 $wgSorbsUrl, $wgDnsBlacklistUrls, $wgProxyWhitelist;
13081303
@@ -1322,7 +1317,7 @@
13231318 * @param $bases String|Array of Strings: URL of the DNS blacklist
13241319 * @return Bool True if blacklisted.
13251320 */
1326 - function inDnsBlacklist( $ip, $bases ) {
 1321+ public function inDnsBlacklist( $ip, $bases ) {
13271322 wfProfileIn( __METHOD__ );
13281323
13291324 $found = false;
@@ -1409,7 +1404,7 @@
14101405 * @param $action String Action to enforce; 'edit' if unspecified
14111406 * @return Bool True if a rate limiter was tripped
14121407 */
1413 - function pingLimiter( $action = 'edit' ) {
 1408+ public function pingLimiter( $action = 'edit' ) {
14141409 # Call the 'PingLimiter' hook
14151410 $result = false;
14161411 if( !wfRunHooks( 'PingLimiter', array( &$this, $action, $result ) ) ) {
@@ -1504,7 +1499,7 @@
15051500 * @param $bFromSlave Bool Whether to check the slave database instead of the master
15061501 * @return Bool True if blocked, false otherwise
15071502 */
1508 - function isBlocked( $bFromSlave = true ) { // hacked from false due to horrible probs on site
 1503+ public function isBlocked( $bFromSlave = true ) { // hacked from false due to horrible probs on site
15091504 $this->getBlockedStatus( $bFromSlave );
15101505 return $this->mBlock instanceof Block && $this->mBlock->prevents( 'edit' );
15111506 }
@@ -1539,7 +1534,7 @@
15401535 * If user is blocked, return the name of the user who placed the block
15411536 * @return String name of blocker
15421537 */
1543 - function blockedBy() {
 1538+ public function blockedBy() {
15441539 $this->getBlockedStatus();
15451540 return $this->mBlockedby;
15461541 }
@@ -1548,7 +1543,7 @@
15491544 * If user is blocked, return the specified reason for the block
15501545 * @return String Blocking reason
15511546 */
1552 - function blockedFor() {
 1547+ public function blockedFor() {
15531548 $this->getBlockedStatus();
15541549 return $this->mBlockreason;
15551550 }
@@ -1557,7 +1552,7 @@
15581553 * If user is blocked, return the ID for the block
15591554 * @return Int Block ID
15601555 */
1561 - function getBlockId() {
 1556+ public function getBlockId() {
15621557 $this->getBlockedStatus();
15631558 return ( $this->mBlock ? $this->mBlock->getId() : false );
15641559 }
@@ -1570,7 +1565,7 @@
15711566 * @param $ip String IP address, uses current client if none given
15721567 * @return Bool True if blocked, false otherwise
15731568 */
1574 - function isBlockedGlobally( $ip = '' ) {
 1569+ public function isBlockedGlobally( $ip = '' ) {
15751570 if( $this->mBlockedGlobally !== null ) {
15761571 return $this->mBlockedGlobally;
15771572 }
@@ -1591,7 +1586,7 @@
15921587 *
15931588 * @return Bool True if locked, false otherwise
15941589 */
1595 - function isLocked() {
 1590+ public function isLocked() {
15961591 if( $this->mLocked !== null ) {
15971592 return $this->mLocked;
15981593 }
@@ -1606,7 +1601,7 @@
16071602 *
16081603 * @return Bool True if hidden, false otherwise
16091604 */
1610 - function isHidden() {
 1605+ public function isHidden() {
16111606 if( $this->mHideName !== null ) {
16121607 return $this->mHideName;
16131608 }
@@ -1623,7 +1618,7 @@
16241619 * Get the user's ID.
16251620 * @return Int The user's ID; 0 if the user is anonymous or nonexistent
16261621 */
1627 - function getId() {
 1622+ public function getId() {
16281623 if( $this->mId === null && $this->mName !== null
16291624 && User::isIP( $this->mName ) ) {
16301625 // Special case, we know the user is anonymous
@@ -1639,7 +1634,7 @@
16401635 * Set the user and reload all fields according to a given ID
16411636 * @param $v Int User ID to reload
16421637 */
1643 - function setId( $v ) {
 1638+ public function setId( $v ) {
16441639 $this->mId = $v;
16451640 $this->clearInstanceCache( 'id' );
16461641 }
@@ -1648,7 +1643,7 @@
16491644 * Get the user name, or the IP of an anonymous user
16501645 * @return String User's name or IP address
16511646 */
1652 - function getName() {
 1647+ public function getName() {
16531648 if ( $this->isItemLoaded( 'name', 'only' ) ) {
16541649 # Special case optimisation
16551650 return $this->mName;
@@ -1675,7 +1670,7 @@
16761671 * does not exist.
16771672 * @param $str String New user name to set
16781673 */
1679 - function setName( $str ) {
 1674+ public function setName( $str ) {
16801675 $this->load();
16811676 $this->mName = $str;
16821677 }
@@ -1684,7 +1679,7 @@
16851680 * Get the user's name escaped by underscores.
16861681 * @return String Username escaped by underscores.
16871682 */
1688 - function getTitleKey() {
 1683+ public function getTitleKey() {
16891684 return str_replace( ' ', '_', $this->getName() );
16901685 }
16911686
@@ -1692,7 +1687,7 @@
16931688 * Check if the user has new messages.
16941689 * @return Bool True if the user has new messages
16951690 */
1696 - function getNewtalk() {
 1691+ public function getNewtalk() {
16971692 $this->load();
16981693
16991694 # Load the newtalk status if it is unloaded (mNewtalk=-1)
@@ -1725,7 +1720,7 @@
17261721 * Return the talk page(s) this user has new messages on.
17271722 * @return Array of String page URLs
17281723 */
1729 - function getNewMessageLinks() {
 1724+ public function getNewMessageLinks() {
17301725 $talks = array();
17311726 if( !wfRunHooks( 'UserRetrieveNewTalks', array( &$this, &$talks ) ) )
17321727 return $talks;
@@ -1802,7 +1797,7 @@
18031798 * Update the 'You have new messages!' status.
18041799 * @param $val Bool Whether the user has new messages
18051800 */
1806 - function setNewtalk( $val ) {
 1801+ public function setNewtalk( $val ) {
18071802 if( wfReadOnly() ) {
18081803 return;
18091804 }
@@ -1866,7 +1861,7 @@
18671862 * Updates user_touched field, and removes account data from memcached
18681863 * for reload on the next hit.
18691864 */
1870 - function invalidateCache() {
 1865+ public function invalidateCache() {
18711866 if( wfReadOnly() ) {
18721867 return;
18731868 }
@@ -1888,7 +1883,7 @@
18891884 * Validate the cache for this account.
18901885 * @param $timestamp String A timestamp in TS_MW format
18911886 */
1892 - function validateCache( $timestamp ) {
 1887+ public function validateCache( $timestamp ) {
18931888 $this->load();
18941889 return ( $timestamp >= $this->mTouched );
18951890 }
@@ -1897,7 +1892,7 @@
18981893 * Get the user touched timestamp
18991894 * @return String timestamp
19001895 */
1901 - function getTouched() {
 1896+ public function getTouched() {
19021897 $this->load();
19031898 return $this->mTouched;
19041899 }
@@ -1916,7 +1911,7 @@
19171912 * @param $str String New password to set
19181913 * @throws PasswordError on failure
19191914 */
1920 - function setPassword( $str ) {
 1915+ public function setPassword( $str ) {
19211916 global $wgAuth;
19221917
19231918 if( $str !== null ) {
@@ -1952,7 +1947,7 @@
19531948 *
19541949 * @param $str String New password to set
19551950 */
1956 - function setInternalPassword( $str ) {
 1951+ public function setInternalPassword( $str ) {
19571952 $this->load();
19581953 $this->setToken();
19591954
@@ -1970,7 +1965,7 @@
19711966 * Get the user's current token.
19721967 * @return String Token
19731968 */
1974 - function getToken() {
 1969+ public function getToken() {
19751970 $this->load();
19761971 return $this->mToken;
19771972 }
@@ -1980,9 +1975,8 @@
19811976 * Called from loadDefaults() among other places.
19821977 *
19831978 * @param $token String If specified, set the token to this value
1984 - * @private
19851979 */
1986 - function setToken( $token = false ) {
 1980+ public function setToken( $token = false ) {
19871981 global $wgSecretKey, $wgProxyKey;
19881982 $this->load();
19891983 if ( !$token ) {
@@ -2003,9 +1997,8 @@
20041998 * Set the cookie password
20051999 *
20062000 * @param $str String New cookie password
2007 - * @private
20082001 */
2009 - function setCookiePassword( $str ) {
 2002+ private function setCookiePassword( $str ) {
20102003 $this->load();
20112004 $this->mCookiePassword = md5( $str );
20122005 }
@@ -2016,7 +2009,7 @@
20172010 * @param $str String New password to set
20182011 * @param $throttle Bool If true, reset the throttle timestamp to the present
20192012 */
2020 - function setNewpassword( $str, $throttle = true ) {
 2013+ public function setNewpassword( $str, $throttle = true ) {
20212014 $this->load();
20222015 $this->mNewpassword = self::crypt( $str );
20232016 if ( $throttle ) {
@@ -2029,7 +2022,7 @@
20302023 * $wgPasswordReminderResendTime hours?
20312024 * @return Bool
20322025 */
2033 - function isPasswordReminderThrottled() {
 2026+ public function isPasswordReminderThrottled() {
20342027 global $wgPasswordReminderResendTime;
20352028 $this->load();
20362029 if ( !$this->mNewpassTime || !$wgPasswordReminderResendTime ) {
@@ -2043,7 +2036,7 @@
20442037 * Get the user's e-mail address
20452038 * @return String User's email address
20462039 */
2047 - function getEmail() {
 2040+ public function getEmail() {
20482041 $this->load();
20492042 wfRunHooks( 'UserGetEmail', array( $this, &$this->mEmail ) );
20502043 return $this->mEmail;
@@ -2053,7 +2046,7 @@
20542047 * Get the timestamp of the user's e-mail authentication
20552048 * @return String TS_MW timestamp
20562049 */
2057 - function getEmailAuthenticationTimestamp() {
 2050+ public function getEmailAuthenticationTimestamp() {
20582051 $this->load();
20592052 wfRunHooks( 'UserGetEmailAuthenticationTimestamp', array( $this, &$this->mEmailAuthenticated ) );
20602053 return $this->mEmailAuthenticated;
@@ -2063,7 +2056,7 @@
20642057 * Set the user's e-mail address
20652058 * @param $str String New e-mail address
20662059 */
2067 - function setEmail( $str ) {
 2060+ public function setEmail( $str ) {
20682061 $this->load();
20692062 $this->mEmail = $str;
20702063 wfRunHooks( 'UserSetEmail', array( $this, &$this->mEmail ) );
@@ -2073,7 +2066,7 @@
20742067 * Get the user's real name
20752068 * @return String User's real name
20762069 */
2077 - function getRealName() {
 2070+ public function getRealName() {
20782071 if ( !$this->isItemLoaded( 'realname' ) ) {
20792072 $this->load();
20802073 }
@@ -2085,7 +2078,7 @@
20862079 * Set the user's real name
20872080 * @param $str String New real name
20882081 */
2089 - function setRealName( $str ) {
 2082+ public function setRealName( $str ) {
20902083 $this->load();
20912084 $this->mRealName = $str;
20922085 }
@@ -2100,7 +2093,7 @@
21012094 * @see getBoolOption()
21022095 * @see getIntOption()
21032096 */
2104 - function getOption( $oname, $defaultOverride = null, $ignoreHidden = false ) {
 2097+ public function getOption( $oname, $defaultOverride = null, $ignoreHidden = false ) {
21052098 global $wgHiddenPrefs;
21062099 $this->loadOptions();
21072100
@@ -2159,11 +2152,10 @@
21602153 * @return Bool User's current value for the option
21612154 * @see getOption()
21622155 */
2163 - function getBoolOption( $oname ) {
 2156+ public function getBoolOption( $oname ) {
21642157 return (bool)$this->getOption( $oname );
21652158 }
21662159
2167 -
21682160 /**
21692161 * Get the user's current setting for a given option, as a boolean value.
21702162 *
@@ -2172,7 +2164,7 @@
21732165 * @return Int User's current value for the option
21742166 * @see getOption()
21752167 */
2176 - function getIntOption( $oname, $defaultOverride=0 ) {
 2168+ public function getIntOption( $oname, $defaultOverride=0 ) {
21772169 $val = $this->getOption( $oname );
21782170 if( $val == '' ) {
21792171 $val = $defaultOverride;
@@ -2186,7 +2178,7 @@
21872179 * @param $oname String The option to set
21882180 * @param $val mixed New value to set
21892181 */
2190 - function setOption( $oname, $val ) {
 2182+ public function setOption( $oname, $val ) {
21912183 $this->load();
21922184 $this->loadOptions();
21932185
@@ -2202,7 +2194,7 @@
22032195 /**
22042196 * Reset all options to the site defaults
22052197 */
2206 - function resetOptions() {
 2198+ public function resetOptions() {
22072199 $this->mOptions = self::getDefaultOptions();
22082200 }
22092201
@@ -2210,7 +2202,7 @@
22112203 * Get the user's preferred date format.
22122204 * @return String User's preferred date format
22132205 */
2214 - function getDatePreference() {
 2206+ public function getDatePreference() {
22152207 // Important migration for old data rows
22162208 if ( is_null( $this->mDatePreference ) ) {
22172209 global $wgLang;
@@ -2227,7 +2219,7 @@
22282220 /**
22292221 * Get the user preferred stub threshold
22302222 */
2231 - function getStubThreshold() {
 2223+ public function getStubThreshold() {
22322224 global $wgMaxArticleSize; # Maximum article size, in Kb
22332225 $threshold = intval( $this->getOption( 'stubthreshold' ) );
22342226 if ( $threshold > $wgMaxArticleSize * 1024 ) {
@@ -2243,13 +2235,13 @@
22442236 * @param $ns int If numeric, get permissions for this namespace
22452237 * @return Array of String permission names
22462238 */
2247 - function getRights( $ns = null ) {
 2239+ public function getRights( $ns = null ) {
22482240 $key = is_null( $ns ) ? '*' : intval( $ns );
2249 -
 2241+
22502242 if ( is_null( $this->mRights ) ) {
22512243 $this->mRights = array();
22522244 }
2253 -
 2245+
22542246 if ( !isset( $this->mRights[$key] ) ) {
22552247 $this->mRights[$key] = self::getGroupPermissions( $this->getEffectiveGroups(), $ns );
22562248 wfRunHooks( 'UserGetRights', array( $this, &$this->mRights[$key], $ns ) );
@@ -2262,7 +2254,7 @@
22632255 // Merge non namespace specific rights
22642256 return array_merge( $this->mRights[$key], $this->getRights() );
22652257 }
2266 -
 2258+
22672259 }
22682260
22692261 /**
@@ -2270,7 +2262,7 @@
22712263 * The implicit * and user groups are not included.
22722264 * @return Array of String internal group names
22732265 */
2274 - function getGroups() {
 2266+ public function getGroups() {
22752267 $this->load();
22762268 return $this->mGroups;
22772269 }
@@ -2282,7 +2274,7 @@
22832275 * @param $recache Bool Whether to avoid the cache
22842276 * @return Array of String internal group names
22852277 */
2286 - function getEffectiveGroups( $recache = false ) {
 2278+ public function getEffectiveGroups( $recache = false ) {
22872279 if ( $recache || is_null( $this->mEffectiveGroups ) ) {
22882280 wfProfileIn( __METHOD__ );
22892281 $this->mEffectiveGroups = $this->getGroups();
@@ -2312,7 +2304,7 @@
23132305 *
23142306 * @return array Names of the groups the user has belonged to.
23152307 */
2316 - function getFormerGroups() {
 2308+ public function getFormerGroups() {
23172309 if( is_null( $this->mFormerGroups ) ) {
23182310 $dbr = wfGetDB( DB_MASTER );
23192311 $res = $dbr->select( 'user_former_groups',
@@ -2331,7 +2323,7 @@
23322324 * Get the user's edit count.
23332325 * @return Int
23342326 */
2335 - function getEditCount() {
 2327+ public function getEditCount() {
23362328 if( $this->getId() ) {
23372329 if ( !isset( $this->mEditCount ) ) {
23382330 /* Populate the count, if it has not been populated yet */
@@ -2349,7 +2341,7 @@
23502342 * This takes immediate effect.
23512343 * @param $group String Name of the group to add
23522344 */
2353 - function addGroup( $group ) {
 2345+ public function addGroup( $group ) {
23542346 if( wfRunHooks( 'UserAddGroup', array( $this, &$group ) ) ) {
23552347 $dbw = wfGetDB( DB_MASTER );
23562348 if( $this->getId() ) {
@@ -2374,7 +2366,7 @@
23752367 * This takes immediate effect.
23762368 * @param $group String Name of the group to remove
23772369 */
2378 - function removeGroup( $group ) {
 2370+ public function removeGroup( $group ) {
23792371 $this->load();
23802372 if( wfRunHooks( 'UserRemoveGroup', array( $this, &$group ) ) ) {
23812373 $dbw = wfGetDB( DB_MASTER );
@@ -2403,7 +2395,7 @@
24042396 * Get whether the user is logged in
24052397 * @return Bool
24062398 */
2407 - function isLoggedIn() {
 2399+ public function isLoggedIn() {
24082400 return $this->getID() != 0;
24092401 }
24102402
@@ -2411,7 +2403,7 @@
24122404 * Get whether the user is anonymous
24132405 * @return Bool
24142406 */
2415 - function isAnon() {
 2407+ public function isAnon() {
24162408 return !$this->isLoggedIn();
24172409 }
24182410
@@ -2503,7 +2495,7 @@
25042496 * @todo FIXME: Need to check the old failback system [AV]
25052497 * @deprecated since 1.18 Use ->getSkin() in the most relevant outputting context you have
25062498 */
2507 - function getSkin() {
 2499+ public function getSkin() {
25082500 return RequestContext::getMain()->getSkin();
25092501 }
25102502
@@ -2512,7 +2504,7 @@
25132505 * @param $title Title of the article to look at
25142506 * @return Bool
25152507 */
2516 - function isWatched( $title ) {
 2508+ public function isWatched( $title ) {
25172509 $wl = WatchedItem::fromUserTitle( $this, $title );
25182510 return $wl->isWatched();
25192511 }
@@ -2521,7 +2513,7 @@
25222514 * Watch an article.
25232515 * @param $title Title of the article to look at
25242516 */
2525 - function addWatch( $title ) {
 2517+ public function addWatch( $title ) {
25262518 $wl = WatchedItem::fromUserTitle( $this, $title );
25272519 $wl->addWatch();
25282520 $this->invalidateCache();
@@ -2531,7 +2523,7 @@
25322524 * Stop watching an article.
25332525 * @param $title Title of the article to look at
25342526 */
2535 - function removeWatch( $title ) {
 2527+ public function removeWatch( $title ) {
25362528 $wl = WatchedItem::fromUserTitle( $this, $title );
25372529 $wl->removeWatch();
25382530 $this->invalidateCache();
@@ -2543,7 +2535,7 @@
25442536 * the next change of the page if it's watched etc.
25452537 * @param $title Title of the article to look at
25462538 */
2547 - function clearNotification( &$title ) {
 2539+ public function clearNotification( &$title ) {
25482540 global $wgUseEnotif, $wgShowUpdatedMarker;
25492541
25502542 # Do nothing if the database is locked to writes
@@ -2600,7 +2592,7 @@
26012593 * If e-notif e-mails are on, they will receive notification mails on
26022594 * the next change of any watched page.
26032595 */
2604 - function clearAllNotifications() {
 2596+ public function clearAllNotifications() {
26052597 global $wgUseEnotif, $wgShowUpdatedMarker;
26062598 if ( !$wgUseEnotif && !$wgShowUpdatedMarker ) {
26072599 $this->setNewtalk( false );
@@ -2624,9 +2616,8 @@
26252617 /**
26262618 * Set this user's options from an encoded string
26272619 * @param $str String Encoded options to import
2628 - * @private
26292620 */
2630 - function decodeOptions( $str ) {
 2621+ private function decodeOptions( $str ) {
26312622 if( !$str )
26322623 return;
26332624
@@ -2672,7 +2663,7 @@
26732664 * @param $request WebRequest object to use; $wgRequest will be used if null
26742665 * is passed.
26752666 */
2676 - function setCookies( $request = null ) {
 2667+ public function setCookies( $request = null ) {
26772668 if ( $request === null ) {
26782669 $request = $this->getRequest();
26792670 }
@@ -2711,7 +2702,7 @@
27122703 /**
27132704 * Log this user out.
27142705 */
2715 - function logout() {
 2706+ public function logout() {
27162707 if( wfRunHooks( 'UserLogout', array( &$this ) ) ) {
27172708 $this->doLogout();
27182709 }
@@ -2719,10 +2710,9 @@
27202711
27212712 /**
27222713 * Clear the user's cookies and session, and reset the instance cache.
2723 - * @private
27242714 * @see logout()
27252715 */
2726 - function doLogout() {
 2716+ private function doLogout() {
27272717 $this->clearInstanceCache( 'defaults' );
27282718
27292719 $this->getRequest()->setSessionData( 'wsUserID', 0 );
@@ -2738,7 +2728,7 @@
27392729 * Save this user's settings into the database.
27402730 * @todo Only rarely do all these fields need to be set!
27412731 */
2742 - function saveSettings() {
 2732+ public function saveSettings() {
27432733 $this->load();
27442734 if ( wfReadOnly() ) { return; }
27452735 if ( 0 == $this->mId ) { return; }
@@ -2776,7 +2766,7 @@
27772767 * If only this user's username is known, and it exists, return the user ID.
27782768 * @return Int
27792769 */
2780 - function idForName() {
 2770+ public function idForName() {
27812771 $s = trim( $this->getName() );
27822772 if ( $s === '' ) return 0;
27832773
@@ -2804,7 +2794,7 @@
28052795 *
28062796 * @return User object, or null if the username already exists
28072797 */
2808 - static function createNew( $name, $params = array() ) {
 2798+ public static function createNew( $name, $params = array() ) {
28092799 $user = new User;
28102800 $user->load();
28112801 if ( isset( $params['options'] ) ) {
@@ -2843,7 +2833,7 @@
28442834 /**
28452835 * Add this existing user object to the database
28462836 */
2847 - function addToDatabase() {
 2837+ public function addToDatabase() {
28482838 $this->load();
28492839 $dbw = wfGetDB( DB_MASTER );
28502840 $seqVal = $dbw->nextSequenceValue( 'user_user_id_seq' );
@@ -2875,7 +2865,7 @@
28762866 * If this (non-anonymous) user is blocked, block any IP address
28772867 * they've successfully logged in from.
28782868 */
2879 - function spreadBlock() {
 2869+ public function spreadBlock() {
28802870 wfDebug( __METHOD__ . "()\n" );
28812871 $this->load();
28822872 if ( $this->mId == 0 ) {
@@ -2904,7 +2894,7 @@
29052895 * @deprecated since 1.17 use the ParserOptions object to get the relevant options
29062896 * @return String Page rendering hash
29072897 */
2908 - function getPageRenderingHash() {
 2898+ public function getPageRenderingHash() {
29092899 global $wgUseDynamicDates, $wgRenderHashAppend, $wgLang, $wgContLang;
29102900 if( $this->mHash ){
29112901 return $this->mHash;
@@ -2946,7 +2936,7 @@
29472937 * Get whether the user is explicitly blocked from account creation.
29482938 * @return Bool|Block
29492939 */
2950 - function isBlockedFromCreateAccount() {
 2940+ public function isBlockedFromCreateAccount() {
29512941 $this->getBlockedStatus();
29522942 if( $this->mBlock && $this->mBlock->prevents( 'createaccount' ) ){
29532943 return $this->mBlock;
@@ -2967,7 +2957,7 @@
29682958 * Get whether the user is blocked from using Special:Emailuser.
29692959 * @return Bool
29702960 */
2971 - function isBlockedFromEmailuser() {
 2961+ public function isBlockedFromEmailuser() {
29722962 $this->getBlockedStatus();
29732963 return $this->mBlock && $this->mBlock->prevents( 'sendemail' );
29742964 }
@@ -2985,7 +2975,7 @@
29862976 *
29872977 * @return Title: User's personal page title
29882978 */
2989 - function getUserPage() {
 2979+ public function getUserPage() {
29902980 return Title::makeTitle( NS_USER, $this->getName() );
29912981 }
29922982
@@ -2994,7 +2984,7 @@
29952985 *
29962986 * @return Title: User's talk page title
29972987 */
2998 - function getTalkPage() {
 2988+ public function getTalkPage() {
29992989 $title = $this->getUserPage();
30002990 return $title->getTalkPage();
30012991 }
@@ -3004,7 +2994,7 @@
30052995 * anonymous IPs, or the most recently created accounts.
30062996 * @return Bool
30072997 */
3008 - function isNewbie() {
 2998+ public function isNewbie() {
30092999 return !$this->isAllowed( 'autoconfirmed' );
30103000 }
30113001
@@ -3013,7 +3003,7 @@
30143004 * @param $password String: user password.
30153005 * @return Boolean: True if the given password is correct, otherwise False.
30163006 */
3017 - function checkPassword( $password ) {
 3007+ public function checkPassword( $password ) {
30183008 global $wgAuth, $wgLegacyEncoding;
30193009 $this->load();
30203010
@@ -3055,7 +3045,7 @@
30563046 * sent by e-mail for password reset operations.
30573047 * @return Boolean: True if matches, false otherwise
30583048 */
3059 - function checkTemporaryPassword( $plaintext ) {
 3049+ public function checkTemporaryPassword( $plaintext ) {
30603050 global $wgNewPasswordExpiry;
30613051
30623052 $this->load();
@@ -3080,7 +3070,7 @@
30813071 * @param $request WebRequest object to use or null to use $wgRequest
30823072 * @return String The new edit token
30833073 */
3084 - function editToken( $salt = '', $request = null ) {
 3074+ public function editToken( $salt = '', $request = null ) {
30853075 if ( $request == null ) {
30863076 $request = $this->getRequest();
30873077 }
@@ -3122,7 +3112,7 @@
31233113 * @param $request WebRequest object to use or null to use $wgRequest
31243114 * @return Boolean: Whether the token matches
31253115 */
3126 - function matchEditToken( $val, $salt = '', $request = null ) {
 3116+ public function matchEditToken( $val, $salt = '', $request = null ) {
31273117 $sessionToken = $this->editToken( $salt, $request );
31283118 if ( $val != $sessionToken ) {
31293119 wfDebug( "User::matchEditToken: broken session data\n" );
@@ -3139,7 +3129,7 @@
31403130 * @param $request WebRequest object to use or null to use $wgRequest
31413131 * @return Boolean: Whether the token matches
31423132 */
3143 - function matchEditTokenNoSuffix( $val, $salt = '', $request = null ) {
 3133+ public function matchEditTokenNoSuffix( $val, $salt = '', $request = null ) {
31443134 $sessionToken = $this->editToken( $salt, $request );
31453135 return substr( $sessionToken, 0, 32 ) == substr( $val, 0, 32 );
31463136 }
@@ -3151,7 +3141,7 @@
31523142 * @param $type String: message to send, either "created", "changed" or "set"
31533143 * @return Status object
31543144 */
3155 - function sendConfirmationMail( $type = 'created' ) {
 3145+ public function sendConfirmationMail( $type = 'created' ) {
31563146 global $wgLang;
31573147 $expiration = null; // gets passed-by-ref and defined in next line.
31583148 $token = $this->confirmationToken( $expiration );
@@ -3188,7 +3178,7 @@
31893179 * @param $replyto String Reply-To address
31903180 * @return Status
31913181 */
3192 - function sendMail( $subject, $body, $from = null, $replyto = null ) {
 3182+ public function sendMail( $subject, $body, $from = null, $replyto = null ) {
31933183 if( is_null( $from ) ) {
31943184 global $wgPasswordSender, $wgPasswordSenderName;
31953185 $sender = new MailAddress( $wgPasswordSender, $wgPasswordSenderName );
@@ -3209,9 +3199,8 @@
32103200 *
32113201 * @param[out] &$expiration \mixed Accepts the expiration time
32123202 * @return String New token
3213 - * @private
32143203 */
3215 - function confirmationToken( &$expiration ) {
 3204+ private function confirmationToken( &$expiration ) {
32163205 global $wgUserEmailConfirmationTokenExpiry;
32173206 $now = time();
32183207 $expires = $now + $wgUserEmailConfirmationTokenExpiry;
@@ -3228,9 +3217,8 @@
32293218 * Return a URL the user can use to confirm their email address.
32303219 * @param $token String Accepts the email confirmation token
32313220 * @return String New token URL
3232 - * @private
32333221 */
3234 - function confirmationTokenUrl( $token ) {
 3222+ private function confirmationTokenUrl( $token ) {
32353223 return $this->getTokenUrl( 'ConfirmEmail', $token );
32363224 }
32373225
@@ -3238,9 +3226,8 @@
32393227 * Return a URL the user can use to invalidate their email address.
32403228 * @param $token String Accepts the email confirmation token
32413229 * @return String New token URL
3242 - * @private
32433230 */
3244 - function invalidationTokenUrl( $token ) {
 3231+ private function invalidationTokenUrl( $token ) {
32453232 return $this->getTokenUrl( 'Invalidateemail', $token );
32463233 }
32473234
@@ -3272,7 +3259,7 @@
32733260 *
32743261 * @note Call saveSettings() after calling this function to commit the change.
32753262 */
3276 - function confirmEmail() {
 3263+ public function confirmEmail() {
32773264 $this->setEmailAuthenticationTimestamp( wfTimestampNow() );
32783265 wfRunHooks( 'ConfirmEmailComplete', array( $this ) );
32793266 return true;
@@ -3283,6 +3270,7 @@
32843271 * address if it was already confirmed.
32853272 *
32863273 * @note Call saveSettings() after calling this function to commit the change.
 3274+ * @return true
32873275 */
32883276 function invalidateEmail() {
32893277 $this->load();
@@ -3308,7 +3296,7 @@
33093297 * site configuration?
33103298 * @return Bool
33113299 */
3312 - function canSendEmail() {
 3300+ public function canSendEmail() {
33133301 global $wgEnableEmail, $wgEnableUserEmail;
33143302 if( !$wgEnableEmail || !$wgEnableUserEmail || !$this->isAllowed( 'sendemail' ) ) {
33153303 return false;
@@ -3323,7 +3311,7 @@
33243312 * site configuration?
33253313 * @return Bool
33263314 */
3327 - function canReceiveEmail() {
 3315+ public function canReceiveEmail() {
33283316 return $this->isEmailConfirmed() && !$this->getOption( 'disablemail' );
33293317 }
33303318
@@ -3337,7 +3325,7 @@
33383326 *
33393327 * @return Bool
33403328 */
3341 - function isEmailConfirmed() {
 3329+ public function isEmailConfirmed() {
33423330 global $wgEmailAuthentication;
33433331 $this->load();
33443332 $confirmed = true;
@@ -3361,7 +3349,7 @@
33623350 * Check whether there is an outstanding request for e-mail confirmation.
33633351 * @return Bool
33643352 */
3365 - function isEmailConfirmationPending() {
 3353+ public function isEmailConfirmationPending() {
33663354 global $wgEmailAuthentication;
33673355 return $wgEmailAuthentication &&
33683356 !$this->isEmailConfirmed() &&
@@ -3411,10 +3399,10 @@
34123400 * @param $groups Array of Strings List of internal group names
34133401 * @return Array of Strings List of permission key names for given groups combined
34143402 */
3415 - static function getGroupPermissions( $groups, $ns = null ) {
 3403+ public static function getGroupPermissions( $groups, $ns = null ) {
34163404 global $wgGroupPermissions, $wgRevokePermissions;
34173405 $rights = array();
3418 -
 3406+
34193407 // Grant every granted permission first
34203408 foreach( $groups as $group ) {
34213409 if( isset( $wgGroupPermissions[$group] ) ) {
@@ -3422,17 +3410,17 @@
34233411 $wgGroupPermissions[$group], $ns ) );
34243412 }
34253413 }
3426 -
 3414+
34273415 // Revoke the revoked permissions
34283416 foreach( $groups as $group ) {
34293417 if( isset( $wgRevokePermissions[$group] ) ) {
3430 - $rights = array_diff( $rights, self::extractRights(
 3418+ $rights = array_diff( $rights, self::extractRights(
34313419 $wgRevokePermissions[$group], $ns ) );
34323420 }
34333421 }
34343422 return array_unique( $rights );
34353423 }
3436 -
 3424+
34373425 /**
34383426 * Helper for User::getGroupPermissions
34393427 * @param array $list
@@ -3454,7 +3442,7 @@
34553443 }
34563444 }
34573445 }
3458 - return $rights;
 3446+ return $rights;
34593447 }
34603448
34613449 /**
@@ -3463,7 +3451,7 @@
34643452 * @param $role String Role to check
34653453 * @return Array of Strings List of internal group names with the given permission
34663454 */
3467 - static function getGroupsWithPermission( $role, $ns = null ) {
 3455+ public static function getGroupsWithPermission( $role, $ns = null ) {
34683456 global $wgGroupPermissions;
34693457 $allowedGroups = array();
34703458 foreach ( $wgGroupPermissions as $group => $rights ) {
@@ -3480,7 +3468,7 @@
34813469 * @param $group String Internal group name
34823470 * @return String Localized descriptive group name
34833471 */
3484 - static function getGroupName( $group ) {
 3472+ public static function getGroupName( $group ) {
34853473 $msg = wfMessage( "group-$group" );
34863474 return $msg->isBlank() ? $group : $msg->text();
34873475 }
@@ -3491,7 +3479,7 @@
34923480 * @param $group String Internal group name
34933481 * @return String Localized name for group member
34943482 */
3495 - static function getGroupMember( $group ) {
 3483+ public static function getGroupMember( $group ) {
34963484 $msg = wfMessage( "group-$group-member" );
34973485 return $msg->isBlank() ? $group : $msg->text();
34983486 }
@@ -3502,7 +3490,7 @@
35033491 * are not included, as they are defined automatically, not in the database.
35043492 * @return Array of internal group names
35053493 */
3506 - static function getAllGroups() {
 3494+ public static function getAllGroups() {
35073495 global $wgGroupPermissions, $wgRevokePermissions;
35083496 return array_diff(
35093497 array_merge( array_keys( $wgGroupPermissions ), array_keys( $wgRevokePermissions ) ),
@@ -3514,7 +3502,7 @@
35153503 * Get a list of all available permissions.
35163504 * @return Array of permission names
35173505 */
3518 - static function getAllRights() {
 3506+ public static function getAllRights() {
35193507 if ( self::$mAllRights === false ) {
35203508 global $wgAvailableRights;
35213509 if ( count( $wgAvailableRights ) ) {
@@ -3544,7 +3532,7 @@
35453533 * @param $group String Internal group name
35463534 * @return Title|Bool Title of the page if it exists, false otherwise
35473535 */
3548 - static function getGroupPage( $group ) {
 3536+ public static function getGroupPage( $group ) {
35493537 $msg = wfMessage( 'grouppage-' . $group )->inContentLanguage();
35503538 if( $msg->exists() ) {
35513539 $title = Title::newFromText( $msg->text() );
@@ -3562,7 +3550,7 @@
35633551 * @param $text String The text of the link
35643552 * @return String HTML link to the group
35653553 */
3566 - static function makeGroupLinkHTML( $group, $text = '' ) {
 3554+ public static function makeGroupLinkHTML( $group, $text = '' ) {
35673555 if( $text == '' ) {
35683556 $text = self::getGroupName( $group );
35693557 }
@@ -3582,7 +3570,7 @@
35833571 * @param $text String The text of the link
35843572 * @return String Wikilink to the group
35853573 */
3586 - static function makeGroupLinkWiki( $group, $text = '' ) {
 3574+ public static function makeGroupLinkWiki( $group, $text = '' ) {
35873575 if( $text == '' ) {
35883576 $text = self::getGroupName( $group );
35893577 }
@@ -3604,7 +3592,7 @@
36053593 * 'add-self' => array( addablegroups to self),
36063594 * 'remove-self' => array( removable groups from self) )
36073595 */
3608 - static function changeableByGroup( $group ) {
 3596+ public static function changeableByGroup( $group ) {
36093597 global $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
36103598
36113599 $groups = array( 'add' => array(), 'remove' => array(), 'add-self' => array(), 'remove-self' => array() );
@@ -3668,7 +3656,7 @@
36693657 * 'add-self' => array( addablegroups to self),
36703658 * 'remove-self' => array( removable groups from self) )
36713659 */
3672 - function changeableGroups() {
 3660+ public function changeableGroups() {
36733661 if( $this->isAllowed( 'userrights' ) ) {
36743662 // This group gives the right to modify everything (reverse-
36753663 // compatibility with old "userrights lets you change
@@ -3708,7 +3696,7 @@
37093697 * Increment the user's edit-count field.
37103698 * Will have no effect for anonymous users.
37113699 */
3712 - function incEditCount() {
 3700+ public function incEditCount() {
37133701 if( !$this->isAnon() ) {
37143702 $dbw = wfGetDB( DB_MASTER );
37153703 $dbw->update( 'user',
@@ -3754,7 +3742,7 @@
37553743 * @param $right String Right to query
37563744 * @return String Localized description of the right
37573745 */
3758 - static function getRightDescription( $right ) {
 3746+ public static function getRightDescription( $right ) {
37593747 $key = "right-$right";
37603748 $msg = wfMessage( $key );
37613749 return $msg->isBlank() ? $right : $msg->text();
@@ -3767,7 +3755,7 @@
37683756 * @param $userId String User ID
37693757 * @return String Password hash
37703758 */
3771 - static function oldCrypt( $password, $userId ) {
 3759+ public static function oldCrypt( $password, $userId ) {
37723760 global $wgPasswordSalt;
37733761 if ( $wgPasswordSalt ) {
37743762 return md5( $userId . '-' . md5( $password ) );
@@ -3784,7 +3772,7 @@
37853773 * If unspecified or false, will generate one automatically
37863774 * @return String Password hash
37873775 */
3788 - static function crypt( $password, $salt = false ) {
 3776+ public static function crypt( $password, $salt = false ) {
37893777 global $wgPasswordSalt;
37903778
37913779 $hash = '';
@@ -3811,7 +3799,7 @@
38123800 * @param $userId String User ID for old-style password salt
38133801 * @return Boolean:
38143802 */
3815 - static function comparePasswords( $hash, $password, $userId = false ) {
 3803+ public static function comparePasswords( $hash, $password, $userId = false ) {
38163804 $type = substr( $hash, 0, 3 );
38173805
38183806 $result = false;

Follow-up revisions

RevisionCommit summaryAuthorDate
r92484It seems people don't either pay attention to code comments, or those comment...reedy22:01, 18 July 2011
r92546SocialProfile: per Brion's comment on r92461, remove one useless call to User...ashley17:50, 19 July 2011
r92756decodeOptions() used by GlobalAuth - made it publicaaron17:22, 21 July 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   17:25, 19 July 2011

Please don't mark existing functions with private visibility flags unless you've checked that nothing actually uses them, including all extensions in SVN.


User::loadFromId is used from CentralAuth, IPAuth, LDapAutoAuthentication, SocialProfile (but it looks like it shouldn't be). The SocialProfile bits look 100% useless (first calling User::newFromId(), then calling the internal lazy-loader loadFromId(). Sounds useless -- any accessor for stuff we want will already trigger that.). The auth plugins seem to be partially initializing the user object and I'm not exactly sure what's needed.

User::loadFromDatabase is used several times in SocialProfile, but I'm pretty sure it should not be. It should only ever get called internally when accessing lazy-loaded properties.

User::loadDefaults is used from CentralAuth and LdapAuthAuthentication, and perhaps needs to remain public for auth stuff.

User::decodeOptions is used by GlobalAuth

User::doLogout is used by Auth_remoteuser ext (but likely needs refactoring)


I would also recommend double-checking all those functions marked public; are they all actually public or are some of them internal User methods that shouldn't be called from outside, that were just not previously marked as private/protected?

#Comment by Reedy (talk | contribs)   17:26, 19 July 2011

The ones that were marked private (based on a @private in the comment), were fixed in r92484 by rechecking all the private ones...

#Comment by Brion VIBBER (talk | contribs)   17:35, 19 July 2011

User::saveToCache doesn't appear to be called from anywhere outside, and it looks like a private/protected sort of method.

User::loadFromRow looks like it should be private/protected, and doesn't seem to be called from outside.

Status & tagging log