r36718 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36717‎ | r36718 | r36719 >
Date:10:24, 27 June 2008
Author:ialex
Status:old
Tags:
Comment:
* Fixed some Doxygen warnings
* Removed unused global declaration of $wgOut in AjaxFunctions.php
Modified paths:
  • /trunk/phase3/includes/AjaxFunctions.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/UserMailer.php (modified) (history)
  • /trunk/phase3/maintenance/userDupes.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/userDupes.inc
@@ -80,8 +80,8 @@
8181 * not requested. (If doing resolution, edits may be reassigned.)
8282 * Status information will be echo'd to stdout.
8383 *
84 - * @param bool $doDelete pass true to actually remove things
85 - * from the database; false to just check.
 84+ * @param $doDelete bool: pass true to actually remove things
 85+ * from the database; false to just check.
8686 * @return bool
8787 */
8888 function checkDupes( $doDelete = false ) {
@@ -202,8 +202,8 @@
203203 * Examine user records for the given name. Try to see which record
204204 * will be the one that actually gets used, then check remaining records
205205 * for edits. If the dupes have no edits, we can safely remove them.
206 - * @param string $name
207 - * @param bool $doDelete
 206+ * @param $name string
 207+ * @param $doDelete bool
208208 * @access private
209209 */
210210 function examine( $name, $doDelete ) {
@@ -253,7 +253,7 @@
254254 * Count the number of edits attributed to this user.
255255 * Does not currently check log table or other things
256256 * where it might show up...
257 - * @param int $userid
 257+ * @param $userid int
258258 * @return int
259259 * @access private
260260 */
@@ -268,9 +268,9 @@
269269
270270 /**
271271 * Count the number of hits on a given table for this account.
272 - * @param string $table
273 - * @param string $field
274 - * @param int $userid
 272+ * @param $table string
 273+ * @param $field string
 274+ * @param $userid int
275275 * @return int
276276 * @access private
277277 */
@@ -284,8 +284,8 @@
285285 }
286286
287287 /**
288 - * @param int $from
289 - * @param int $to
 288+ * @param $from int
 289+ * @param $to int
290290 * @access private
291291 */
292292 function reassignEdits( $from, $to ) {
@@ -298,10 +298,10 @@
299299 }
300300
301301 /**
302 - * @param string $table
303 - * @param string $field
304 - * @param int $from
305 - * @param int $to
 302+ * @param $table string
 303+ * @param $field string
 304+ * @param $from int
 305+ * @param $to int
306306 * @access private
307307 */
308308 function reassignEditsOn( $table, $field, $from, $to ) {
@@ -316,7 +316,7 @@
317317
318318 /**
319319 * Remove a user account line.
320 - * @param int $userid
 320+ * @param $userid int
321321 * @access private
322322 */
323323 function trimAccount( $userid ) {
Index: trunk/phase3/includes/User.php
@@ -290,15 +290,14 @@
291291 * This is slightly less efficient than newFromId(), so use newFromId() if
292292 * you have both an ID and a name handy.
293293 *
294 - * @param string $name Username, validated by Title:newFromText()
295 - * @param mixed $validate Validate username. Takes the same parameters as
 294+ * @param $name String: username, validated by Title:newFromText()
 295+ * @param $validate Mixed: validate username. Takes the same parameters as
296296 * User::getCanonicalName(), except that true is accepted as an alias
297297 * for 'valid', for BC.
298298 *
299299 * @return User object, or null if the username is invalid. If the username
300300 * is not present in the database, the result will be a user object with
301301 * a name, zero user ID and default settings.
302 - * @static
303302 */
304303 static function newFromName( $name, $validate = 'valid' ) {
305304 if ( $validate === true ) {
@@ -330,9 +329,8 @@
331330 *
332331 * If the code is invalid or has expired, returns NULL.
333332 *
334 - * @param string $code
 333+ * @param $code string
335334 * @return User
336 - * @static
337335 */
338336 static function newFromConfirmationCode( $code ) {
339337 $dbr = wfGetDB( DB_SLAVE );
@@ -352,7 +350,6 @@
353351 * login credentials are invalid, the result is an anonymous user.
354352 *
355353 * @return User
356 - * @static
357354 */
358355 static function newFromSession() {
359356 $user = new User;
@@ -372,9 +369,8 @@
373370
374371 /**
375372 * Get username given an id.
376 - * @param integer $id Database user id
 373+ * @param $id Integer: database user id
377374 * @return string Nickname of a user
378 - * @static
379375 */
380376 static function whoIs( $id ) {
381377 $dbr = wfGetDB( DB_SLAVE );
@@ -384,7 +380,7 @@
385381 /**
386382 * Get the real name of a user given their identifier
387383 *
388 - * @param int $id Database user id
 384+ * @param $id Int: database user id
389385 * @return string Real name of a user
390386 */
391387 static function whoIsReal( $id ) {
@@ -394,7 +390,7 @@
395391
396392 /**
397393 * Get database id given a user name
398 - * @param string $name Nickname of a user
 394+ * @param $name String: nickname of a user
399395 * @return integer|null Database user id (null: if non existent
400396 * @static
401397 */
@@ -427,8 +423,7 @@
428424 * addresses like this, if we allowed accounts like this to be created
429425 * new users could get the old edits of these anonymous users.
430426 *
431 - * @static
432 - * @param string $name Nickname of a user
 427+ * @param $name String: nickname of a user
433428 * @return bool
434429 */
435430 static function isIP( $name ) {
@@ -443,9 +438,8 @@
444439 * is longer than the maximum allowed username size or doesn't begin with
445440 * a capital letter.
446441 *
447 - * @param string $name
 442+ * @param $name string
448443 * @return bool
449 - * @static
450444 */
451445 static function isValidUserName( $name ) {
452446 global $wgContLang, $wgMaxNameChars;
@@ -498,7 +492,7 @@
499493 * If an account already exists in this form, login will be blocked
500494 * by a failure to pass this function.
501495 *
502 - * @param string $name
 496+ * @param $name string
503497 * @return bool
504498 */
505499 static function isUsableName( $name ) {
@@ -521,7 +515,7 @@
522516 * rather than in isValidUserName() to avoid disrupting
523517 * existing accounts.
524518 *
525 - * @param string $name
 519+ * @param $name string
526520 * @return bool
527521 */
528522 static function isCreatableName( $name ) {
@@ -535,7 +529,7 @@
536530 /**
537531 * Is the input a valid password for this user?
538532 *
539 - * @param string $password Desired password
 533+ * @param $password String: desired password
540534 * @return bool
541535 */
542536 function isValidPassword( $password ) {
@@ -561,7 +555,7 @@
562556 *
563557 * @todo Check for RFC 2822 compilance (bug 959)
564558 *
565 - * @param string $addr email address
 559+ * @param $addr String: email address
566560 * @return bool
567561 */
568562 public static function isValidEmailAddr( $addr ) {
@@ -576,12 +570,12 @@
577571 /**
578572 * Given unvalidated user input, return a canonical username, or false if
579573 * the username is invalid.
580 - * @param string $name
581 - * @param mixed $validate Type of validation to use:
582 - * false No validation
583 - * 'valid' Valid for batch processes
584 - * 'usable' Valid for batch processes and login
585 - * 'creatable' Valid for batch processes, login and account creation
 574+ * @param $name string
 575+ * @param $validate Mixed: type of validation to use:
 576+ * false No validation
 577+ * 'valid' Valid for batch processes
 578+ * 'usable' Valid for batch processes and login
 579+ * 'creatable' Valid for batch processes, login and account creation
586580 */
587581 static function getCanonicalName( $name, $validate = 'valid' ) {
588582 # Force usernames to capital
@@ -634,9 +628,8 @@
635629 *
636630 * It should not be static and some day should be merged as proper member function / deprecated -- domas
637631 *
638 - * @param int $uid The user ID to check
 632+ * @param $uid Int: the user ID to check
639633 * @return int
640 - * @static
641634 */
642635 static function edits( $uid ) {
643636 wfProfileIn( __METHOD__ );
@@ -673,7 +666,6 @@
674667 * @todo hash random numbers to improve security, like generateToken()
675668 *
676669 * @return string
677 - * @static
678670 */
679671 static function randomPassword() {
680672 global $wgMinimalPasswordLength;
@@ -883,7 +875,7 @@
884876
885877 /**
886878 * Clear various cached data stored in this object.
887 - * @param string $reloadFrom Reload user and user_groups table data from a
 879+ * @param $reloadFrom String: reload user and user_groups table data from a
888880 * given source. May be "name", "id", "defaults", "session" or false for
889881 * no reload.
890882 */
@@ -907,7 +899,6 @@
908900 * and add the default language variants.
909901 * Not really private cause it's called by Language class
910902 * @return array
911 - * @static
912903 * @private
913904 */
914905 static function getDefaultOptions() {
@@ -934,7 +925,7 @@
935926 /**
936927 * Get a given default option value.
937928 *
938 - * @param string $opt
 929+ * @param $opt string
939930 * @return string
940931 */
941932 public static function getDefaultOption( $opt ) {
@@ -961,9 +952,10 @@
962953 /**
963954 * Get blocking information
964955 * @private
965 - * @param bool $bFromSlave Specify whether to check slave or master. To improve performance,
966 - * non-critical checks are done against slaves. Check when actually saving should be done against
967 - * master.
 956+ * @param $bFromSlave Bool: specify whether to check slave or master. To
 957+ * improve performance, non-critical checks are done
 958+ * against slaves. Check when actually saving should be
 959+ * done against master.
968960 */
969961 function getBlockedStatus( $bFromSlave = true ) {
970962 global $wgEnableSorbs, $wgProxyWhitelist;
@@ -1089,7 +1081,6 @@
10901082 * last-hit counters will be shared across wikis.
10911083 *
10921084 * @return bool true if a rate limiter was tripped
1093 - * @public
10941085 */
10951086 function pingLimiter( $action='edit' ) {
10961087
@@ -1286,7 +1277,6 @@
12871278 /**
12881279 * Return the title dbkey form of the name, for eg user pages.
12891280 * @return string
1290 - * @public
12911281 */
12921282 function getTitleKey() {
12931283 return str_replace( ' ', '_', $this->getName() );
@@ -1341,9 +1331,9 @@
13421332 * Perform a user_newtalk check, uncached.
13431333 * Use getNewtalk for a cached check.
13441334 *
1345 - * @param string $field
1346 - * @param mixed $id
1347 - * @param bool $fromMaster True to fetch from the master, false for a slave
 1335+ * @param $field string
 1336+ * @param $id mixed
 1337+ * @param $fromMaster Bool: true to fetch from the master, false for a slave
13481338 * @return bool
13491339 * @private
13501340 */
@@ -1360,8 +1350,8 @@
13611351
13621352 /**
13631353 * Add or update the
1364 - * @param string $field
1365 - * @param mixed $id
 1354+ * @param $field string
 1355+ * @param $id mixed
13661356 * @private
13671357 */
13681358 function updateNewtalk( $field, $id ) {
@@ -1381,8 +1371,8 @@
13821372
13831373 /**
13841374 * Clear the new messages flag for the given user
1385 - * @param string $field
1386 - * @param mixed $id
 1375+ * @param $field string
 1376+ * @param $id mixed
13871377 * @private
13881378 */
13891379 function deleteNewtalk( $field, $id ) {
@@ -1401,7 +1391,7 @@
14021392
14031393 /**
14041394 * Update the 'You have new messages!' status.
1405 - * @param bool $val
 1395+ * @param $val bool
14061396 */
14071397 function setNewtalk( $val ) {
14081398 if( wfReadOnly() ) {
@@ -1496,7 +1486,7 @@
14971487 * wipes it, so the account cannot be logged in until
14981488 * a new password is set, for instance via e-mail.
14991489 *
1500 - * @param string $str
 1490+ * @param $str string
15011491 * @throws PasswordError on failure
15021492 */
15031493 function setPassword( $str ) {
@@ -1527,7 +1517,7 @@
15281518 * Set the password and reset the random token no matter
15291519 * what.
15301520 *
1531 - * @param string $str
 1521+ * @param $str string
15321522 */
15331523 function setInternalPassword( $str ) {
15341524 $this->load();
@@ -1630,8 +1620,8 @@
16311621 }
16321622
16331623 /**
1634 - * @param string $oname The option to check
1635 - * @param string $defaultOverride A default value returned if the option does not exist
 1624+ * @param $oname String: the option to check
 1625+ * @param $defaultOverride String: A default value returned if the option does not exist
16361626 * @return string
16371627 */
16381628 function getOption( $oname, $defaultOverride = '' ) {
@@ -1669,7 +1659,7 @@
16701660 }
16711661
16721662 /**
1673 - * @param string $oname The option to check
 1663+ * @param $oname String: the option to check
16741664 * @return bool False if the option is not selected, true if it is
16751665 */
16761666 function getBoolOption( $oname ) {
@@ -1678,8 +1668,8 @@
16791669
16801670 /**
16811671 * Get an option as an integer value from the source string.
1682 - * @param string $oname The option to check
1683 - * @param int $default Optional value to return if option is unset/blank.
 1672+ * @param $oname String: the option to check
 1673+ * @param $default Int: optional value to return if option is unset/blank.
16841674 * @return int
16851675 */
16861676 function getIntOption( $oname, $default=0 ) {
@@ -1738,7 +1728,7 @@
17391729 * Get the list of implicit group memberships this user has.
17401730 * This includes all explicit groups, plus 'user' if logged in,
17411731 * '*' for all accounts and autopromoted groups
1742 - * @param boolean $recache Don't use the cache
 1732+ * @param $recache Boolean: don't use the cache
17431733 * @return array of strings
17441734 */
17451735 function getEffectiveGroups( $recache = false ) {
@@ -1777,7 +1767,7 @@
17781768 /**
17791769 * Add the user to the given group.
17801770 * This takes immediate effect.
1781 - * @param string $group
 1771+ * @param $group string
17821772 */
17831773 function addGroup( $group ) {
17841774 $dbw = wfGetDB( DB_MASTER );
@@ -1801,7 +1791,7 @@
18021792 /**
18031793 * Remove the user from the given group.
18041794 * This takes immediate effect.
1805 - * @param string $group
 1795+ * @param $group string
18061796 */
18071797 function removeGroup( $group ) {
18081798 $this->load();
@@ -1852,7 +1842,7 @@
18531843
18541844 /**
18551845 * Check if user is allowed to access a feature / make an action
1856 - * @param string $action Action to be checked
 1846+ * @param $action String: action to be checked
18571847 * @return boolean True: action is allowed, False: action should not be allowed
18581848 */
18591849 function isAllowed($action='') {
@@ -1901,7 +1891,7 @@
19021892 }
19031893
19041894 /**#@+
1905 - * @param string $title Article title to look at
 1895+ * @param $title Title: article title to look at
19061896 */
19071897
19081898 /**
@@ -1985,7 +1975,7 @@
19861976 'wl_title' => $title->getDBkey(),
19871977 'wl_namespace' => $title->getNamespace(),
19881978 'wl_user' => $this->getID()
1989 - ), 'User::clearLastVisited'
 1979+ ), __METHOD__
19901980 );
19911981 }
19921982 }
@@ -1997,8 +1987,7 @@
19981988 * If e-notif e-mails are on, they will receive notification mails on
19991989 * the next change of any watched page.
20001990 *
2001 - * @param int $currentUser user ID number
2002 - * @public
 1991+ * @param $currentUser Int: user ID number
20031992 */
20041993 function clearAllNotifications( $currentUser ) {
20051994 global $wgUseEnotif, $wgShowUpdatedMarker;
@@ -2198,8 +2187,8 @@
21992188 /**
22002189 * Add a user to the database, return the user object
22012190 *
2202 - * @param string $name The user's name
2203 - * @param array $params Associative array of non-default parameters to save to the database:
 2191+ * @param $name String: the user's name
 2192+ * @param $params Associative array of non-default parameters to save to the database:
22042193 * password The user's password. Password logins will be disabled if this is omitted.
22052194 * newpassword A temporary password mailed to the user
22062195 * email The user's email address
@@ -2347,7 +2336,6 @@
23482337 /**
23492338 * Determine if the user is blocked from using Special:Emailuser.
23502339 *
2351 - * @public
23522340 * @return boolean
23532341 */
23542342 function isBlockedFromEmailuser() {
@@ -2370,7 +2358,6 @@
23712359 * Get this user's personal page title.
23722360 *
23732361 * @return Title
2374 - * @public
23752362 */
23762363 function getUserPage() {
23772364 return Title::makeTitle( NS_USER, $this->getName() );
@@ -2380,7 +2367,6 @@
23812368 * Get this user's talk page title.
23822369 *
23832370 * @return Title
2384 - * @public
23852371 */
23862372 function getTalkPage() {
23872373 $title = $this->getUserPage();
@@ -2438,7 +2424,7 @@
24392425
24402426 /**
24412427 * Check to see if the given clear-text password is one of the accepted passwords
2442 - * @param string $password User password.
 2428+ * @param $password String: user password.
24432429 * @return bool True if the given password is correct otherwise False.
24442430 */
24452431 function checkPassword( $password ) {
@@ -2491,10 +2477,9 @@
24922478 * login credentials aren't being hijacked with a foreign form
24932479 * submission.
24942480 *
2495 - * @param mixed $salt - Optional function-specific data for hash.
2496 - * Use a string or an array of strings.
 2481+ * @param $salt Mixed: optional function-specific data for hash.
 2482+ * Use a string or an array of strings.
24972483 * @return string
2498 - * @public
24992484 */
25002485 function editToken( $salt = '' ) {
25012486 if ( $this->isAnon() ) {
@@ -2529,10 +2514,9 @@
25302515 * user's own login session, not a form submission from a third-party
25312516 * site.
25322517 *
2533 - * @param string $val - the input value to compare
2534 - * @param string $salt - Optional function-specific data for hash
 2518+ * @param $val String: the input value to compare
 2519+ * @param $salt String: optional function-specific data for hash
25352520 * @return bool
2536 - * @public
25372521 */
25382522 function matchEditToken( $val, $salt = '' ) {
25392523 $sessionToken = $this->editToken( $salt );
@@ -2580,9 +2564,10 @@
25812565 * Send an e-mail to this user's account. Does not check for
25822566 * confirmed status or validity.
25832567 *
2584 - * @param string $subject
2585 - * @param string $body
2586 - * @param string $from Optional from address; default $wgPasswordSender will be used otherwise.
 2568+ * @param $subject string
 2569+ * @param $body string
 2570+ * @param $from string: optional from address; default $wgPasswordSender will be used otherwise.
 2571+ * @param $replyto string
25872572 * @return mixed True on success, a WikiError object on failure.
25882573 */
25892574 function sendMail( $subject, $body, $from = null, $replyto = null ) {
@@ -2621,7 +2606,7 @@
26222607
26232608 /**
26242609 * Return a URL the user can use to confirm their email address.
2625 - * @param $token: accepts the email confirmation token
 2610+ * @param $token accepts the email confirmation token
26262611 * @return string
26272612 * @private
26282613 */
@@ -2630,7 +2615,7 @@
26312616 }
26322617 /**
26332618 * Return a URL the user can use to invalidate their email address.
2634 - * @param $token: accepts the email confirmation token
 2619+ * @param $token accepts the email confirmation token
26352620 * @return string
26362621 * @private
26372622 */
@@ -2759,7 +2744,7 @@
27602745 }
27612746
27622747 /**
2763 - * @param array $groups list of groups
 2748+ * @param $groups Array: list of groups
27642749 * @return array list of permission key names for given groups combined
27652750 */
27662751 static function getGroupPermissions( $groups ) {
@@ -2775,7 +2760,7 @@
27762761 }
27772762
27782763 /**
2779 - * @param string $group key name
 2764+ * @param $group String: key name
27802765 * @return string localized descriptive name for group, if provided
27812766 */
27822767 static function getGroupName( $group ) {
@@ -2789,7 +2774,7 @@
27902775 }
27912776
27922777 /**
2793 - * @param string $group key name
 2778+ * @param $group String: key name
27942779 * @return string localized descriptive name for member of a group, if provided
27952780 */
27962781 static function getGroupMember( $group ) {
@@ -2961,8 +2946,8 @@
29622947 /**
29632948 * Make an old-style password hash
29642949 *
2965 - * @param string $password Plain-text password
2966 - * @param string $userId User ID
 2950+ * @param $password String: plain-text password
 2951+ * @param $userId String: user ID
29672952 */
29682953 static function oldCrypt( $password, $userId ) {
29692954 global $wgPasswordSalt;
@@ -2976,8 +2961,8 @@
29772962 /**
29782963 * Make a new-style password hash
29792964 *
2980 - * @param string $password Plain-text password
2981 - * @param string $salt Salt, may be random or the user ID. False to generate a salt.
 2965+ * @param $password String: plain-text password
 2966+ * @param $salt String: salt, may be random or the user ID. False to generate a salt.
29822967 */
29832968 static function crypt( $password, $salt = false ) {
29842969 global $wgPasswordSalt;
@@ -2996,9 +2981,9 @@
29972982 * Compare a password hash with a plain-text password. Requires the user
29982983 * ID if there's a chance that the hash is an old-style hash.
29992984 *
3000 - * @param string $hash Password hash
3001 - * @param string $password Plain-text password to compare
3002 - * @param string $userId User ID for old-style password salt
 2985+ * @param $hash String: password hash
 2986+ * @param $password String: plain-text password to compare
 2987+ * @param $userId String: user ID for old-style password salt
30032988 */
30042989 static function comparePasswords( $hash, $password, $userId = false ) {
30052990 $m = false;
Index: trunk/phase3/includes/UserMailer.php
@@ -29,8 +29,8 @@
3030 */
3131 class MailAddress {
3232 /**
33 - * @param mixed $address String with an email address, or a User object
34 - * @param string $name Human-readable name if a string address is given
 33+ * @param $address Mixed: string with an email address, or a User object
 34+ * @param $name String: human-readable name if a string address is given
3535 */
3636 function __construct( $address, $name=null ) {
3737 if( is_object( $address ) && $address instanceof User ) {
Index: trunk/phase3/includes/AjaxFunctions.php
@@ -75,7 +75,7 @@
7676 define( 'AJAX_SEARCH_VERSION', 2 ); //AJAX search cache version
7777
7878 function wfSajaxSearch( $term ) {
79 - global $wgContLang, $wgOut, $wgUser, $wgCapitalLinks, $wgMemc;
 79+ global $wgContLang, $wgUser, $wgCapitalLinks, $wgMemc;
8080 $limit = 16;
8181 $sk = $wgUser->getSkin();
8282 $output = '';

Status & tagging log