Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -207,6 +207,11 @@ |
208 | 208 | } |
209 | 209 | } |
210 | 210 | |
| 211 | +/** |
| 212 | + * Get microsecond timestamps for debug logs |
| 213 | + * |
| 214 | + * @return string |
| 215 | + */ |
211 | 216 | function wfDebugTimer() { |
212 | 217 | global $wgDebugTimestamps; |
213 | 218 | if ( !$wgDebugTimestamps ) { |
— | — | @@ -226,6 +231,7 @@ |
227 | 232 | |
228 | 233 | /** |
229 | 234 | * Send a line giving PHP memory usage. |
| 235 | + * |
230 | 236 | * @param $exact Bool: print exact values instead of kilobytes (default: false) |
231 | 237 | */ |
232 | 238 | function wfDebugMem( $exact = false ) { |
— | — | @@ -266,6 +272,7 @@ |
267 | 273 | |
268 | 274 | /** |
269 | 275 | * Log for database errors |
| 276 | + * |
270 | 277 | * @param $text String: database error message. |
271 | 278 | */ |
272 | 279 | function wfLogDBError( $text ) { |
— | — | @@ -282,6 +289,9 @@ |
283 | 290 | * |
284 | 291 | * Can also log to TCP or UDP with the syntax udp://host:port/prefix. This will |
285 | 292 | * send lines to the specified port, prefixed by the specified prefix and a space. |
| 293 | + * |
| 294 | + * @param $text String |
| 295 | + * @param $file String filename |
286 | 296 | */ |
287 | 297 | function wfErrorLog( $text, $file ) { |
288 | 298 | if ( substr( $file, 0, 4 ) == 'udp:' ) { |
— | — | @@ -395,6 +405,7 @@ |
396 | 406 | * Check if the wiki read-only lock file is present. This can be used to lock |
397 | 407 | * off editing functions, but doesn't guarantee that the database will not be |
398 | 408 | * modified. |
| 409 | + * |
399 | 410 | * @return bool |
400 | 411 | */ |
401 | 412 | function wfReadOnly() { |
— | — | @@ -423,6 +434,7 @@ |
424 | 435 | |
425 | 436 | /** |
426 | 437 | * Return a Language object from $langcode |
| 438 | + * |
427 | 439 | * @param $langcode Mixed: either: |
428 | 440 | * - a Language object |
429 | 441 | * - code of the language to get the message for, if it is |
— | — | @@ -473,6 +485,8 @@ |
474 | 486 | * in many ways, especially regarding to text direction. There is lots stuff |
475 | 487 | * to fix, hence this function to keep the old behaviour unless the global |
476 | 488 | * $wgBetterDirectionality is enabled (or removed when everything works). |
| 489 | + * |
| 490 | + * @return Language |
477 | 491 | */ |
478 | 492 | function wfUILang() { |
479 | 493 | global $wgBetterDirectionality; |
— | — | @@ -501,7 +515,7 @@ |
502 | 516 | * This function accepts multiple message keys and returns a message instance |
503 | 517 | * for the first message which is non-empty. If all messages are empty then an |
504 | 518 | * instance of the first message key is returned. |
505 | | - * Varargs: message keys |
| 519 | + * @param varargs: message keys |
506 | 520 | * @return Message |
507 | 521 | * @since 1.18 |
508 | 522 | */ |
— | — | @@ -522,6 +536,7 @@ |
523 | 537 | * This function also takes extra optional parameters (not |
524 | 538 | * shown in the function definition), which can be used to |
525 | 539 | * insert variable text into the predefined message. |
| 540 | + * @return String |
526 | 541 | */ |
527 | 542 | function wfMsg( $key ) { |
528 | 543 | $args = func_get_args(); |
— | — | @@ -531,6 +546,9 @@ |
532 | 547 | |
533 | 548 | /** |
534 | 549 | * Same as above except doesn't transform the message |
| 550 | + * |
| 551 | + * @param $key String |
| 552 | + * @return String |
535 | 553 | */ |
536 | 554 | function wfMsgNoTrans( $key ) { |
537 | 555 | $args = func_get_args(); |
— | — | @@ -558,7 +576,8 @@ |
559 | 577 | * order to, e.g., fix a link in every possible language. |
560 | 578 | * |
561 | 579 | * @param $key String: lookup key for the message, usually |
562 | | - * defined in languages/Language.php |
| 580 | + * defined in languages/Language.php |
| 581 | + * @return String |
563 | 582 | */ |
564 | 583 | function wfMsgForContent( $key ) { |
565 | 584 | global $wgForceUIMsgAsContentMsg; |
— | — | @@ -575,6 +594,9 @@ |
576 | 595 | |
577 | 596 | /** |
578 | 597 | * Same as above except doesn't transform the message |
| 598 | + * |
| 599 | + * @param $key String |
| 600 | + * @return String |
579 | 601 | */ |
580 | 602 | function wfMsgForContentNoTrans( $key ) { |
581 | 603 | global $wgForceUIMsgAsContentMsg; |
— | — | @@ -623,6 +645,7 @@ |
624 | 646 | |
625 | 647 | /** |
626 | 648 | * Really get a message |
| 649 | + * |
627 | 650 | * @param $key String: key to get. |
628 | 651 | * @param $args |
629 | 652 | * @param $useDB Boolean |
— | — | @@ -656,6 +679,7 @@ |
657 | 680 | |
658 | 681 | /** |
659 | 682 | * Fetch a message string value, but don't replace any keys yet. |
| 683 | + * |
660 | 684 | * @param $key String |
661 | 685 | * @param $useDB Bool |
662 | 686 | * @param $langCode String: Code of the language to get the message for, or |
— | — | @@ -757,6 +781,8 @@ |
758 | 782 | * (overriden by <i>content</i>), its behaviour with parse, parseinline |
759 | 783 | * and parsemag is undefined. |
760 | 784 | * Behavior for conflicting options (e.g., parse+parseinline) is undefined. |
| 785 | + * |
| 786 | + * @return String |
761 | 787 | */ |
762 | 788 | function wfMsgExt( $key, $options ) { |
763 | 789 | $args = func_get_args(); |
— | — | @@ -875,6 +901,7 @@ |
876 | 902 | * etc). This should not be called directly once $wgFullyInitialised is set; instead, |
877 | 903 | * throw an exception and let Exception.php handle whether or not it's possible to show |
878 | 904 | * a prettier error. |
| 905 | + * |
879 | 906 | * @param $msg String |
880 | 907 | */ |
881 | 908 | if( !function_exists( 'wfDie' ) ){ |
— | — | @@ -898,6 +925,7 @@ |
899 | 926 | * Fetch server name for use in error reporting etc. |
900 | 927 | * Use real server name if available, so we know which machine |
901 | 928 | * in a server farm generated the current page. |
| 929 | + * |
902 | 930 | * @return string |
903 | 931 | */ |
904 | 932 | function wfHostname() { |
— | — | @@ -925,6 +953,7 @@ |
926 | 954 | /** |
927 | 955 | * Returns a HTML comment with the elapsed time since request. |
928 | 956 | * This method has no side effects. |
| 957 | + * |
929 | 958 | * @return string |
930 | 959 | */ |
931 | 960 | function wfReportTime() { |
— | — | @@ -976,6 +1005,11 @@ |
977 | 1006 | return array_slice( debug_backtrace(), 1 ); |
978 | 1007 | } |
979 | 1008 | |
| 1009 | +/** |
| 1010 | + * Get a debug backtrace as a string |
| 1011 | + * |
| 1012 | + * @return string |
| 1013 | + */ |
980 | 1014 | function wfBacktrace() { |
981 | 1015 | global $wgCommandLineMode; |
982 | 1016 | |
— | — | @@ -1028,6 +1062,10 @@ |
1029 | 1063 | |
1030 | 1064 | /** |
1031 | 1065 | * @todo document |
| 1066 | + * |
| 1067 | + * @param $offset Int |
| 1068 | + * @param $limit Int |
| 1069 | + * @return String |
1032 | 1070 | */ |
1033 | 1071 | function wfShowingResults( $offset, $limit ) { |
1034 | 1072 | global $wgLang; |
— | — | @@ -1041,6 +1079,11 @@ |
1042 | 1080 | |
1043 | 1081 | /** |
1044 | 1082 | * @todo document |
| 1083 | + * |
| 1084 | + * @param $offset Int |
| 1085 | + * @param $limit Int |
| 1086 | + * @param $num Int |
| 1087 | + * @return String |
1045 | 1088 | */ |
1046 | 1089 | function wfShowingResultsNum( $offset, $limit, $num ) { |
1047 | 1090 | global $wgLang; |
— | — | @@ -1055,11 +1098,13 @@ |
1056 | 1099 | |
1057 | 1100 | /** |
1058 | 1101 | * Generate (prev x| next x) (20|50|100...) type links for paging |
| 1102 | + * |
1059 | 1103 | * @param $offset String |
1060 | 1104 | * @param $limit Integer |
1061 | 1105 | * @param $link String |
1062 | 1106 | * @param $query String: optional URL query parameter string |
1063 | 1107 | * @param $atend Bool: optional param for specified if this is the last page |
| 1108 | + * @return String |
1064 | 1109 | */ |
1065 | 1110 | function wfViewPrevNext( $offset, $limit, $link, $query = '', $atend = false ) { |
1066 | 1111 | global $wgLang; |
— | — | @@ -1116,6 +1161,7 @@ |
1117 | 1162 | |
1118 | 1163 | /** |
1119 | 1164 | * Generate links for (20|50|100...) items-per-page links |
| 1165 | + * |
1120 | 1166 | * @param $offset String |
1121 | 1167 | * @param $limit Integer |
1122 | 1168 | * @param $title Title |
— | — | @@ -1139,6 +1185,7 @@ |
1140 | 1186 | * @todo document |
1141 | 1187 | * @todo FIXME: we may want to blacklist some broken browsers |
1142 | 1188 | * |
| 1189 | + * @param $force Bool |
1143 | 1190 | * @return bool Whereas client accept gzip compression |
1144 | 1191 | */ |
1145 | 1192 | function wfClientAcceptsGzip( $force = false ) { |
— | — | @@ -1170,8 +1217,8 @@ |
1171 | 1218 | * Obtain the offset and limit values from the request string; |
1172 | 1219 | * used in special pages |
1173 | 1220 | * |
1174 | | - * @param $deflimit Default limit if none supplied |
1175 | | - * @param $optionname Name of a user preference to check against |
| 1221 | + * @param $deflimit Int default limit if none supplied |
| 1222 | + * @param $optionname String Name of a user preference to check against |
1176 | 1223 | * @return array |
1177 | 1224 | * |
1178 | 1225 | */ |
— | — | @@ -1187,6 +1234,7 @@ |
1188 | 1235 | * As required by the callers, <nowiki> is not used. |
1189 | 1236 | * |
1190 | 1237 | * @param $text String: text to be escaped |
| 1238 | + * @return String |
1191 | 1239 | */ |
1192 | 1240 | function wfEscapeWikiText( $text ) { |
1193 | 1241 | $text = strtr( "\n$text", array( |
— | — | @@ -1201,8 +1249,8 @@ |
1202 | 1250 | } |
1203 | 1251 | |
1204 | 1252 | /** |
1205 | | - * @todo document |
1206 | | - * @return float |
| 1253 | + * Get the current unix timetstamp with microseconds. Useful for profiling |
| 1254 | + * @return Float |
1207 | 1255 | */ |
1208 | 1256 | function wfTime() { |
1209 | 1257 | return microtime( true ); |
— | — | @@ -1212,6 +1260,11 @@ |
1213 | 1261 | * Sets dest to source and returns the original value of dest |
1214 | 1262 | * If source is NULL, it just returns the value, it doesn't set the variable |
1215 | 1263 | * If force is true, it will set the value even if source is NULL |
| 1264 | + * |
| 1265 | + * @param $dest Mixed |
| 1266 | + * @param $source Mixed |
| 1267 | + * @param $force Bool |
| 1268 | + * @return Mixed |
1216 | 1269 | */ |
1217 | 1270 | function wfSetVar( &$dest, $source, $force = false ) { |
1218 | 1271 | $temp = $dest; |
— | — | @@ -1223,6 +1276,10 @@ |
1224 | 1277 | |
1225 | 1278 | /** |
1226 | 1279 | * As for wfSetVar except setting a bit |
| 1280 | + * |
| 1281 | + * @param $dest Int |
| 1282 | + * @param $bit Int |
| 1283 | + * @param $state Bool |
1227 | 1284 | */ |
1228 | 1285 | function wfSetBit( &$dest, $bit, $state = true ) { |
1229 | 1286 | $temp = (bool)( $dest & $bit ); |
— | — | @@ -1240,6 +1297,10 @@ |
1241 | 1298 | * This function takes two arrays as input, and returns a CGI-style string, e.g. |
1242 | 1299 | * "days=7&limit=100". Options in the first array override options in the second. |
1243 | 1300 | * Options set to "" will not be output. |
| 1301 | + * |
| 1302 | + * @param $array1 Array( String|Array ) |
| 1303 | + * @param $array2 Array( String|Array ) |
| 1304 | + * @return String |
1244 | 1305 | */ |
1245 | 1306 | function wfArrayToCGI( $array1, $array2 = null ) { |
1246 | 1307 | if ( !is_null( $array2 ) ) { |
— | — | @@ -1352,6 +1413,9 @@ |
1353 | 1414 | * |
1354 | 1415 | * Also fixes the locale problems on Linux in PHP 5.2.6+ (bug backported to |
1355 | 1416 | * earlier distro releases of PHP) |
| 1417 | + * |
| 1418 | + * @param varargs |
| 1419 | + * @return String |
1356 | 1420 | */ |
1357 | 1421 | function wfEscapeShellArg( ) { |
1358 | 1422 | wfInitShellLocale(); |
— | — | @@ -1409,6 +1473,12 @@ |
1410 | 1474 | /** |
1411 | 1475 | * wfMerge attempts to merge differences between three texts. |
1412 | 1476 | * Returns true for a clean merge and false for failure or a conflict. |
| 1477 | + * |
| 1478 | + * @param $old String |
| 1479 | + * @param $mine String |
| 1480 | + * @param $yours String |
| 1481 | + * @param $result String |
| 1482 | + * @return Bool |
1413 | 1483 | */ |
1414 | 1484 | function wfMerge( $old, $mine, $yours, &$result ) { |
1415 | 1485 | global $wgDiff3; |
— | — | @@ -1478,6 +1548,7 @@ |
1479 | 1549 | /** |
1480 | 1550 | * Returns unified plain-text diff of two texts. |
1481 | 1551 | * Useful for machine processing of diffs. |
| 1552 | + * |
1482 | 1553 | * @param $before String: the text before the changes. |
1483 | 1554 | * @param $after String: the text after the changes. |
1484 | 1555 | * @param $params String: command-line options for the diff command. |
— | — | @@ -1564,6 +1635,10 @@ |
1565 | 1636 | |
1566 | 1637 | /** |
1567 | 1638 | * Provide a simple HTTP error. |
| 1639 | + * |
| 1640 | + * @param $code Int|String |
| 1641 | + * @param $label String |
| 1642 | + * @param $desc String |
1568 | 1643 | */ |
1569 | 1644 | function wfHttpError( $code, $label, $desc ) { |
1570 | 1645 | global $wgOut; |
— | — | @@ -1657,6 +1732,10 @@ |
1658 | 1733 | /** |
1659 | 1734 | * Converts an Accept-* header into an array mapping string values to quality |
1660 | 1735 | * factors |
| 1736 | + * |
| 1737 | + * @param $accept String |
| 1738 | + * @param $def String default |
| 1739 | + * @return Array |
1661 | 1740 | */ |
1662 | 1741 | function wfAcceptToPrefs( $accept, $def = '*/*' ) { |
1663 | 1742 | # No arg means accept anything (per HTTP spec) |
— | — | @@ -1763,6 +1842,8 @@ |
1764 | 1843 | * Returns an array where the values in the first array are replaced by the |
1765 | 1844 | * values in the second array with the corresponding keys |
1766 | 1845 | * |
| 1846 | + * @param $a Array |
| 1847 | + * @param $b Array |
1767 | 1848 | * @return array |
1768 | 1849 | */ |
1769 | 1850 | function wfArrayLookup( $a, $b ) { |
— | — | @@ -1771,6 +1852,7 @@ |
1772 | 1853 | |
1773 | 1854 | /** |
1774 | 1855 | * Convenience function; returns MediaWiki timestamp for the present time. |
| 1856 | + * |
1775 | 1857 | * @return string |
1776 | 1858 | */ |
1777 | 1859 | function wfTimestampNow() { |
— | — | @@ -1780,6 +1862,8 @@ |
1781 | 1863 | |
1782 | 1864 | /** |
1783 | 1865 | * Reference-counted warning suppression |
| 1866 | + * |
| 1867 | + * @param $end Bool |
1784 | 1868 | */ |
1785 | 1869 | function wfSuppressWarnings( $end = false ) { |
1786 | 1870 | static $suppressCount = 0; |
— | — | @@ -1865,13 +1949,13 @@ |
1866 | 1950 | define( 'TS_DB2', 8 ); |
1867 | 1951 | |
1868 | 1952 | /** |
1869 | | - * ISO 8601 basic format with no timezone: 19860209T200000Z |
1870 | | - * |
1871 | | - * This is used by ResourceLoader |
| 1953 | + * ISO 8601 basic format with no timezone: 19860209T200000Z. This is used by ResourceLoader |
1872 | 1954 | */ |
1873 | 1955 | define( 'TS_ISO_8601_BASIC', 9 ); |
1874 | 1956 | |
1875 | 1957 | /** |
| 1958 | + * Get a timestamp string in one of various formats |
| 1959 | + * |
1876 | 1960 | * @param $outputtype Mixed: A timestamp in one of the supported formats, the |
1877 | 1961 | * function will autodetect which format is supplied and act |
1878 | 1962 | * accordingly. |
— | — | @@ -1998,6 +2082,7 @@ |
1999 | 2083 | /** |
2000 | 2084 | * Return a formatted timestamp, or null if input is null. |
2001 | 2085 | * For dealing with nullable timestamp columns in the database. |
| 2086 | + * |
2002 | 2087 | * @param $outputtype Integer |
2003 | 2088 | * @param $ts String |
2004 | 2089 | * @return String |
— | — | @@ -2025,6 +2110,8 @@ |
2026 | 2111 | |
2027 | 2112 | /** |
2028 | 2113 | * Check if we are running under HipHop |
| 2114 | + * |
| 2115 | + * @return Bool |
2029 | 2116 | */ |
2030 | 2117 | function wfIsHipHop() { |
2031 | 2118 | return function_exists( 'hphp_thread_set_warmup_enabled' ); |
— | — | @@ -2032,6 +2119,9 @@ |
2033 | 2120 | |
2034 | 2121 | /** |
2035 | 2122 | * Swap two variables |
| 2123 | + * |
| 2124 | + * @param $x Mixed |
| 2125 | + * @param $y Mixed |
2036 | 2126 | */ |
2037 | 2127 | function swap( &$x, &$y ) { |
2038 | 2128 | $z = $x; |
— | — | @@ -2113,6 +2203,9 @@ |
2114 | 2204 | |
2115 | 2205 | /** |
2116 | 2206 | * Increment a statistics counter |
| 2207 | + * |
| 2208 | + * @param $key String |
| 2209 | + * @param $count Int |
2117 | 2210 | */ |
2118 | 2211 | function wfIncrStats( $key, $count = 1 ) { |
2119 | 2212 | global $wgStatsMethod; |
— | — | @@ -2176,7 +2269,7 @@ |
2177 | 2270 | * @param $userid Integer: ID of the user |
2178 | 2271 | * @param $password String: password of the user |
2179 | 2272 | * @return String: hashed password |
2180 | | - * @deprecated Use User::crypt() or User::oldCrypt() instead |
| 2273 | + * @deprecated since 1.13 Use User::crypt() or User::oldCrypt() instead |
2181 | 2274 | */ |
2182 | 2275 | function wfEncryptPassword( $userid, $password ) { |
2183 | 2276 | wfDeprecated(__FUNCTION__); |
— | — | @@ -2186,6 +2279,11 @@ |
2187 | 2280 | |
2188 | 2281 | /** |
2189 | 2282 | * Appends to second array if $value differs from that in $default |
| 2283 | + * |
| 2284 | + * @param $key String|Int |
| 2285 | + * @param $value Mixed |
| 2286 | + * @param $default Mixed |
| 2287 | + * @param $changed Array to alter |
2190 | 2288 | */ |
2191 | 2289 | function wfAppendToArrayIfNotDefault( $key, $value, $default, &$changed ) { |
2192 | 2290 | if ( is_null( $changed ) ) { |
— | — | @@ -2579,6 +2677,8 @@ |
2580 | 2678 | * array( 'x' ), |
2581 | 2679 | * array( 'y' ) |
2582 | 2680 | * ) |
| 2681 | + * @param varargs |
| 2682 | + * @return Array |
2583 | 2683 | */ |
2584 | 2684 | function wfMergeErrorArrays( /*...*/ ) { |
2585 | 2685 | $args = func_get_args(); |
— | — | @@ -2633,6 +2733,9 @@ |
2634 | 2734 | |
2635 | 2735 | /** |
2636 | 2736 | * Make a URL index, appropriate for the el_index field of externallinks. |
| 2737 | + * |
| 2738 | + * @param $url String |
| 2739 | + * @return String |
2637 | 2740 | */ |
2638 | 2741 | function wfMakeUrlIndex( $url ) { |
2639 | 2742 | $bits = wfParseUrl( $url ); |
— | — | @@ -2800,6 +2903,7 @@ |
2801 | 2904 | |
2802 | 2905 | /** |
2803 | 2906 | * Create an object with a given name and an array of construct parameters |
| 2907 | + * |
2804 | 2908 | * @param $name String |
2805 | 2909 | * @param $p Array: parameters |
2806 | 2910 | * @deprecated |
— | — | @@ -2824,6 +2928,8 @@ |
2825 | 2929 | |
2826 | 2930 | /** |
2827 | 2931 | * Initialise php session |
| 2932 | + * |
| 2933 | + * @param $sessionId Bool |
2828 | 2934 | */ |
2829 | 2935 | function wfSetupSession( $sessionId = false ) { |
2830 | 2936 | global $wgSessionsInMemcached, $wgCookiePath, $wgCookieDomain, |
— | — | @@ -2867,6 +2973,7 @@ |
2868 | 2974 | /** |
2869 | 2975 | * Get an object from the precompiled serialized directory |
2870 | 2976 | * |
| 2977 | + * @param $name String |
2871 | 2978 | * @return Mixed: the variable on success, false on failure |
2872 | 2979 | */ |
2873 | 2980 | function wfGetPrecompiledData( $name ) { |
— | — | @@ -2882,6 +2989,12 @@ |
2883 | 2990 | return false; |
2884 | 2991 | } |
2885 | 2992 | |
| 2993 | +/** |
| 2994 | + * Get the name of the function which called this function |
| 2995 | + * |
| 2996 | + * @param $level Int |
| 2997 | + * @return Bool|string |
| 2998 | + */ |
2886 | 2999 | function wfGetCaller( $level = 2 ) { |
2887 | 3000 | $backtrace = wfDebugBacktrace(); |
2888 | 3001 | if ( isset( $backtrace[$level] ) ) { |
— | — | @@ -2898,6 +3011,7 @@ |
2899 | 3012 | * |
2900 | 3013 | * @param $limit The maximum depth of the stack frame to return, or false for |
2901 | 3014 | * the entire stack. |
| 3015 | + * @return String |
2902 | 3016 | */ |
2903 | 3017 | function wfGetAllCallers( $limit = 3 ) { |
2904 | 3018 | $trace = array_reverse( wfDebugBacktrace() ); |
— | — | @@ -2910,6 +3024,9 @@ |
2911 | 3025 | |
2912 | 3026 | /** |
2913 | 3027 | * Return a string representation of frame |
| 3028 | + * |
| 3029 | + * @param $frame Array |
| 3030 | + * @return Bool |
2914 | 3031 | */ |
2915 | 3032 | function wfFormatStackFrame( $frame ) { |
2916 | 3033 | return isset( $frame['class'] ) ? |
— | — | @@ -2919,6 +3036,9 @@ |
2920 | 3037 | |
2921 | 3038 | /** |
2922 | 3039 | * Get a cache key |
| 3040 | + * |
| 3041 | + * @param varargs |
| 3042 | + * @return String |
2923 | 3043 | */ |
2924 | 3044 | function wfMemcKey( /*... */ ) { |
2925 | 3045 | $args = func_get_args(); |
— | — | @@ -2929,6 +3049,11 @@ |
2930 | 3050 | |
2931 | 3051 | /** |
2932 | 3052 | * Get a cache key for a foreign DB |
| 3053 | + * |
| 3054 | + * @param $db String |
| 3055 | + * @param $prefix String |
| 3056 | + * @param varargs String |
| 3057 | + * @return String |
2933 | 3058 | */ |
2934 | 3059 | function wfForeignMemcKey( $db, $prefix /*, ... */ ) { |
2935 | 3060 | $args = array_slice( func_get_args(), 2 ); |
— | — | @@ -2943,6 +3068,8 @@ |
2944 | 3069 | /** |
2945 | 3070 | * Get an ASCII string identifying this wiki |
2946 | 3071 | * This is used as a prefix in memcached keys |
| 3072 | + * |
| 3073 | + * @return String |
2947 | 3074 | */ |
2948 | 3075 | function wfWikiID() { |
2949 | 3076 | global $wgDBprefix, $wgDBname; |
— | — | @@ -2955,6 +3082,9 @@ |
2956 | 3083 | |
2957 | 3084 | /** |
2958 | 3085 | * Split a wiki ID into DB name and table prefix |
| 3086 | + * |
| 3087 | + * @param $wiki String |
| 3088 | + * @param $bits String |
2959 | 3089 | */ |
2960 | 3090 | function wfSplitWikiID( $wiki ) { |
2961 | 3091 | $bits = explode( '-', $wiki, 2 ); |
— | — | @@ -2966,6 +3096,7 @@ |
2967 | 3097 | |
2968 | 3098 | /** |
2969 | 3099 | * Get a Database object. |
| 3100 | + * |
2970 | 3101 | * @param $db Integer: index of the connection to get. May be DB_MASTER for the |
2971 | 3102 | * master (for write queries), DB_SLAVE for potentially lagged read |
2972 | 3103 | * queries, or an integer >= 0 for a particular server. |
— | — | @@ -2998,6 +3129,7 @@ |
2999 | 3130 | |
3000 | 3131 | /** |
3001 | 3132 | * Get the load balancer factory object |
| 3133 | + * |
3002 | 3134 | * @return LBFactory |
3003 | 3135 | */ |
3004 | 3136 | function &wfGetLBFactory() { |
— | — | @@ -3007,6 +3139,7 @@ |
3008 | 3140 | /** |
3009 | 3141 | * Find a file. |
3010 | 3142 | * Shortcut for RepoGroup::singleton()->findFile() |
| 3143 | + * |
3011 | 3144 | * @param $title String or Title object |
3012 | 3145 | * @param $options Associative array of options: |
3013 | 3146 | * time: requested time for an archived image, or false for the |
— | — | @@ -3030,6 +3163,7 @@ |
3031 | 3164 | /** |
3032 | 3165 | * Get an object referring to a locally registered file. |
3033 | 3166 | * Returns a valid placeholder object if the file does not exist. |
| 3167 | + * |
3034 | 3168 | * @param $title Title or String |
3035 | 3169 | * @return File, or null if passed an invalid Title |
3036 | 3170 | */ |
— | — | @@ -3099,16 +3233,16 @@ |
3100 | 3234 | |
3101 | 3235 | /** |
3102 | 3236 | * Load an extension messages file |
| 3237 | + * |
3103 | 3238 | * @deprecated in 1.16, warnings in 1.18, remove in 1.20 |
3104 | 3239 | * @codeCoverageIgnore |
3105 | 3240 | */ |
3106 | | -function wfLoadExtensionMessages( $extensionName, $langcode = false ) { |
| 3241 | +function wfLoadExtensionMessages() { |
3107 | 3242 | wfDeprecated( __FUNCTION__ ); |
3108 | 3243 | } |
3109 | 3244 | |
3110 | 3245 | /** |
3111 | | - * Get a platform-independent path to the null file, e.g. |
3112 | | - * /dev/null |
| 3246 | + * Get a platform-independent path to the null file, e.g. /dev/null |
3113 | 3247 | * |
3114 | 3248 | * @return string |
3115 | 3249 | */ |
— | — | @@ -3120,6 +3254,7 @@ |
3121 | 3255 | |
3122 | 3256 | /** |
3123 | 3257 | * Throws a warning that $function is deprecated |
| 3258 | + * |
3124 | 3259 | * @param $function String |
3125 | 3260 | * @return null |
3126 | 3261 | */ |
— | — | @@ -3228,6 +3363,7 @@ |
3229 | 3364 | * Generate a random 32-character hexadecimal token. |
3230 | 3365 | * @param $salt Mixed: some sort of salt, if necessary, to add to random |
3231 | 3366 | * characters before hashing. |
| 3367 | + * @return Array |
3232 | 3368 | * @codeCoverageIgnore |
3233 | 3369 | */ |
3234 | 3370 | function wfGenerateToken( $salt = '' ) { |
— | — | @@ -3237,7 +3373,9 @@ |
3238 | 3374 | |
3239 | 3375 | /** |
3240 | 3376 | * Replace all invalid characters with - |
| 3377 | + * |
3241 | 3378 | * @param $name Mixed: filename to process |
| 3379 | + * @return String |
3242 | 3380 | */ |
3243 | 3381 | function wfStripIllegalFilenameChars( $name ) { |
3244 | 3382 | global $wgIllegalFileChars; |
— | — | @@ -3254,11 +3392,11 @@ |
3255 | 3393 | |
3256 | 3394 | /** |
3257 | 3395 | * Insert array into another array after the specified *KEY* |
| 3396 | + * |
3258 | 3397 | * @param $array Array: The array. |
3259 | 3398 | * @param $insert Array: The array to insert. |
3260 | 3399 | * @param $after Mixed: The key to insert after |
3261 | 3400 | * @return Array |
3262 | | - * @since 1.16 |
3263 | 3401 | */ |
3264 | 3402 | function wfArrayInsertAfter( $array, $insert, $after ) { |
3265 | 3403 | // Find the offset of the element to insert after. |
— | — | @@ -3276,7 +3414,13 @@ |
3277 | 3415 | return $output; |
3278 | 3416 | } |
3279 | 3417 | |
3280 | | -/* Recursively converts the parameter (an object) to an array with the same data */ |
| 3418 | +/** |
| 3419 | + * Recursively converts the parameter (an object) to an array with the same data |
| 3420 | + * |
| 3421 | + * @param $objOrArray Object|Array |
| 3422 | + * @param $recursive Bool |
| 3423 | + * @return Array |
| 3424 | + */ |
3281 | 3425 | function wfObjectToArray( $objOrArray, $recursive = true ) { |
3282 | 3426 | $array = array(); |
3283 | 3427 | if( is_object( $objOrArray ) ) { |
— | — | @@ -3295,6 +3439,7 @@ |
3296 | 3440 | |
3297 | 3441 | /** |
3298 | 3442 | * Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit; |
| 3443 | + * |
3299 | 3444 | * @return Integer value memory was set to. |
3300 | 3445 | */ |
3301 | 3446 | function wfMemoryLimit() { |
— | — | @@ -3321,6 +3466,7 @@ |
3322 | 3467 | |
3323 | 3468 | /** |
3324 | 3469 | * Converts shorthand byte notation to integer form |
| 3470 | + * |
3325 | 3471 | * @param $string String |
3326 | 3472 | * @return Integer |
3327 | 3473 | */ |
— | — | @@ -3351,11 +3497,13 @@ |
3352 | 3498 | /** |
3353 | 3499 | * Get the normalised IETF language tag |
3354 | 3500 | * See unit test for examples. |
| 3501 | + * |
3355 | 3502 | * @param $code String: The language code. |
3356 | 3503 | * @return $langCode String: The language code which complying with BCP 47 standards. |
3357 | 3504 | */ |
3358 | 3505 | function wfBCP47( $code ) { |
3359 | 3506 | $codeSegment = explode( '-', $code ); |
| 3507 | + $codeBCP = array(); |
3360 | 3508 | foreach ( $codeSegment as $segNo => $seg ) { |
3361 | 3509 | if ( count( $codeSegment ) > 0 ) { |
3362 | 3510 | // when previous segment is x, it is a private segment and should be lc |
— | — | @@ -3380,6 +3528,13 @@ |
3381 | 3529 | return $langCode; |
3382 | 3530 | } |
3383 | 3531 | |
| 3532 | +/** |
| 3533 | + * Wrapper around array_map() which also taints variables |
| 3534 | + * |
| 3535 | + * @param $function Callback |
| 3536 | + * @param $input Array |
| 3537 | + * @return Array |
| 3538 | + */ |
3384 | 3539 | function wfArrayMap( $function, $input ) { |
3385 | 3540 | $ret = array_map( $function, $input ); |
3386 | 3541 | foreach ( $ret as $key => $value ) { |
— | — | @@ -3394,27 +3549,39 @@ |
3395 | 3550 | |
3396 | 3551 | /** |
3397 | 3552 | * Get a cache object. |
| 3553 | + * |
3398 | 3554 | * @param integer $inputType Cache type, one the the CACHE_* constants. |
3399 | | - * |
3400 | 3555 | * @return BagOStuff |
3401 | 3556 | */ |
3402 | 3557 | function wfGetCache( $inputType ) { |
3403 | 3558 | return ObjectCache::getInstance( $inputType ); |
3404 | 3559 | } |
3405 | 3560 | |
3406 | | -/** Get the main cache object */ |
| 3561 | +/** |
| 3562 | + * Get the main cache object |
| 3563 | + * |
| 3564 | + * @return BagOStuff |
| 3565 | + */ |
3407 | 3566 | function wfGetMainCache() { |
3408 | 3567 | global $wgMainCacheType; |
3409 | 3568 | return ObjectCache::getInstance( $wgMainCacheType ); |
3410 | 3569 | } |
3411 | 3570 | |
3412 | | -/** Get the cache object used by the message cache */ |
| 3571 | +/** |
| 3572 | + * Get the cache object used by the message cache |
| 3573 | + * |
| 3574 | + * @return BagOStuff |
| 3575 | + */ |
3413 | 3576 | function wfGetMessageCacheStorage() { |
3414 | 3577 | global $wgMessageCacheType; |
3415 | 3578 | return ObjectCache::getInstance( $wgMessageCacheType ); |
3416 | 3579 | } |
3417 | 3580 | |
3418 | | -/** Get the cache object used by the parser cache */ |
| 3581 | +/** |
| 3582 | + * Get the cache object used by the parser cache |
| 3583 | + * |
| 3584 | + * @return BagOStuff |
| 3585 | + */ |
3419 | 3586 | function wfGetParserCacheStorage() { |
3420 | 3587 | global $wgParserCacheType; |
3421 | 3588 | return ObjectCache::getInstance( $wgParserCacheType ); |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -401,7 +401,7 @@ |
402 | 402 | |
403 | 403 | // Now that variant lists may be available... |
404 | 404 | $wgRequest->interpolateTitle(); |
405 | | -$wgUser = RequestContext::getMain()->user; # BackCompat |
| 405 | +$wgUser = RequestContext::getMain()->getUser(); # BackCompat |
406 | 406 | |
407 | 407 | /** |
408 | 408 | * @var Language |
— | — | @@ -411,7 +411,7 @@ |
412 | 412 | /** |
413 | 413 | * @var OutputPage |
414 | 414 | */ |
415 | | -$wgOut = RequestContext::getMain()->output; # BackCompat |
| 415 | +$wgOut = RequestContext::getMain()->getOutput(); # BackCompat |
416 | 416 | |
417 | 417 | /** |
418 | 418 | * @var Parser |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -1268,9 +1268,8 @@ |
1269 | 1269 | |
1270 | 1270 | /** |
1271 | 1271 | * Send the edit form and related headers to $wgOut |
1272 | | - * @param $formCallback Optional callable that takes an OutputPage |
1273 | | - * parameter; will be called during form output |
1274 | | - * near the top, for captchas and the like. |
| 1272 | + * @param $formCallback Callback that takes an OutputPage parameter; will be called |
| 1273 | + * during form output near the top, for captchas and the like. |
1275 | 1274 | */ |
1276 | 1275 | function showEditForm( $formCallback = null ) { |
1277 | 1276 | global $wgOut, $wgUser; |