Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -981,7 +981,7 @@ |
982 | 982 | /** |
983 | 983 | * Add an array of categories, with names in the keys |
984 | 984 | * |
985 | | - * @param $categories Associative array mapping category name to its sort key |
| 985 | + * @param $categories Array mapping category name => sort key |
986 | 986 | */ |
987 | 987 | public function addCategoryLinks( $categories ) { |
988 | 988 | global $wgUser, $wgContLang; |
— | — | @@ -1043,7 +1043,7 @@ |
1044 | 1044 | /** |
1045 | 1045 | * Reset the category links (but not the category list) and add $categories |
1046 | 1046 | * |
1047 | | - * @param $categories Associative array mapping category name to its sort key |
| 1047 | + * @param $categories Array mapping category name => sort key |
1048 | 1048 | */ |
1049 | 1049 | public function setCategoryLinks( $categories ) { |
1050 | 1050 | $this->mCategoryLinks = array(); |
— | — | @@ -1471,7 +1471,7 @@ |
1472 | 1472 | * Add an HTTP header that will influence on the cache |
1473 | 1473 | * |
1474 | 1474 | * @param $header String: header name |
1475 | | - * @param $option either an Array or null |
| 1475 | + * @param $option Array|null |
1476 | 1476 | * @fixme Document the $option parameter; it appears to be for |
1477 | 1477 | * X-Vary-Options but what format is acceptable? |
1478 | 1478 | */ |
— | — | @@ -2047,7 +2047,7 @@ |
2048 | 2048 | /** |
2049 | 2049 | * Format a list of error messages |
2050 | 2050 | * |
2051 | | - * @param $errors An array of arrays returned by Title::getUserPermissionsErrors |
| 2051 | + * @param $errors Array of arrays returned by Title::getUserPermissionsErrors |
2052 | 2052 | * @param $action String: action that was denied or null if unknown |
2053 | 2053 | * @return String: the wikitext error-messages, formatted into a list. |
2054 | 2054 | */ |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -94,10 +94,10 @@ |
95 | 95 | /** |
96 | 96 | * Create a new Title from a prefixed DB key |
97 | 97 | * |
98 | | - * @param $key String The database key, which has underscores |
| 98 | + * @param $key String the database key, which has underscores |
99 | 99 | * instead of spaces, possibly including namespace and |
100 | 100 | * interwiki prefixes |
101 | | - * @return Title the new object, or NULL on an error |
| 101 | + * @return Title, or NULL on an error |
102 | 102 | */ |
103 | 103 | public static function newFromDBkey( $key ) { |
104 | 104 | $t = new Title(); |
— | — | @@ -113,13 +113,13 @@ |
114 | 114 | * Create a new Title from text, such as what one would find in a link. De- |
115 | 115 | * codes any HTML entities in the text. |
116 | 116 | * |
117 | | - * @param $text String The link text; spaces, prefixes, and an |
| 117 | + * @param $text String the link text; spaces, prefixes, and an |
118 | 118 | * initial ':' indicating the main namespace are accepted. |
119 | | - * @param $defaultNamespace int The namespace to use if none is speci- |
| 119 | + * @param $defaultNamespace Int the namespace to use if none is speci- |
120 | 120 | * fied by a prefix. If you want to force a specific namespace even if |
121 | 121 | * $text might begin with a namespace prefix, use makeTitle() or |
122 | 122 | * makeTitleSafe(). |
123 | | - * @return Title The new object, or null on an error. |
| 123 | + * @return Title, or null on an error. |
124 | 124 | */ |
125 | 125 | public static function newFromText( $text, $defaultNamespace = NS_MAIN ) { |
126 | 126 | if ( is_object( $text ) ) { |
— | — | @@ -138,9 +138,7 @@ |
139 | 139 | return Title::$titleCache[$text]; |
140 | 140 | } |
141 | 141 | |
142 | | - /** |
143 | | - * Convert things like é ā or 〗 into normalized (bug 14952) text |
144 | | - */ |
| 142 | + # Convert things like é ā or 〗 into normalized (bug 14952) text |
145 | 143 | $filteredText = Sanitizer::decodeCharReferencesAndNormalize( $text ); |
146 | 144 | |
147 | 145 | $t = new Title(); |
— | — | @@ -272,8 +270,8 @@ |
273 | 271 | * |
274 | 272 | * @param $ns Int the namespace of the article |
275 | 273 | * @param $title String the unprefixed database key form |
276 | | - * @param $fragment String The link fragment (after the "#") |
277 | | - * @param $interwiki String The interwiki prefix |
| 274 | + * @param $fragment String the link fragment (after the "#") |
| 275 | + * @param $interwiki String the interwiki prefix |
278 | 276 | * @return Title the new object |
279 | 277 | */ |
280 | 278 | public static function &makeTitle( $ns, $title, $fragment = '', $interwiki = '' ) { |
— | — | @@ -294,9 +292,9 @@ |
295 | 293 | * than makeTitle() but safer for user-provided data. |
296 | 294 | * |
297 | 295 | * @param $ns Int the namespace of the article |
298 | | - * @param $title String the database key form |
299 | | - * @param $fragment String The link fragment (after the "#") |
300 | | - * @param $interwiki String The interwiki prefix |
| 296 | + * @param $title String database key form |
| 297 | + * @param $fragment String the link fragment (after the "#") |
| 298 | + * @param $interwiki String interwiki prefix |
301 | 299 | * @return Title the new object, or NULL on an error |
302 | 300 | */ |
303 | 301 | public static function makeTitleSafe( $ns, $title, $fragment = '', $interwiki = '' ) { |
— | — | @@ -343,7 +341,7 @@ |
344 | 342 | * in order to provide (hopefully) the Title of the final destination instead of another redirect |
345 | 343 | * |
346 | 344 | * @param $text String Text with possible redirect |
347 | | - * @return Title The corresponding Title |
| 345 | + * @return Title |
348 | 346 | */ |
349 | 347 | public static function newFromRedirectRecurse( $text ) { |
350 | 348 | $titles = self::newFromRedirectArray( $text ); |
— | — | @@ -396,7 +394,7 @@ |
397 | 395 | * Do not call this function directly, use one of the newFromRedirect* functions above |
398 | 396 | * |
399 | 397 | * @param $text String Text with possible redirect |
400 | | - * @return Title The corresponding Title |
| 398 | + * @return Title |
401 | 399 | */ |
402 | 400 | protected static function newFromRedirectInternal( $text ) { |
403 | 401 | $redir = MagicWord::get( 'redirect' ); |
— | — | @@ -432,8 +430,7 @@ |
433 | 431 | * Get the prefixed DB key associated with an ID |
434 | 432 | * |
435 | 433 | * @param $id Int the page_id of the article |
436 | | - * @return Title an object representing the article, or NULL |
437 | | - * if no such article was found |
| 434 | + * @return Title an object representing the article, or NULL if no such article was found |
438 | 435 | */ |
439 | 436 | public static function nameOf( $id ) { |
440 | 437 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -468,8 +465,7 @@ |
469 | 466 | * |
470 | 467 | * @param $ns Int a namespace index |
471 | 468 | * @param $title String text-form main part |
472 | | - * @return String a stripped-down title string ready for the |
473 | | - * search index |
| 469 | + * @return String a stripped-down title string ready for the search index |
474 | 470 | */ |
475 | 471 | public static function indexTitle( $ns, $title ) { |
476 | 472 | global $wgContLang; |
— | — | @@ -518,8 +514,7 @@ |
519 | 515 | * Determine whether the object refers to a page within |
520 | 516 | * this project. |
521 | 517 | * |
522 | | - * @return Bool TRUE if this is an in-project interwiki link |
523 | | - * or a wikilink, FALSE otherwise |
| 518 | + * @return Bool TRUE if this is an in-project interwiki link or a wikilink, FALSE otherwise |
524 | 519 | */ |
525 | 520 | public function isLocal() { |
526 | 521 | if ( $this->mInterwiki != '' ) { |
— | — | @@ -544,8 +539,7 @@ |
545 | 540 | } |
546 | 541 | |
547 | 542 | /** |
548 | | - * Returns the DB name of the distant wiki |
549 | | - * which owns the object. |
| 543 | + * Returns the DB name of the distant wiki which owns the object. |
550 | 544 | * |
551 | 545 | * @return String the DB name |
552 | 546 | */ |
— | — | @@ -598,7 +592,7 @@ |
599 | 593 | public function getDBkey() { return $this->mDbkeyform; } |
600 | 594 | |
601 | 595 | /** |
602 | | - * Get the namespace index, i.e.\ one of the NS_xxxx constants. |
| 596 | + * Get the namespace index, i.e. one of the NS_xxxx constants. |
603 | 597 | * |
604 | 598 | * @return Integer: Namespace index |
605 | 599 | */ |
— | — | @@ -738,8 +732,7 @@ |
739 | 733 | * Get the prefixed title with spaces, plus any fragment |
740 | 734 | * (part beginning with '#') |
741 | 735 | * |
742 | | - * @return String the prefixed title, with spaces and |
743 | | - * the fragment, including '#' |
| 736 | + * @return String the prefixed title, with spaces and the fragment, including '#' |
744 | 737 | */ |
745 | 738 | public function getFullText() { |
746 | 739 | $text = $this->getPrefixedText(); |
— | — | @@ -939,7 +932,7 @@ |
940 | 933 | * |
941 | 934 | * @param $query Array of Strings An associative array of key => value pairs for the |
942 | 935 | * query string. Keys and values will be escaped. |
943 | | - * @param $variant String Language variant of URL (for sr, zh..). Ignored |
| 936 | + * @param $variant String language variant of URL (for sr, zh..). Ignored |
944 | 937 | * for external links. Default is "false" (same variant as current page, |
945 | 938 | * for anonymous users). |
946 | 939 | * @return String the URL |
— | — | @@ -1185,7 +1178,7 @@ |
1186 | 1179 | * @param $user User to check |
1187 | 1180 | * @param $doExpensiveQueries Bool Set this to false to avoid doing unnecessary queries. |
1188 | 1181 | * @param $ignoreErrors Array of Strings Set this to a list of message keys whose corresponding errors may be ignored. |
1189 | | - * @return Array of arrays of the arguments to wfMsg to explain permissions problems. |
| 1182 | + * @return Array of arguments to wfMsg to explain permissions problems. |
1190 | 1183 | */ |
1191 | 1184 | public function getUserPermissionsErrors( $action, $user, $doExpensiveQueries = true, $ignoreErrors = array() ) { |
1192 | 1185 | $errors = $this->getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries ); |
— | — | @@ -1436,7 +1429,7 @@ |
1437 | 1430 | * Check restrictions on cascading pages. |
1438 | 1431 | * |
1439 | 1432 | * @param $action String the action to check |
1440 | | - * @param $user User user to check |
| 1433 | + * @param $user User to check |
1441 | 1434 | * @param $errors Array list of current errors |
1442 | 1435 | * @param $doExpensiveQueries Boolean whether or not to perform expensive queries |
1443 | 1436 | * @param $short Boolean short circuit on first error |
— | — | @@ -1475,7 +1468,7 @@ |
1476 | 1469 | * Check action permissions not already checked in checkQuickPermissions |
1477 | 1470 | * |
1478 | 1471 | * @param $action String the action to check |
1479 | | - * @param $user User user to check |
| 1472 | + * @param $user User to check |
1480 | 1473 | * @param $errors Array list of current errors |
1481 | 1474 | * @param $doExpensiveQueries Boolean whether or not to perform expensive queries |
1482 | 1475 | * @param $short Boolean short circuit on first error |
— | — | @@ -1521,7 +1514,7 @@ |
1522 | 1515 | * Check that the user isn't blocked from editting. |
1523 | 1516 | * |
1524 | 1517 | * @param $action String the action to check |
1525 | | - * @param $user User user to check |
| 1518 | + * @param $user User to check |
1526 | 1519 | * @param $errors Array list of current errors |
1527 | 1520 | * @param $doExpensiveQueries Boolean whether or not to perform expensive queries |
1528 | 1521 | * @param $short Boolean short circuit on first error |
— | — | @@ -1797,44 +1790,33 @@ |
1798 | 1791 | } else { |
1799 | 1792 | global $wgWhitelistRead; |
1800 | 1793 | |
1801 | | - /** |
1802 | | - * Always grant access to the login page. |
1803 | | - * Even anons need to be able to log in. |
1804 | | - */ |
| 1794 | + # Always grant access to the login page. |
| 1795 | + # Even anons need to be able to log in. |
1805 | 1796 | if ( $this->isSpecial( 'Userlogin' ) || $this->isSpecial( 'Resetpass' ) ) { |
1806 | 1797 | return true; |
1807 | 1798 | } |
1808 | 1799 | |
1809 | | - /** |
1810 | | - * Bail out if there isn't whitelist |
1811 | | - */ |
| 1800 | + # Bail out if there isn't whitelist |
1812 | 1801 | if ( !is_array( $wgWhitelistRead ) ) { |
1813 | 1802 | return false; |
1814 | 1803 | } |
1815 | 1804 | |
1816 | | - /** |
1817 | | - * Check for explicit whitelisting |
1818 | | - */ |
| 1805 | + # Check for explicit whitelisting |
1819 | 1806 | $name = $this->getPrefixedText(); |
1820 | 1807 | $dbName = $this->getPrefixedDBKey(); |
1821 | 1808 | // Check with and without underscores |
1822 | 1809 | if ( in_array( $name, $wgWhitelistRead, true ) || in_array( $dbName, $wgWhitelistRead, true ) ) |
1823 | 1810 | return true; |
1824 | 1811 | |
1825 | | - /** |
1826 | | - * Old settings might have the title prefixed with |
1827 | | - * a colon for main-namespace pages |
1828 | | - */ |
| 1812 | + # Old settings might have the title prefixed with |
| 1813 | + # a colon for main-namespace pages |
1829 | 1814 | if ( $this->getNamespace() == NS_MAIN ) { |
1830 | 1815 | if ( in_array( ':' . $name, $wgWhitelistRead ) ) { |
1831 | 1816 | return true; |
1832 | 1817 | } |
1833 | 1818 | } |
1834 | 1819 | |
1835 | | - /** |
1836 | | - * If it's a special page, ditch the subpage bit |
1837 | | - * and check again |
1838 | | - */ |
| 1820 | + # If it's a special page, ditch the subpage bit and check again |
1839 | 1821 | if ( $this->getNamespace() == NS_SPECIAL ) { |
1840 | 1822 | $name = $this->getDBkey(); |
1841 | 1823 | list( $name, /* $subpage */ ) = SpecialPage::resolveAliasWithSubpage( $name ); |
— | — | @@ -1964,7 +1946,7 @@ |
1965 | 1947 | * Is this a *valid* .css or .js subpage of a user page? |
1966 | 1948 | * |
1967 | 1949 | * @return Bool |
1968 | | - * @deprecated |
| 1950 | + * @deprecated @since 1.17 |
1969 | 1951 | */ |
1970 | 1952 | public function isValidCssJsSubpage() { |
1971 | 1953 | return $this->isCssJsSubpage(); |
— | — | @@ -2040,11 +2022,10 @@ |
2041 | 2023 | * |
2042 | 2024 | * @param $getPages Bool Whether or not to retrieve the actual pages |
2043 | 2025 | * that the restrictions have come from. |
2044 | | - * @return Mixed Array of the Title |
2045 | | - * objects of the pages from which cascading restrictions have come, |
2046 | | - * false for none, or true if such restrictions exist, but $getPages was not set. |
2047 | | - * The restriction array is an array of each type, each of which contains a |
2048 | | - * array of unique groups. |
| 2026 | + * @return Mixed Array of Title objects of the pages from which cascading restrictions |
| 2027 | + * have come, false for none, or true if such restrictions exist, but $getPages |
| 2028 | + * was not set. The restriction array is an array of each type, each of which |
| 2029 | + * contains a array of unique groups. |
2049 | 2030 | */ |
2050 | 2031 | public function getCascadeProtectionSources( $getPages = true ) { |
2051 | 2032 | $pagerestrictions = array(); |
— | — | @@ -2151,7 +2132,7 @@ |
2152 | 2133 | * Loads a string into mRestrictions array |
2153 | 2134 | * |
2154 | 2135 | * @param $res Resource restrictions as an SQL result. |
2155 | | - * @param $oldFashionedRestrictions string comma-separated list of page |
| 2136 | + * @param $oldFashionedRestrictions String comma-separated list of page |
2156 | 2137 | * restrictions from page table (pre 1.10) |
2157 | 2138 | */ |
2158 | 2139 | private function loadRestrictionsFromResultWrapper( $res, $oldFashionedRestrictions = null ) { |
— | — | @@ -2214,11 +2195,10 @@ |
2215 | 2196 | $now = wfTimestampNow(); |
2216 | 2197 | $purgeExpired = false; |
2217 | 2198 | |
| 2199 | + # Cycle through all the restrictions. |
2218 | 2200 | foreach ( $rows as $row ) { |
2219 | | - # Cycle through all the restrictions. |
2220 | 2201 | |
2221 | 2202 | // Don't take care of restrictions types that aren't allowed |
2222 | | - |
2223 | 2203 | if ( !in_array( $row->pr_type, $restrictionTypes ) ) |
2224 | 2204 | continue; |
2225 | 2205 | |
— | — | @@ -2249,7 +2229,7 @@ |
2250 | 2230 | /** |
2251 | 2231 | * Load restrictions from the page_restrictions table |
2252 | 2232 | * |
2253 | | - * @param $oldFashionedRestrictions string comma-separated list of page |
| 2233 | + * @param $oldFashionedRestrictions String comma-separated list of page |
2254 | 2234 | * restrictions from page table (pre 1.10) |
2255 | 2235 | */ |
2256 | 2236 | public function loadRestrictions( $oldFashionedRestrictions = null ) { |
— | — | @@ -2320,7 +2300,7 @@ |
2321 | 2301 | /** |
2322 | 2302 | * Get the expiry time for the restriction against a given action |
2323 | 2303 | * |
2324 | | - * @return 14-char timestamp, or 'infinity' if the page is protected forever |
| 2304 | + * @return String|Bool 14-char timestamp, or 'infinity' if the page is protected forever |
2325 | 2305 | * or not protected at all, or false if the action is not recognised. |
2326 | 2306 | */ |
2327 | 2307 | public function getRestrictionExpiry( $action ) { |
— | — | @@ -2535,7 +2515,7 @@ |
2536 | 2516 | * Note that this doesn't pick up many things that could be wrong with titles, but that |
2537 | 2517 | * replacing this regex with something valid will make many titles valid. |
2538 | 2518 | * |
2539 | | - * @return string regex string |
| 2519 | + * @return String regex string |
2540 | 2520 | */ |
2541 | 2521 | static function getTitleInvalidRegex() { |
2542 | 2522 | static $rxTc = false; |
— | — | @@ -2560,7 +2540,7 @@ |
2561 | 2541 | /** |
2562 | 2542 | * Capitalize a text string for a title if it belongs to a namespace that capitalizes |
2563 | 2543 | * |
2564 | | - * @param $text string containing title to capitalize |
| 2544 | + * @param $text String containing title to capitalize |
2565 | 2545 | * @param $ns int namespace index, defaults to NS_MAIN |
2566 | 2546 | * @return String containing capitalized title |
2567 | 2547 | */ |
— | — | @@ -2605,7 +2585,6 @@ |
2606 | 2586 | # Note: use of the /u option on preg_replace here will cause |
2607 | 2587 | # input with invalid UTF-8 sequences to be nullified out in PHP 5.2.x, |
2608 | 2588 | # conveniently disabling them. |
2609 | | - # |
2610 | 2589 | $dbkey = preg_replace( '/[ _\xA0\x{1680}\x{180E}\x{2000}-\x{200A}\x{2028}\x{2029}\x{202F}\x{205F}\x{3000}]+/u', '_', $dbkey ); |
2611 | 2590 | $dbkey = trim( $dbkey, '_' ); |
2612 | 2591 | |
— | — | @@ -2642,9 +2621,11 @@ |
2643 | 2622 | # For Talk:X pages, check if X has a "namespace" prefix |
2644 | 2623 | if ( $ns == NS_TALK && preg_match( $prefixRegexp, $dbkey, $x ) ) { |
2645 | 2624 | if ( $wgContLang->getNsIndex( $x[1] ) ) { |
2646 | | - return false; # Disallow Talk:File:x type titles... |
| 2625 | + # Disallow Talk:File:x type titles... |
| 2626 | + return false; |
2647 | 2627 | } else if ( Interwiki::isValidInterwiki( $x[1] ) ) { |
2648 | | - return false; # Disallow Talk:Interwiki:x type titles... |
| 2628 | + # Disallow Talk:Interwiki:x type titles... |
| 2629 | + return false; |
2649 | 2630 | } |
2650 | 2631 | } |
2651 | 2632 | } elseif ( Interwiki::isValidInterwiki( $p ) ) { |
— | — | @@ -2686,7 +2667,6 @@ |
2687 | 2668 | } while ( true ); |
2688 | 2669 | |
2689 | 2670 | # We already know that some pages won't be in the database! |
2690 | | - # |
2691 | 2671 | if ( $this->mInterwiki != '' || NS_SPECIAL == $this->mNamespace ) { |
2692 | 2672 | $this->mArticleID = 0; |
2693 | 2673 | } |
— | — | @@ -2700,16 +2680,13 @@ |
2701 | 2681 | } |
2702 | 2682 | |
2703 | 2683 | # Reject illegal characters. |
2704 | | - # |
2705 | 2684 | if ( preg_match( $rxTc, $dbkey ) ) { |
2706 | 2685 | return false; |
2707 | 2686 | } |
2708 | 2687 | |
2709 | | - /** |
2710 | | - * Pages with "/./" or "/../" appearing in the URLs will often be un- |
2711 | | - * reachable due to the way web browsers deal with 'relative' URLs. |
2712 | | - * Also, they conflict with subpage syntax. Forbid them explicitly. |
2713 | | - */ |
| 2688 | + # Pages with "/./" or "/../" appearing in the URLs will often be un- |
| 2689 | + # reachable due to the way web browsers deal with 'relative' URLs. |
| 2690 | + # Also, they conflict with subpage syntax. Forbid them explicitly. |
2714 | 2691 | if ( strpos( $dbkey, '.' ) !== false && |
2715 | 2692 | ( $dbkey === '.' || $dbkey === '..' || |
2716 | 2693 | strpos( $dbkey, './' ) === 0 || |
— | — | @@ -2722,57 +2699,45 @@ |
2723 | 2700 | return false; |
2724 | 2701 | } |
2725 | 2702 | |
2726 | | - /** |
2727 | | - * Magic tilde sequences? Nu-uh! |
2728 | | - */ |
| 2703 | + # Magic tilde sequences? Nu-uh! |
2729 | 2704 | if ( strpos( $dbkey, '~~~' ) !== false ) { |
2730 | 2705 | return false; |
2731 | 2706 | } |
2732 | 2707 | |
2733 | | - /** |
2734 | | - * Limit the size of titles to 255 bytes. |
2735 | | - * This is typically the size of the underlying database field. |
2736 | | - * We make an exception for special pages, which don't need to be stored |
2737 | | - * in the database, and may edge over 255 bytes due to subpage syntax |
2738 | | - * for long titles, e.g. [[Special:Block/Long name]] |
2739 | | - */ |
| 2708 | + # Limit the size of titles to 255 bytes. This is typically the size of the |
| 2709 | + # underlying database field. We make an exception for special pages, which |
| 2710 | + # don't need to be stored in the database, and may edge over 255 bytes due |
| 2711 | + # to subpage syntax for long titles, e.g. [[Special:Block/Long name]] |
2740 | 2712 | if ( ( $this->mNamespace != NS_SPECIAL && strlen( $dbkey ) > 255 ) || |
2741 | 2713 | strlen( $dbkey ) > 512 ) |
2742 | 2714 | { |
2743 | 2715 | return false; |
2744 | 2716 | } |
2745 | 2717 | |
2746 | | - /** |
2747 | | - * Normally, all wiki links are forced to have |
2748 | | - * an initial capital letter so [[foo]] and [[Foo]] |
2749 | | - * point to the same place. |
2750 | | - * |
2751 | | - * Don't force it for interwikis, since the other |
2752 | | - * site might be case-sensitive. |
2753 | | - */ |
| 2718 | + # Normally, all wiki links are forced to have an initial capital letter so [[foo]] |
| 2719 | + # and [[Foo]] point to the same place. Don't force it for interwikis, since the |
| 2720 | + # other site might be case-sensitive. |
2754 | 2721 | $this->mUserCaseDBKey = $dbkey; |
2755 | 2722 | if ( $this->mInterwiki == '' ) { |
2756 | 2723 | $dbkey = self::capitalize( $dbkey, $this->mNamespace ); |
2757 | 2724 | } |
2758 | 2725 | |
2759 | | - /** |
2760 | | - * Can't make a link to a namespace alone... |
2761 | | - * "empty" local links can only be self-links |
2762 | | - * with a fragment identifier. |
2763 | | - */ |
2764 | | - if ( $dbkey == '' && |
2765 | | - $this->mInterwiki == '' && |
2766 | | - $this->mNamespace != NS_MAIN ) { |
| 2726 | + # Can't make a link to a namespace alone... "empty" local links can only be |
| 2727 | + # self-links with a fragment identifier. |
| 2728 | + if ( $dbkey == '' && $this->mInterwiki == '' && $this->mNamespace != NS_MAIN ) { |
2767 | 2729 | return false; |
2768 | 2730 | } |
| 2731 | + |
2769 | 2732 | // Allow IPv6 usernames to start with '::' by canonicalizing IPv6 titles. |
2770 | 2733 | // IP names are not allowed for accounts, and can only be referring to |
2771 | 2734 | // edits from the IP. Given '::' abbreviations and caps/lowercaps, |
2772 | 2735 | // there are numerous ways to present the same IP. Having sp:contribs scan |
2773 | 2736 | // them all is silly and having some show the edits and others not is |
2774 | 2737 | // inconsistent. Same for talk/userpages. Keep them normalized instead. |
2775 | | - $dbkey = ( $this->mNamespace == NS_USER || $this->mNamespace == NS_USER_TALK ) ? |
2776 | | - IP::sanitizeIP( $dbkey ) : $dbkey; |
| 2738 | + $dbkey = ( $this->mNamespace == NS_USER || $this->mNamespace == NS_USER_TALK ) |
| 2739 | + ? IP::sanitizeIP( $dbkey ) |
| 2740 | + : $dbkey; |
| 2741 | + |
2777 | 2742 | // Any remaining initial :s are illegal. |
2778 | 2743 | if ( $dbkey !== '' && ':' == $dbkey { 0 } ) { |
2779 | 2744 | return false; |
— | — | @@ -3082,7 +3047,7 @@ |
3083 | 3048 | * @param $nt Title the new title |
3084 | 3049 | * @param $auth Bool indicates whether $wgUser's permissions |
3085 | 3050 | * should be checked |
3086 | | - * @param $reason String The reason for the move |
| 3051 | + * @param $reason String the reason for the move |
3087 | 3052 | * @param $createRedirect Bool Whether to create a redirect from the old title to the new title. |
3088 | 3053 | * Ignored if the user doesn't have the suppressredirect right. |
3089 | 3054 | * @return Mixed true on success, getUserPermissionsErrors()-like array on failure |
— | — | @@ -3093,7 +3058,8 @@ |
3094 | 3059 | return $err; |
3095 | 3060 | } |
3096 | 3061 | |
3097 | | - // If it is a file, move it first. It is done before all other moving stuff is done because it's hard to revert |
| 3062 | + // If it is a file, move it first. It is done before all other moving stuff is |
| 3063 | + // done because it's hard to revert |
3098 | 3064 | $dbw = wfGetDB( DB_MASTER ); |
3099 | 3065 | if ( $this->getNamespace() == NS_FILE ) { |
3100 | 3066 | $file = wfLocalFile( $this ); |
— | — | @@ -3217,12 +3183,10 @@ |
3218 | 3184 | * Move page to a title which is either a redirect to the |
3219 | 3185 | * source page or nonexistent |
3220 | 3186 | * |
3221 | | - * @param $nt Title the page to move to, which should |
3222 | | - * be a redirect or nonexistent |
| 3187 | + * @param $nt Title the page to move to, which should be a redirect or nonexistent |
3223 | 3188 | * @param $reason String The reason for the move |
3224 | | - * @param $createRedirect Bool Whether to leave a |
3225 | | - * redirect at the old title. Ignored if the user doesn't |
3226 | | - * have the suppressredirect right |
| 3189 | + * @param $createRedirect Bool Whether to leave a redirect at the old title. Ignored |
| 3190 | + * if the user doesn't have the suppressredirect right |
3227 | 3191 | */ |
3228 | 3192 | private function moveToInternal( &$nt, $reason = '', $createRedirect = true ) { |
3229 | 3193 | global $wgUser, $wgContLang; |
— | — | @@ -3351,10 +3315,11 @@ |
3352 | 3316 | * @param $nt Title Move target |
3353 | 3317 | * @param $auth bool Whether $wgUser's permissions should be checked |
3354 | 3318 | * @param $reason string The reason for the move |
3355 | | - * @param $createRedirect bool Whether to create redirects from the old subpages to the new ones |
3356 | | - * Ignored if the user doesn't have the 'suppressredirect' right |
| 3319 | + * @param $createRedirect bool Whether to create redirects from the old subpages to |
| 3320 | + * the new ones Ignored if the user doesn't have the 'suppressredirect' right |
3357 | 3321 | * @return mixed array with old page titles as keys, and strings (new page titles) or |
3358 | | - * arrays (errors) as values, or an error array with numeric indices if no pages were moved |
| 3322 | + * arrays (errors) as values, or an error array with numeric indices if no pages |
| 3323 | + * were moved |
3359 | 3324 | */ |
3360 | 3325 | public function moveSubpages( $nt, $auth = true, $reason = '', $createRedirect = true ) { |
3361 | 3326 | global $wgMaximumMovedPages; |
— | — | @@ -3459,7 +3424,7 @@ |
3460 | 3425 | * - Selects for update, so don't call it unless you mean business |
3461 | 3426 | * |
3462 | 3427 | * @param $nt Title the new title to check |
3463 | | - * @return Bool TRUE or FALSE |
| 3428 | + * @return Bool |
3464 | 3429 | */ |
3465 | 3430 | public function isValidMoveTarget( $nt ) { |
3466 | 3431 | # Is it an existing file? |
— | — | @@ -3511,7 +3476,7 @@ |
3512 | 3477 | * categories' names. |
3513 | 3478 | * |
3514 | 3479 | * @return Array of parents in the form: |
3515 | | - * $parent => $currentarticle |
| 3480 | + * $parent => $currentarticle |
3516 | 3481 | */ |
3517 | 3482 | public function getParentCategories() { |
3518 | 3483 | global $wgContLang; |
— | — | @@ -3574,7 +3539,7 @@ |
3575 | 3540 | * Get an associative array for selecting this title from |
3576 | 3541 | * the "page" table |
3577 | 3542 | * |
3578 | | - * @return Array Selection array |
| 3543 | + * @return Array suitable for the $where parameter of DB::select() |
3579 | 3544 | */ |
3580 | 3545 | public function pageCond() { |
3581 | 3546 | if ( $this->mArticleID > 0 ) { |
— | — | @@ -3590,7 +3555,7 @@ |
3591 | 3556 | * |
3592 | 3557 | * @param $revId Int Revision ID. Get the revision that was before this one. |
3593 | 3558 | * @param $flags Int Title::GAID_FOR_UPDATE |
3594 | | - * @return \twotypes{\int,\bool} Old revision ID, or FALSE if none exists |
| 3559 | + * @return Int|Bool Old revision ID, or FALSE if none exists |
3595 | 3560 | */ |
3596 | 3561 | public function getPreviousRevisionID( $revId, $flags = 0 ) { |
3597 | 3562 | $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
— | — | @@ -3609,7 +3574,7 @@ |
3610 | 3575 | * |
3611 | 3576 | * @param $revId Int Revision ID. Get the revision that was after this one. |
3612 | 3577 | * @param $flags Int Title::GAID_FOR_UPDATE |
3613 | | - * @return \twotypes{\int,\bool} Next revision ID, or FALSE if none exists |
| 3578 | + * @return Int|Bool Next revision ID, or FALSE if none exists |
3614 | 3579 | */ |
3615 | 3580 | public function getNextRevisionID( $revId, $flags = 0 ) { |
3616 | 3581 | $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
— | — | @@ -3627,7 +3592,7 @@ |
3628 | 3593 | * Get the first revision of the page |
3629 | 3594 | * |
3630 | 3595 | * @param $flags Int Title::GAID_FOR_UPDATE |
3631 | | - * @return Revision (or NULL if page doesn't exist) |
| 3596 | + * @return Revision|Null if page doesn't exist |
3632 | 3597 | */ |
3633 | 3598 | public function getFirstRevision( $flags = 0 ) { |
3634 | 3599 | $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
— | — | @@ -3719,7 +3684,7 @@ |
3720 | 3685 | * Compare with another title. |
3721 | 3686 | * |
3722 | 3687 | * @param $title Title |
3723 | | - * @return Bool TRUE or FALSE |
| 3688 | + * @return Bool |
3724 | 3689 | */ |
3725 | 3690 | public function equals( Title $title ) { |
3726 | 3691 | // Note: === is necessary for proper matching of number-like titles. |
— | — | @@ -3744,7 +3709,7 @@ |
3745 | 3710 | /** |
3746 | 3711 | * Return a string representation of this title |
3747 | 3712 | * |
3748 | | - * @return String String representation of this title |
| 3713 | + * @return String representation of this title |
3749 | 3714 | */ |
3750 | 3715 | public function __toString() { |
3751 | 3716 | return $this->getPrefixedText(); |
— | — | @@ -3786,17 +3751,21 @@ |
3787 | 3752 | switch( $this->mNamespace ) { |
3788 | 3753 | case NS_MEDIA: |
3789 | 3754 | case NS_FILE: |
3790 | | - return (bool)wfFindFile( $this ); // file exists, possibly in a foreign repo |
| 3755 | + // file exists, possibly in a foreign repo |
| 3756 | + return (bool)wfFindFile( $this ); |
3791 | 3757 | case NS_SPECIAL: |
3792 | | - return SpecialPage::exists( $this->getDBkey() ); // valid special page |
| 3758 | + // valid special page |
| 3759 | + return SpecialPage::exists( $this->getDBkey() ); |
3793 | 3760 | case NS_MAIN: |
3794 | | - return $this->mDbkeyform == ''; // selflink, possibly with fragment |
| 3761 | + // selflink, possibly with fragment |
| 3762 | + return $this->mDbkeyform == ''; |
3795 | 3763 | case NS_MEDIAWIKI: |
3796 | 3764 | // If the page is form Mediawiki:message/lang, calling wfMsgWeirdKey causes |
3797 | 3765 | // the full l10n of that language to be loaded. That takes much memory and |
3798 | 3766 | // isn't needed. So we strip the language part away. |
3799 | 3767 | list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 ); |
3800 | | - return (bool)wfMsgWeirdKey( $basename ); // known system message |
| 3768 | + // known system message |
| 3769 | + return (bool)wfMsgWeirdKey( $basename ); |
3801 | 3770 | default: |
3802 | 3771 | return false; |
3803 | 3772 | } |
— | — | @@ -3866,7 +3835,7 @@ |
3867 | 3836 | * Get the last touched timestamp |
3868 | 3837 | * |
3869 | 3838 | * @param $db DatabaseBase: optional db |
3870 | | - * @return String Last touched timestamp |
| 3839 | + * @return String last-touched timestamp |
3871 | 3840 | */ |
3872 | 3841 | public function getTouched( $db = null ) { |
3873 | 3842 | $db = isset( $db ) ? $db : wfGetDB( DB_SLAVE ); |
— | — | @@ -3878,7 +3847,7 @@ |
3879 | 3848 | * Get the timestamp when this page was updated since the user last saw it. |
3880 | 3849 | * |
3881 | 3850 | * @param $user User |
3882 | | - * @return Mixed: string/null |
| 3851 | + * @return String|Null |
3883 | 3852 | */ |
3884 | 3853 | public function getNotificationTimestamp( $user = null ) { |
3885 | 3854 | global $wgUser, $wgShowUpdatedMarker; |
— | — | @@ -4007,10 +3976,10 @@ |
4008 | 3977 | } |
4009 | 3978 | |
4010 | 3979 | /** |
4011 | | - * If the Title refers to a special page alias which is not the local default, |
| 3980 | + * If the Title refers to a special page alias which is not the local default, resolve |
| 3981 | + * the alias, and localise the name as necessary. Otherwise, return $this |
4012 | 3982 | * |
4013 | | - * @return Title A new Title which points to the local default. |
4014 | | - * Otherwise, returns $this. |
| 3983 | + * @return Title |
4015 | 3984 | */ |
4016 | 3985 | public function fixSpecialName() { |
4017 | 3986 | if ( $this->getNamespace() == NS_SPECIAL ) { |
— | — | @@ -4039,8 +4008,7 @@ |
4040 | 4009 | /** |
4041 | 4010 | * Get all extant redirects to this Title |
4042 | 4011 | * |
4043 | | - * @param $ns Int|Null Single namespace to consider; |
4044 | | - * NULL to consider all namespaces |
| 4012 | + * @param $ns Int|Null Single namespace to consider; NULL to consider all namespaces |
4045 | 4013 | * @return Array of Title redirects to this title |
4046 | 4014 | */ |
4047 | 4015 | public function getRedirectsHere( $ns = null ) { |
— | — | @@ -4104,8 +4072,7 @@ |
4105 | 4073 | } |
4106 | 4074 | |
4107 | 4075 | /** |
4108 | | - * Whether the magic words __INDEX__ and __NOINDEX__ function for |
4109 | | - * this page. |
| 4076 | + * Whether the magic words __INDEX__ and __NOINDEX__ function for this page. |
4110 | 4077 | * |
4111 | 4078 | * @return Boolean |
4112 | 4079 | */ |