Index: trunk/phase3/includes/Categoryfinder.php |
— | — | @@ -29,6 +29,10 @@ |
30 | 30 | var $targets = array(); # Array of DBKEY category names |
31 | 31 | var $name2id = array(); |
32 | 32 | var $mode; # "AND" or "OR" |
| 33 | + |
| 34 | + /** |
| 35 | + * @var DatabaseBase |
| 36 | + */ |
33 | 37 | var $dbr; # Read-DB slave |
34 | 38 | |
35 | 39 | /** |
Index: trunk/phase3/includes/FeedUtils.php |
— | — | @@ -167,7 +167,6 @@ |
168 | 168 | * |
169 | 169 | * @param $text String: diff's HTML output |
170 | 170 | * @return String: modified HTML |
171 | | - * @private |
172 | 171 | */ |
173 | 172 | public static function applyDiffStyle( $text ) { |
174 | 173 | $styles = array( |
Index: trunk/phase3/includes/Licenses.php |
— | — | @@ -134,6 +134,10 @@ |
135 | 135 | return str_repeat( "\t", $depth ) . Xml::element( 'option', $attribs, $val ) . "\n"; |
136 | 136 | } |
137 | 137 | |
| 138 | + /** |
| 139 | + * @param $str string |
| 140 | + * @return String |
| 141 | + */ |
138 | 142 | protected function msg( $str ) { |
139 | 143 | $msg = wfMessage( $str ); |
140 | 144 | return $msg->exists() ? $msg->text() : $str; |
Index: trunk/phase3/includes/Init.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | | - * Returns true if we are running under HipHop, whether in compiled or |
| 27 | + * Returns true if we are running under HipHop, whether in compiled or |
28 | 28 | * interpreted mode. |
29 | 29 | * |
30 | 30 | * @return bool |
— | — | @@ -47,10 +47,10 @@ |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | | - * If we are running code compiled by HipHop, this will pass through the |
52 | | - * input path, assumed to be relative to $IP. If the code is interpreted, |
53 | | - * it will converted to a fully qualified path. It is necessary to use a |
54 | | - * path which is relative to $IP in order to make HipHop use its compiled |
| 51 | + * If we are running code compiled by HipHop, this will pass through the |
| 52 | + * input path, assumed to be relative to $IP. If the code is interpreted, |
| 53 | + * it will converted to a fully qualified path. It is necessary to use a |
| 54 | + * path which is relative to $IP in order to make HipHop use its compiled |
55 | 55 | * code. |
56 | 56 | * |
57 | 57 | * @param $file string |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
98 | | - * Register an extension setup file and return its path for compiled |
| 98 | + * Register an extension setup file and return its path for compiled |
99 | 99 | * inclusion. Use this function in LocalSettings.php to add extensions |
100 | 100 | * to the build. For example: |
101 | 101 | * |
— | — | @@ -130,13 +130,13 @@ |
131 | 131 | /** |
132 | 132 | * Determine whether a class exists, using a method which works under HipHop. |
133 | 133 | * |
134 | | - * Note that it's not possible to implement this with any variant of |
135 | | - * class_exists(), because class_exists() returns false for classes which |
136 | | - * are compiled in. |
| 134 | + * Note that it's not possible to implement this with any variant of |
| 135 | + * class_exists(), because class_exists() returns false for classes which |
| 136 | + * are compiled in. |
137 | 137 | * |
138 | | - * Calling class_exists() on a literal string causes the class to be made |
139 | | - * "volatile", which means (as of March 2011) that the class is broken and |
140 | | - * can't be used at all. So don't do that. See |
| 138 | + * Calling class_exists() on a literal string causes the class to be made |
| 139 | + * "volatile", which means (as of March 2011) that the class is broken and |
| 140 | + * can't be used at all. So don't do that. See |
141 | 141 | * https://github.com/facebook/hiphop-php/issues/314 |
142 | 142 | * |
143 | 143 | * @param $class string |
— | — | @@ -153,11 +153,11 @@ |
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | | - * Determine whether a function exists, using a method which works under |
| 157 | + * Determine whether a function exists, using a method which works under |
158 | 158 | * HipHop. |
159 | 159 | * |
160 | 160 | * @param $function string |
161 | | - * |
| 161 | + * |
162 | 162 | * @return bool |
163 | 163 | */ |
164 | 164 | static function functionExists( $function ) { |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -868,7 +868,7 @@ |
869 | 869 | function internalAttemptSave( &$result, $bot = false ) { |
870 | 870 | global $wgFilterCallback, $wgUser, $wgRequest, $wgParser; |
871 | 871 | global $wgMaxArticleSize; |
872 | | - |
| 872 | + |
873 | 873 | $status = Status::newGood(); |
874 | 874 | |
875 | 875 | wfProfileIn( __METHOD__ ); |
— | — | @@ -891,7 +891,6 @@ |
892 | 892 | $status->setResult( false, $code ); |
893 | 893 | |
894 | 894 | wfProfileOut( __METHOD__ . '-checks' ); |
895 | | - |
896 | 895 | wfProfileOut( __METHOD__ ); |
897 | 896 | |
898 | 897 | return $status; |
— | — | @@ -936,6 +935,7 @@ |
937 | 936 | wfProfileOut( __METHOD__ ); |
938 | 937 | return $status; |
939 | 938 | } |
| 939 | + |
940 | 940 | if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) { |
941 | 941 | # Check block state against master, thus 'false'. |
942 | 942 | $status->setResult( false, self::AS_BLOCKED_PAGE_FOR_USER ); |
— | — | @@ -943,6 +943,7 @@ |
944 | 944 | wfProfileOut( __METHOD__ ); |
945 | 945 | return $status; |
946 | 946 | } |
| 947 | + |
947 | 948 | $this->kblength = (int)( strlen( $this->textbox1 ) / 1024 ); |
948 | 949 | if ( $this->kblength > $wgMaxArticleSize ) { |
949 | 950 | // Error will be displayed by showEditForm() |
Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -279,7 +279,8 @@ |
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
283 | | - * @return boolean Checkbox |
| 283 | + * @param $pattern |
| 284 | + * @return string Checkbox |
284 | 285 | */ |
285 | 286 | private function getTitlePattern( $pattern ) { |
286 | 287 | return '<span style="white-space: nowrap">' . |
— | — | @@ -287,6 +288,10 @@ |
288 | 289 | '</span>'; |
289 | 290 | } |
290 | 291 | |
| 292 | + /** |
| 293 | + * @param $types |
| 294 | + * @return string |
| 295 | + */ |
291 | 296 | private function getExtraInputs( $types ) { |
292 | 297 | global $wgRequest; |
293 | 298 | $offender = $wgRequest->getVal('offender'); |
— | — | @@ -301,10 +306,16 @@ |
302 | 307 | return ''; |
303 | 308 | } |
304 | 309 | |
| 310 | + /** |
| 311 | + * @return string |
| 312 | + */ |
305 | 313 | public function beginLogEventsList() { |
306 | 314 | return "<ul>\n"; |
307 | 315 | } |
308 | 316 | |
| 317 | + /** |
| 318 | + * @return string |
| 319 | + */ |
309 | 320 | public function endLogEventsList() { |
310 | 321 | return "</ul>\n"; |
311 | 322 | } |
— | — | @@ -347,6 +358,10 @@ |
348 | 359 | return htmlspecialchars( $time ); |
349 | 360 | } |
350 | 361 | |
| 362 | + /** |
| 363 | + * @param $row |
| 364 | + * @return String |
| 365 | + */ |
351 | 366 | private function logUserLinks( $row ) { |
352 | 367 | if( self::isDeleted( $row, LogPage::DELETED_USER ) ) { |
353 | 368 | $userLinks = '<span class="history-deleted">' . |
— | — | @@ -362,6 +377,12 @@ |
363 | 378 | return $userLinks; |
364 | 379 | } |
365 | 380 | |
| 381 | + /** |
| 382 | + * @param $row |
| 383 | + * @param $title |
| 384 | + * @param $paramArray |
| 385 | + * @return string |
| 386 | + */ |
366 | 387 | private function logAction( $row, $title, $paramArray ) { |
367 | 388 | if( self::isDeleted( $row, LogPage::DELETED_ACTION ) ) { |
368 | 389 | $action = '<span class="history-deleted">' . |
— | — | @@ -373,6 +394,10 @@ |
374 | 395 | return $action; |
375 | 396 | } |
376 | 397 | |
| 398 | + /** |
| 399 | + * @param $row |
| 400 | + * @return string |
| 401 | + */ |
377 | 402 | private function logComment( $row ) { |
378 | 403 | if( self::isDeleted( $row, LogPage::DELETED_COMMENT ) ) { |
379 | 404 | $comment = '<span class="history-deleted">' . |
— | — | @@ -811,6 +836,9 @@ |
812 | 837 | return $query; |
813 | 838 | } |
814 | 839 | |
| 840 | + /** |
| 841 | + * @return Title |
| 842 | + */ |
815 | 843 | function getTitle() { |
816 | 844 | return $this->mLogEventsList->getDisplayTitle(); |
817 | 845 | } |
— | — | @@ -1038,10 +1066,16 @@ |
1039 | 1067 | return $this->types; |
1040 | 1068 | } |
1041 | 1069 | |
| 1070 | + /** |
| 1071 | + * @return string |
| 1072 | + */ |
1042 | 1073 | public function getUser() { |
1043 | 1074 | return $this->user; |
1044 | 1075 | } |
1045 | 1076 | |
| 1077 | + /** |
| 1078 | + * @return string |
| 1079 | + */ |
1046 | 1080 | public function getPage() { |
1047 | 1081 | return $this->title; |
1048 | 1082 | } |
Index: trunk/phase3/includes/BacklinkCache.php |
— | — | @@ -75,6 +75,8 @@ |
76 | 76 | * Serialization handler, diasallows to serialize the database to prevent |
77 | 77 | * failures after this class is deserialized from cache with dead DB |
78 | 78 | * connection. |
| 79 | + * |
| 80 | + * @return array |
79 | 81 | */ |
80 | 82 | function __sleep() { |
81 | 83 | return array( 'partitionCache', 'fullResultCache', 'title' ); |
Index: trunk/phase3/includes/MagicWord.php |
— | — | @@ -230,7 +230,7 @@ |
231 | 231 | * Get an array of parser substitution modifier IDs |
232 | 232 | */ |
233 | 233 | static function getSubstIDs() { |
234 | | - return self::$mSubstIDs; |
| 234 | + return self::$mSubstIDs; |
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
— | — | @@ -309,8 +309,8 @@ |
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
313 | | - * A comparison function that returns -1, 0 or 1 depending on whether the |
314 | | - * first string is longer, the same length or shorter than the second |
| 313 | + * A comparison function that returns -1, 0 or 1 depending on whether the |
| 314 | + * first string is longer, the same length or shorter than the second |
315 | 315 | * string. |
316 | 316 | * |
317 | 317 | * @param $s1 string |
— | — | @@ -633,7 +633,7 @@ |
634 | 634 | /** |
635 | 635 | * Add a number of magic words by name |
636 | 636 | * |
637 | | - * $param $names array |
| 637 | + * @param $names array |
638 | 638 | */ |
639 | 639 | public function addArray( $names ) { |
640 | 640 | $this->names = array_merge( $this->names, array_values( $names ) ); |
— | — | @@ -721,7 +721,7 @@ |
722 | 722 | $newRegex[0] = "/^(?:{$base[0]})/iuS"; |
723 | 723 | } |
724 | 724 | if ( $base[1] !== '' ) { |
725 | | - $newRegex[1] = "/^(?:{$base[1]})/S"; |
| 725 | + $newRegex[1] = "/^(?:{$base[1]})/S"; |
726 | 726 | } |
727 | 727 | return $newRegex; |
728 | 728 | } |
Index: trunk/phase3/includes/Fallback.php |
— | — | @@ -22,7 +22,13 @@ |
23 | 23 | * Fallback functions for PHP installed without mbstring support |
24 | 24 | */ |
25 | 25 | class Fallback { |
26 | | - |
| 26 | + |
| 27 | + /** |
| 28 | + * @param $from |
| 29 | + * @param $to |
| 30 | + * @param $string |
| 31 | + * @return string |
| 32 | + */ |
27 | 33 | public static function iconv( $from, $to, $string ) { |
28 | 34 | if ( substr( $to, -8 ) == '//IGNORE' ) { |
29 | 35 | $to = substr( $to, 0, strlen( $to ) - 8 ); |
— | — | @@ -48,7 +54,7 @@ |
49 | 55 | * Larger offsets are still fairly efficient for Latin text, but |
50 | 56 | * can be up to 100x slower than native if the text is heavily |
51 | 57 | * multibyte and we have to slog through a few hundred kb. |
52 | | - * |
| 58 | + * |
53 | 59 | * @param $str |
54 | 60 | * @param $start |
55 | 61 | * @param $count string |
— | — | @@ -60,22 +66,27 @@ |
61 | 67 | $split = self::mb_substr_split_unicode( $str, intval( $start ) ); |
62 | 68 | $str = substr( $str, $split ); |
63 | 69 | } |
64 | | - |
| 70 | + |
65 | 71 | if( $count !== 'end' ) { |
66 | 72 | $split = self::mb_substr_split_unicode( $str, intval( $count ) ); |
67 | 73 | $str = substr( $str, 0, $split ); |
68 | 74 | } |
69 | | - |
| 75 | + |
70 | 76 | return $str; |
71 | 77 | } |
72 | | - |
| 78 | + |
| 79 | + /** |
| 80 | + * @param $str |
| 81 | + * @param $splitPos |
| 82 | + * @return int |
| 83 | + */ |
73 | 84 | public static function mb_substr_split_unicode( $str, $splitPos ) { |
74 | 85 | if( $splitPos == 0 ) { |
75 | 86 | return 0; |
76 | 87 | } |
77 | | - |
| 88 | + |
78 | 89 | $byteLen = strlen( $str ); |
79 | | - |
| 90 | + |
80 | 91 | if( $splitPos > 0 ) { |
81 | 92 | if( $splitPos > 256 ) { |
82 | 93 | // Optimize large string offsets by skipping ahead N bytes. |
— | — | @@ -90,7 +101,7 @@ |
91 | 102 | $charPos = 0; |
92 | 103 | $bytePos = 0; |
93 | 104 | } |
94 | | - |
| 105 | + |
95 | 106 | while( $charPos++ < $splitPos ) { |
96 | 107 | ++$bytePos; |
97 | 108 | // Move past any tail bytes |
— | — | @@ -110,10 +121,10 @@ |
111 | 122 | } |
112 | 123 | } |
113 | 124 | } |
114 | | - |
| 125 | + |
115 | 126 | return $bytePos; |
116 | 127 | } |
117 | | - |
| 128 | + |
118 | 129 | /** |
119 | 130 | * Fallback implementation of mb_strlen, hardcoded to UTF-8. |
120 | 131 | * @param string $str |
— | — | @@ -123,20 +134,20 @@ |
124 | 135 | public static function mb_strlen( $str, $enc = '' ) { |
125 | 136 | $counts = count_chars( $str ); |
126 | 137 | $total = 0; |
127 | | - |
| 138 | + |
128 | 139 | // Count ASCII bytes |
129 | 140 | for( $i = 0; $i < 0x80; $i++ ) { |
130 | 141 | $total += $counts[$i]; |
131 | 142 | } |
132 | | - |
| 143 | + |
133 | 144 | // Count multibyte sequence heads |
134 | 145 | for( $i = 0xc0; $i < 0xff; $i++ ) { |
135 | 146 | $total += $counts[$i]; |
136 | 147 | } |
137 | 148 | return $total; |
138 | 149 | } |
139 | | - |
140 | | - |
| 150 | + |
| 151 | + |
141 | 152 | /** |
142 | 153 | * Fallback implementation of mb_strpos, hardcoded to UTF-8. |
143 | 154 | * @param $haystack String |
— | — | @@ -147,17 +158,17 @@ |
148 | 159 | */ |
149 | 160 | public static function mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) { |
150 | 161 | $needle = preg_quote( $needle, '/' ); |
151 | | - |
| 162 | + |
152 | 163 | $ar = array(); |
153 | 164 | preg_match( '/' . $needle . '/u', $haystack, $ar, PREG_OFFSET_CAPTURE, $offset ); |
154 | | - |
| 165 | + |
155 | 166 | if( isset( $ar[0][1] ) ) { |
156 | 167 | return $ar[0][1]; |
157 | 168 | } else { |
158 | 169 | return false; |
159 | 170 | } |
160 | | - } |
161 | | - |
| 171 | + } |
| 172 | + |
162 | 173 | /** |
163 | 174 | * Fallback implementation of mb_strrpos, hardcoded to UTF-8. |
164 | 175 | * @param $haystack String |
— | — | @@ -168,10 +179,10 @@ |
169 | 180 | */ |
170 | 181 | public static function mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' ) { |
171 | 182 | $needle = preg_quote( $needle, '/' ); |
172 | | - |
| 183 | + |
173 | 184 | $ar = array(); |
174 | 185 | preg_match_all( '/' . $needle . '/u', $haystack, $ar, PREG_OFFSET_CAPTURE, $offset ); |
175 | | - |
| 186 | + |
176 | 187 | if( isset( $ar[0] ) && count( $ar[0] ) > 0 && |
177 | 188 | isset( $ar[0][count( $ar[0] ) - 1][1] ) ) { |
178 | 189 | return $ar[0][count( $ar[0] ) - 1][1]; |
— | — | @@ -196,5 +207,5 @@ |
197 | 208 | } |
198 | 209 | return false; |
199 | 210 | } |
200 | | - |
| 211 | + |
201 | 212 | } |
Index: trunk/phase3/includes/ForkController.php |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | /** |
127 | 127 | * Fork a number of worker processes. |
128 | 128 | * |
129 | | - * return string |
| 129 | + * @return string |
130 | 130 | */ |
131 | 131 | protected function forkWorkers( $numProcs ) { |
132 | 132 | $this->prepareEnvironment(); |
Index: trunk/phase3/includes/LogPage.php |
— | — | @@ -123,6 +123,8 @@ |
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Get the RC comment from the last addEntry() call |
| 127 | + * |
| 128 | + * @return string |
127 | 129 | */ |
128 | 130 | public function getRcComment() { |
129 | 131 | $rcComment = $this->actionText; |
— | — | @@ -434,6 +436,8 @@ |
435 | 437 | * @param $comment String: description associated |
436 | 438 | * @param $params Array: parameters passed later to wfMsg.* functions |
437 | 439 | * @param $doer User object: the user doing the action |
| 440 | + * |
| 441 | + * @return bool|int|null |
438 | 442 | */ |
439 | 443 | public function addEntry( $action, $target, $comment, $params = array(), $doer = null ) { |
440 | 444 | global $wgContLang; |
Index: trunk/phase3/includes/IP.php |
— | — | @@ -186,14 +186,14 @@ |
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
190 | | - * Given a host/port string, like one might find in the host part of a URL |
191 | | - * per RFC 2732, split the hostname part and the port part and return an |
192 | | - * array with an element for each. If there is no port part, the array will |
193 | | - * have false in place of the port. If the string was invalid in some way, |
| 190 | + * Given a host/port string, like one might find in the host part of a URL |
| 191 | + * per RFC 2732, split the hostname part and the port part and return an |
| 192 | + * array with an element for each. If there is no port part, the array will |
| 193 | + * have false in place of the port. If the string was invalid in some way, |
194 | 194 | * false is returned. |
195 | 195 | * |
196 | | - * This was easy with IPv4 and was generally done in an ad-hoc way, but |
197 | | - * with IPv6 it's somewhat more complicated due to the need to parse the |
| 196 | + * This was easy with IPv4 and was generally done in an ad-hoc way, but |
| 197 | + * with IPv6 it's somewhat more complicated due to the need to parse the |
198 | 198 | * square brackets and colons. |
199 | 199 | * |
200 | 200 | * A bare IPv6 address is accepted despite the lack of square brackets. |
— | — | @@ -241,8 +241,13 @@ |
242 | 242 | /** |
243 | 243 | * Given a host name and a port, combine them into host/port string like |
244 | 244 | * you might find in a URL. If the host contains a colon, wrap it in square |
245 | | - * brackets like in RFC 2732. If the port matches the default port, omit |
| 245 | + * brackets like in RFC 2732. If the port matches the default port, omit |
246 | 246 | * the port specification |
| 247 | + * |
| 248 | + * @param $host string |
| 249 | + * @param $port int |
| 250 | + * @param $defaultPort bool|int |
| 251 | + * @return string |
247 | 252 | */ |
248 | 253 | public static function combineHostAndPort( $host, $port, $defaultPort = false ) { |
249 | 254 | if ( strpos( $host, ':' ) !== false ) { |
— | — | @@ -449,6 +454,10 @@ |
450 | 455 | return $n; |
451 | 456 | } |
452 | 457 | |
| 458 | + /** |
| 459 | + * @param $ip |
| 460 | + * @return String |
| 461 | + */ |
453 | 462 | private static function toUnsigned6( $ip ) { |
454 | 463 | return wfBaseConvert( self::IPv6ToRawHex( $ip ), 16, 10 ); |
455 | 464 | } |
— | — | @@ -548,6 +557,8 @@ |
549 | 558 | * Convert a network specification in IPv6 CIDR notation to an |
550 | 559 | * integer network and a number of bits |
551 | 560 | * |
| 561 | + * @param $range |
| 562 | + * |
552 | 563 | * @return array(string, int) |
553 | 564 | */ |
554 | 565 | private static function parseCIDR6( $range ) { |
— | — | @@ -585,6 +596,9 @@ |
586 | 597 | * 2001:0db8:85a3::7344/96 CIDR |
587 | 598 | * 2001:0db8:85a3::7344 - 2001:0db8:85a3::7344 Explicit range |
588 | 599 | * 2001:0db8:85a3::7344/96 Single IP |
| 600 | + * |
| 601 | + * @param $range |
| 602 | + * |
589 | 603 | * @return array(string, string) |
590 | 604 | */ |
591 | 605 | private static function parseRange6( $range ) { |
Index: trunk/phase3/includes/Cookie.php |
— | — | @@ -139,6 +139,10 @@ |
140 | 140 | return $ret; |
141 | 141 | } |
142 | 142 | |
| 143 | + /** |
| 144 | + * @param $domain |
| 145 | + * @return bool |
| 146 | + */ |
143 | 147 | protected function canServeDomain( $domain ) { |
144 | 148 | if ( $domain == $this->domain |
145 | 149 | || ( strlen( $domain ) > strlen( $this->domain ) |
— | — | @@ -151,20 +155,19 @@ |
152 | 156 | return false; |
153 | 157 | } |
154 | 158 | |
| 159 | + /** |
| 160 | + * @param $path |
| 161 | + * @return bool |
| 162 | + */ |
155 | 163 | protected function canServePath( $path ) { |
156 | | - if ( $this->path && substr_compare( $this->path, $path, 0, strlen( $this->path ) ) == 0 ) { |
157 | | - return true; |
158 | | - } |
159 | | - |
160 | | - return false; |
| 164 | + return ( $this->path && substr_compare( $this->path, $path, 0, strlen( $this->path ) ) == 0 ); |
161 | 165 | } |
162 | 166 | |
| 167 | + /** |
| 168 | + * @return bool |
| 169 | + */ |
163 | 170 | protected function isUnExpired() { |
164 | | - if ( $this->isSessionKey || $this->expires > time() ) { |
165 | | - return true; |
166 | | - } |
167 | | - |
168 | | - return false; |
| 171 | + return $this->isSessionKey || $this->expires > time(); |
169 | 172 | } |
170 | 173 | } |
171 | 174 | |