Index: trunk/phase3/includes/Article.php |
— | — | @@ -33,7 +33,6 @@ |
34 | 34 | protected $mPage; |
35 | 35 | |
36 | 36 | /** |
37 | | - * @protected |
38 | 37 | * @var ParserOptions: ParserOptions object for $wgUser articles |
39 | 38 | */ |
40 | 39 | public $mParserOptions; |
— | — | @@ -1091,6 +1090,10 @@ |
1092 | 1091 | } |
1093 | 1092 | |
1094 | 1093 | // the loop prepends the arrow image before the link, so the first case needs to be outside |
| 1094 | + |
| 1095 | + /** |
| 1096 | + * @var $title Title |
| 1097 | + */ |
1095 | 1098 | $title = array_shift( $target ); |
1096 | 1099 | |
1097 | 1100 | if ( $forceKnown ) { |
— | — | @@ -1521,6 +1524,8 @@ |
1522 | 1525 | |
1523 | 1526 | /** |
1524 | 1527 | * Perform a deletion and output success or failure messages |
| 1528 | + * @param $reason |
| 1529 | + * @param $suppress bool |
1525 | 1530 | */ |
1526 | 1531 | public function doDelete( $reason, $suppress = false ) { |
1527 | 1532 | global $wgOut; |
— | — | @@ -2044,21 +2049,21 @@ |
2045 | 2050 | * @param $title Title |
2046 | 2051 | */ |
2047 | 2052 | public static function onArticleCreate( $title ) { |
2048 | | - return WikiPage::onArticleCreate( $title ); |
| 2053 | + WikiPage::onArticleCreate( $title ); |
2049 | 2054 | } |
2050 | 2055 | |
2051 | 2056 | /** |
2052 | 2057 | * @param $title Title |
2053 | 2058 | */ |
2054 | 2059 | public static function onArticleDelete( $title ) { |
2055 | | - return WikiPage::onArticleDelete( $title ); |
| 2060 | + WikiPage::onArticleDelete( $title ); |
2056 | 2061 | } |
2057 | 2062 | |
2058 | 2063 | /** |
2059 | 2064 | * @param $title Title |
2060 | 2065 | */ |
2061 | 2066 | public static function onArticleEdit( $title ) { |
2062 | | - return WikiPage::onArticleEdit( $title ); |
| 2067 | + WikiPage::onArticleEdit( $title ); |
2063 | 2068 | } |
2064 | 2069 | |
2065 | 2070 | /** |
— | — | @@ -2087,10 +2092,16 @@ |
2088 | 2093 | $this->parserOptions = $parserOptions; |
2089 | 2094 | } |
2090 | 2095 | |
| 2096 | + /** |
| 2097 | + * @return bool |
| 2098 | + */ |
2091 | 2099 | function doWork() { |
2092 | 2100 | return $this->mArticle->doViewParse(); |
2093 | 2101 | } |
2094 | 2102 | |
| 2103 | + /** |
| 2104 | + * @return bool |
| 2105 | + */ |
2095 | 2106 | function getCachedWork() { |
2096 | 2107 | global $wgOut; |
2097 | 2108 | |
— | — | @@ -2108,6 +2119,9 @@ |
2109 | 2120 | return false; |
2110 | 2121 | } |
2111 | 2122 | |
| 2123 | + /** |
| 2124 | + * @return bool |
| 2125 | + */ |
2112 | 2126 | function fallback() { |
2113 | 2127 | return $this->mArticle->tryDirtyCache(); |
2114 | 2128 | } |
Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -188,6 +188,9 @@ |
189 | 189 | $wgOut->addModuleStyles( 'filepage' ); |
190 | 190 | } |
191 | 191 | |
| 192 | + /** |
| 193 | + * @return File |
| 194 | + */ |
192 | 195 | public function getDisplayedFile() { |
193 | 196 | $this->loadFile(); |
194 | 197 | return $this->displayImg; |
— | — | @@ -247,6 +250,7 @@ |
248 | 251 | * |
249 | 252 | * Omit noarticletext if sharedupload; text will be fetched from the |
250 | 253 | * shared upload server if possible. |
| 254 | + * @return string |
251 | 255 | */ |
252 | 256 | public function getContent() { |
253 | 257 | $this->loadFile(); |
— | — | @@ -398,7 +402,7 @@ |
399 | 403 | 'action' => $wgScript, |
400 | 404 | 'onchange' => 'document.pageselector.submit();', |
401 | 405 | ); |
402 | | - |
| 406 | + $options = array(); |
403 | 407 | for ( $i = 1; $i <= $count; $i++ ) { |
404 | 408 | $options[] = Xml::option( $wgLang->formatNum( $i ), $i, $i == $page ); |
405 | 409 | } |
— | — | @@ -484,9 +488,10 @@ |
485 | 489 | |
486 | 490 | /** |
487 | 491 | * Creates an thumbnail of specified size and returns an HTML link to it |
488 | | - * @param array $params Scaler parameters |
489 | | - * @param int $width |
490 | | - * @param int $height |
| 492 | + * @param $params array Scaler parameters |
| 493 | + * @param $width int |
| 494 | + * @param $height int |
| 495 | + * @return string |
491 | 496 | */ |
492 | 497 | private function makeSizeLink( $params, $width, $height ) { |
493 | 498 | $params['width'] = $width; |
— | — | @@ -615,6 +620,11 @@ |
616 | 621 | } |
617 | 622 | } |
618 | 623 | |
| 624 | + /** |
| 625 | + * @param $target |
| 626 | + * @param $limit |
| 627 | + * @return ResultWrapper |
| 628 | + */ |
619 | 629 | protected function queryImageLinks( $target, $limit ) { |
620 | 630 | $dbr = wfGetDB( DB_SLAVE ); |
621 | 631 | |
— | — | @@ -747,6 +757,9 @@ |
748 | 758 | ); |
749 | 759 | $wgOut->addHTML( "<ul class='mw-imagepage-duplicates'>\n" ); |
750 | 760 | |
| 761 | + /** |
| 762 | + * @var $file File |
| 763 | + */ |
751 | 764 | foreach ( $dupes as $file ) { |
752 | 765 | $fromSrc = ''; |
753 | 766 | if ( $file->isLocal() ) { |
— | — | @@ -841,6 +854,11 @@ |
842 | 855 | */ |
843 | 856 | protected $imagePage; |
844 | 857 | |
| 858 | + /** |
| 859 | + * @var File |
| 860 | + */ |
| 861 | + protected $current; |
| 862 | + |
845 | 863 | protected $repo, $showThumb; |
846 | 864 | protected $preventClickjacking = false; |
847 | 865 | |
— | — | @@ -856,14 +874,24 @@ |
857 | 875 | $this->showThumb = $wgShowArchiveThumbnails && $this->img->canRender(); |
858 | 876 | } |
859 | 877 | |
| 878 | + /** |
| 879 | + * @return ImagePage |
| 880 | + */ |
860 | 881 | public function getImagePage() { |
861 | 882 | return $this->imagePage; |
862 | 883 | } |
863 | 884 | |
| 885 | + /** |
| 886 | + * @return File |
| 887 | + */ |
864 | 888 | public function getFile() { |
865 | 889 | return $this->img; |
866 | 890 | } |
867 | 891 | |
| 892 | + /** |
| 893 | + * @param $navLinks string |
| 894 | + * @return string |
| 895 | + */ |
868 | 896 | public function beginImageHistoryList( $navLinks = '' ) { |
869 | 897 | global $wgOut, $wgUser; |
870 | 898 | return Xml::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'filehist' ) ) . "\n" |
— | — | @@ -881,6 +909,10 @@ |
882 | 910 | . "</tr>\n"; |
883 | 911 | } |
884 | 912 | |
| 913 | + /** |
| 914 | + * @param $navLinks string |
| 915 | + * @return string |
| 916 | + */ |
885 | 917 | public function endImageHistoryList( $navLinks = '' ) { |
886 | 918 | return "</table>\n$navLinks\n</div>\n"; |
887 | 919 | } |
— | — | @@ -1071,10 +1103,16 @@ |
1072 | 1104 | } |
1073 | 1105 | } |
1074 | 1106 | |
| 1107 | + /** |
| 1108 | + * @param $enable bool |
| 1109 | + */ |
1075 | 1110 | protected function preventClickjacking( $enable = true ) { |
1076 | 1111 | $this->preventClickjacking = $enable; |
1077 | 1112 | } |
1078 | 1113 | |
| 1114 | + /** |
| 1115 | + * @return bool |
| 1116 | + */ |
1079 | 1117 | public function getPreventClickjacking() { |
1080 | 1118 | return $this->preventClickjacking; |
1081 | 1119 | } |
— | — | @@ -1106,6 +1144,9 @@ |
1107 | 1145 | $this->mRange = array( 0, 0 ); // display range |
1108 | 1146 | } |
1109 | 1147 | |
| 1148 | + /** |
| 1149 | + * @return Title |
| 1150 | + */ |
1110 | 1151 | function getTitle() { |
1111 | 1152 | return $this->mTitle; |
1112 | 1153 | } |
— | — | @@ -1114,14 +1155,23 @@ |
1115 | 1156 | return false; |
1116 | 1157 | } |
1117 | 1158 | |
| 1159 | + /** |
| 1160 | + * @return string |
| 1161 | + */ |
1118 | 1162 | function getIndexField() { |
1119 | 1163 | return ''; |
1120 | 1164 | } |
1121 | 1165 | |
| 1166 | + /** |
| 1167 | + * @return string |
| 1168 | + */ |
1122 | 1169 | function formatRow( $row ) { |
1123 | 1170 | return ''; |
1124 | 1171 | } |
1125 | 1172 | |
| 1173 | + /** |
| 1174 | + * @return string |
| 1175 | + */ |
1126 | 1176 | function getBody() { |
1127 | 1177 | $s = ''; |
1128 | 1178 | $this->doQuery(); |
— | — | @@ -1225,10 +1275,16 @@ |
1226 | 1276 | $this->mQueryDone = true; |
1227 | 1277 | } |
1228 | 1278 | |
| 1279 | + /** |
| 1280 | + * @param $enable bool |
| 1281 | + */ |
1229 | 1282 | protected function preventClickjacking( $enable = true ) { |
1230 | 1283 | $this->preventClickjacking = $enable; |
1231 | 1284 | } |
1232 | 1285 | |
| 1286 | + /** |
| 1287 | + * @return bool |
| 1288 | + */ |
1233 | 1289 | public function getPreventClickjacking() { |
1234 | 1290 | return $this->preventClickjacking; |
1235 | 1291 | } |
Index: trunk/phase3/includes/CategoryViewer.php |
— | — | @@ -133,6 +133,9 @@ |
134 | 134 | |
135 | 135 | /** |
136 | 136 | * Add a subcategory to the internal lists, using a Category object |
| 137 | + * @param $cat Category |
| 138 | + * @param $sortkey |
| 139 | + * @param $pageLength |
137 | 140 | */ |
138 | 141 | function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) { |
139 | 142 | // Subcategory; strip the 'Category' namespace from the link text. |
— | — | @@ -185,6 +188,10 @@ |
186 | 189 | |
187 | 190 | /** |
188 | 191 | * Add a page in the image namespace |
| 192 | + * @param $title Title |
| 193 | + * @param $sortkey |
| 194 | + * @param $pageLength |
| 195 | + * @param $isRedirect bool |
189 | 196 | */ |
190 | 197 | function addImage( Title $title, $sortkey, $pageLength, $isRedirect = false ) { |
191 | 198 | global $wgContLang; |
— | — | @@ -211,6 +218,10 @@ |
212 | 219 | |
213 | 220 | /** |
214 | 221 | * Add a miscellaneous page |
| 222 | + * @param $title |
| 223 | + * @param $sortkey |
| 224 | + * @param $pageLength |
| 225 | + * @param $isRedirect bool |
215 | 226 | */ |
216 | 227 | function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) { |
217 | 228 | global $wgContLang; |
— | — | @@ -316,6 +327,9 @@ |
317 | 328 | } |
318 | 329 | } |
319 | 330 | |
| 331 | + /** |
| 332 | + * @return string |
| 333 | + */ |
320 | 334 | function getCategoryTop() { |
321 | 335 | $r = $this->getCategoryBottom(); |
322 | 336 | return $r === '' |
— | — | @@ -323,6 +337,9 @@ |
324 | 338 | : "<br style=\"clear:both;\"/>\n" . $r; |
325 | 339 | } |
326 | 340 | |
| 341 | + /** |
| 342 | + * @return string |
| 343 | + */ |
327 | 344 | function getSubcategorySection() { |
328 | 345 | # Don't show subcategories section if there are none. |
329 | 346 | $r = ''; |
— | — | @@ -343,6 +360,9 @@ |
344 | 361 | return $r; |
345 | 362 | } |
346 | 363 | |
| 364 | + /** |
| 365 | + * @return string |
| 366 | + */ |
347 | 367 | function getPagesSection() { |
348 | 368 | $ti = htmlspecialchars( $this->title->getText() ); |
349 | 369 | # Don't show articles section if there are none. |
— | — | @@ -369,6 +389,9 @@ |
370 | 390 | return $r; |
371 | 391 | } |
372 | 392 | |
| 393 | + /** |
| 394 | + * @return string |
| 395 | + */ |
373 | 396 | function getImageSection() { |
374 | 397 | $r = ''; |
375 | 398 | $rescnt = $this->showGallery ? $this->gallery->count() : count( $this->imgsNoGallery ); |
— | — | @@ -408,6 +431,9 @@ |
409 | 432 | } |
410 | 433 | } |
411 | 434 | |
| 435 | + /** |
| 436 | + * @return string |
| 437 | + */ |
412 | 438 | function getCategoryBottom() { |
413 | 439 | return ''; |
414 | 440 | } |
— | — | @@ -567,6 +593,7 @@ |
568 | 594 | * |
569 | 595 | * @param Title $title: The title (usually $this->title) |
570 | 596 | * @param String $section: Which section |
| 597 | + * @return Title |
571 | 598 | */ |
572 | 599 | private function addFragmentToTitle( $title, $section ) { |
573 | 600 | switch ( $section ) { |
Index: trunk/phase3/includes/Cdb_PHP.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * This is a port of D.J. Bernstein's CDB to PHP. It's based on the copy that |
| 4 | + * This is a port of D.J. Bernstein's CDB to PHP. It's based on the copy that |
5 | 5 | * appears in PHP 5.3. Changes are: |
6 | 6 | * * Error returns replaced with exceptions |
7 | 7 | * * Exception thrown if sizes or offsets are between 2GB and 4GB |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * The CDB hash function. |
54 | | - * |
| 54 | + * |
55 | 55 | * @param $s |
56 | 56 | * |
57 | 57 | * @return |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | // Do a 32-bit sum |
64 | 64 | // Inlined here for speed |
65 | 65 | $sum = ($h & 0x3fffffff) + ($h5 & 0x3fffffff); |
66 | | - $h = |
| 66 | + $h = |
67 | 67 | ( |
68 | 68 | ( $sum & 0x40000000 ? 1 : 0 ) |
69 | 69 | + ( $h & 0x80000000 ? 2 : 0 ) |
— | — | @@ -104,8 +104,11 @@ |
105 | 105 | var $dpos; |
106 | 106 | |
107 | 107 | /* initialized if cdb_findnext() returns 1 */ |
108 | | - var $dlen; |
| 108 | + var $dlen; |
109 | 109 | |
| 110 | + /** |
| 111 | + * @param $fileName string |
| 112 | + */ |
110 | 113 | function __construct( $fileName ) { |
111 | 114 | $this->handle = fopen( $fileName, 'rb' ); |
112 | 115 | if ( !$this->handle ) { |
— | — | @@ -257,8 +260,11 @@ |
258 | 261 | var $handle, $realFileName, $tmpFileName; |
259 | 262 | |
260 | 263 | var $hplist; |
261 | | - var $numEntries, $pos; |
| 264 | + var $numentries, $pos; |
262 | 265 | |
| 266 | + /** |
| 267 | + * @param $fileName string |
| 268 | + */ |
263 | 269 | function __construct( $fileName ) { |
264 | 270 | $this->realFileName = $fileName; |
265 | 271 | $this->tmpFileName = $fileName . '.tmp.' . mt_rand( 0, 0x7fffffff ); |
— | — | @@ -391,7 +397,7 @@ |
392 | 398 | } |
393 | 399 | |
394 | 400 | // Excessively clever and indulgent code to simultaneously fill $packedTables |
395 | | - // with the packed hashtables, and adjust the elements of $starts |
| 401 | + // with the packed hashtables, and adjust the elements of $starts |
396 | 402 | // to actually point to the starts instead of the ends. |
397 | 403 | $packedTables = array_fill( 0, $this->numentries, false ); |
398 | 404 | foreach ( $this->hplist as $item ) { |
— | — | @@ -416,7 +422,7 @@ |
417 | 423 | // is taken. |
418 | 424 | for ( $u = 0; $u < $count; ++$u ) { |
419 | 425 | $hp = $packedTables[$starts[$i] + $u]; |
420 | | - $where = CdbFunctions::unsignedMod( |
| 426 | + $where = CdbFunctions::unsignedMod( |
421 | 427 | CdbFunctions::unsignedShiftRight( $hp['h'], 8 ), $len ); |
422 | 428 | while ( $hashtable[$where]['p'] ) |
423 | 429 | if ( ++$where == $len ) |
— | — | @@ -426,7 +432,7 @@ |
427 | 433 | |
428 | 434 | // Write the hashtable |
429 | 435 | for ( $u = 0; $u < $len; ++$u ) { |
430 | | - $buf = pack( 'vvV', |
| 436 | + $buf = pack( 'vvV', |
431 | 437 | $hashtable[$u]['h'] & 0xffff, |
432 | 438 | CdbFunctions::unsignedShiftRight( $hashtable[$u]['h'], 16 ), |
433 | 439 | $hashtable[$u]['p'] ); |
Index: trunk/phase3/includes/LinksUpdate.php |
— | — | @@ -297,14 +297,17 @@ |
298 | 298 | ); |
299 | 299 | } |
300 | 300 | |
| 301 | + /** |
| 302 | + * @param $cats |
| 303 | + */ |
301 | 304 | function invalidateCategories( $cats ) { |
302 | 305 | $this->invalidatePages( NS_CATEGORY, array_keys( $cats ) ); |
303 | 306 | } |
304 | 307 | |
305 | 308 | /** |
306 | 309 | * Update all the appropriate counts in the category table. |
307 | | - * @param $added associative array of category name => sort key |
308 | | - * @param $deleted associative array of category name => sort key |
| 310 | + * @param $added array associative array of category name => sort key |
| 311 | + * @param $deleted array associative array of category name => sort key |
309 | 312 | */ |
310 | 313 | function updateCategoryCounts( $added, $deleted ) { |
311 | 314 | $a = new Article($this->mTitle); |
— | — | @@ -313,10 +316,18 @@ |
314 | 317 | ); |
315 | 318 | } |
316 | 319 | |
| 320 | + /** |
| 321 | + * @param $images |
| 322 | + */ |
317 | 323 | function invalidateImageDescriptions( $images ) { |
318 | 324 | $this->invalidatePages( NS_FILE, array_keys( $images ) ); |
319 | 325 | } |
320 | 326 | |
| 327 | + /** |
| 328 | + * @param $table |
| 329 | + * @param $insertions |
| 330 | + * @param $fromField |
| 331 | + */ |
321 | 332 | function dumbTableUpdate( $table, $insertions, $fromField ) { |
322 | 333 | $this->mDb->delete( $table, array( $fromField => $this->mId ), __METHOD__ ); |
323 | 334 | if ( count( $insertions ) ) { |
— | — | @@ -329,7 +340,10 @@ |
330 | 341 | |
331 | 342 | /** |
332 | 343 | * Update a table by doing a delete query then an insert query |
333 | | - * |
| 344 | + * @param $table |
| 345 | + * @param $prefix |
| 346 | + * @param $deletions |
| 347 | + * @param $insertions |
334 | 348 | */ |
335 | 349 | function incrTableUpdate( $table, $prefix, $deletions, $insertions ) { |
336 | 350 | if ( $table == 'page_props' ) { |
— | — | @@ -372,11 +386,11 @@ |
373 | 387 | } |
374 | 388 | } |
375 | 389 | |
376 | | - |
377 | 390 | /** |
378 | 391 | * Get an array of pagelinks insertions for passing to the DB |
379 | 392 | * Skips the titles specified by the 2-D array $existing |
380 | | - * |
| 393 | + * @param $existing array |
| 394 | + * @return array |
381 | 395 | */ |
382 | 396 | function getLinkInsertions( $existing = array() ) { |
383 | 397 | $arr = array(); |
— | — | @@ -397,7 +411,8 @@ |
398 | 412 | |
399 | 413 | /** |
400 | 414 | * Get an array of template insertions. Like getLinkInsertions() |
401 | | - * |
| 415 | + * @param $existing array |
| 416 | + * @return array |
402 | 417 | */ |
403 | 418 | function getTemplateInsertions( $existing = array() ) { |
404 | 419 | $arr = array(); |
— | — | @@ -417,6 +432,8 @@ |
418 | 433 | /** |
419 | 434 | * Get an array of image insertions |
420 | 435 | * Skips the names specified in $existing |
| 436 | + * @param $existing array |
| 437 | + * @return array |
421 | 438 | */ |
422 | 439 | function getImageInsertions( $existing = array() ) { |
423 | 440 | $arr = array(); |
— | — | @@ -432,6 +449,8 @@ |
433 | 450 | |
434 | 451 | /** |
435 | 452 | * Get an array of externallinks insertions. Skips the names specified in $existing |
| 453 | + * @param $existing array |
| 454 | + * @return array |
436 | 455 | */ |
437 | 456 | function getExternalInsertions( $existing = array() ) { |
438 | 457 | $arr = array(); |
— | — | @@ -449,8 +468,10 @@ |
450 | 469 | /** |
451 | 470 | * Get an array of category insertions |
452 | 471 | * |
453 | | - * @param $existing Array mapping existing category names to sort keys. If both |
| 472 | + * @param $existing array mapping existing category names to sort keys. If both |
454 | 473 | * match a link in $this, the link will be omitted from the output |
| 474 | + * |
| 475 | + * @return array |
455 | 476 | */ |
456 | 477 | function getCategoryInsertions( $existing = array() ) { |
457 | 478 | global $wgContLang, $wgCategoryCollation; |
— | — | @@ -493,6 +514,7 @@ |
494 | 515 | * |
495 | 516 | * @param $existing Array mapping existing language codes to titles |
496 | 517 | * |
| 518 | + * @return array |
497 | 519 | */ |
498 | 520 | function getInterlangInsertions( $existing = array() ) { |
499 | 521 | $diffs = array_diff_assoc( $this->mInterlangs, $existing ); |
— | — | @@ -509,6 +531,8 @@ |
510 | 532 | |
511 | 533 | /** |
512 | 534 | * Get an array of page property insertions |
| 535 | + * @param $existing array |
| 536 | + * @return array |
513 | 537 | */ |
514 | 538 | function getPropertyInsertions( $existing = array() ) { |
515 | 539 | $diffs = array_diff_assoc( $this->mProperties, $existing ); |
— | — | @@ -526,7 +550,8 @@ |
527 | 551 | /** |
528 | 552 | * Get an array of interwiki insertions for passing to the DB |
529 | 553 | * Skips the titles specified by the 2-D array $existing |
530 | | - * |
| 554 | + * @param $existing array |
| 555 | + * @return array |
531 | 556 | */ |
532 | 557 | function getInterwikiInsertions( $existing = array() ) { |
533 | 558 | $arr = array(); |
— | — | @@ -546,7 +571,8 @@ |
547 | 572 | /** |
548 | 573 | * Given an array of existing links, returns those links which are not in $this |
549 | 574 | * and thus should be deleted. |
550 | | - * |
| 575 | + * @param $existing array |
| 576 | + * @return array |
551 | 577 | */ |
552 | 578 | function getLinkDeletions( $existing ) { |
553 | 579 | $del = array(); |
— | — | @@ -563,7 +589,8 @@ |
564 | 590 | /** |
565 | 591 | * Given an array of existing templates, returns those templates which are not in $this |
566 | 592 | * and thus should be deleted. |
567 | | - * |
| 593 | + * @param $existing array |
| 594 | + * @return array |
568 | 595 | */ |
569 | 596 | function getTemplateDeletions( $existing ) { |
570 | 597 | $del = array(); |
— | — | @@ -580,7 +607,8 @@ |
581 | 608 | /** |
582 | 609 | * Given an array of existing images, returns those images which are not in $this |
583 | 610 | * and thus should be deleted. |
584 | | - * |
| 611 | + * @param $existing array |
| 612 | + * @return array |
585 | 613 | */ |
586 | 614 | function getImageDeletions( $existing ) { |
587 | 615 | return array_diff_key( $existing, $this->mImages ); |
— | — | @@ -589,7 +617,8 @@ |
590 | 618 | /** |
591 | 619 | * Given an array of existing external links, returns those links which are not |
592 | 620 | * in $this and thus should be deleted. |
593 | | - * |
| 621 | + * @param $existing array |
| 622 | + * @return array |
594 | 623 | */ |
595 | 624 | function getExternalDeletions( $existing ) { |
596 | 625 | return array_diff_key( $existing, $this->mExternals ); |
— | — | @@ -598,7 +627,8 @@ |
599 | 628 | /** |
600 | 629 | * Given an array of existing categories, returns those categories which are not in $this |
601 | 630 | * and thus should be deleted. |
602 | | - * |
| 631 | + * @param $existing array |
| 632 | + * @return array |
603 | 633 | */ |
604 | 634 | function getCategoryDeletions( $existing ) { |
605 | 635 | return array_diff_assoc( $existing, $this->mCategories ); |
— | — | @@ -607,7 +637,8 @@ |
608 | 638 | /** |
609 | 639 | * Given an array of existing interlanguage links, returns those links which are not |
610 | 640 | * in $this and thus should be deleted. |
611 | | - * |
| 641 | + * @param $existing array |
| 642 | + * @return array |
612 | 643 | */ |
613 | 644 | function getInterlangDeletions( $existing ) { |
614 | 645 | return array_diff_assoc( $existing, $this->mInterlangs ); |
— | — | @@ -615,7 +646,8 @@ |
616 | 647 | |
617 | 648 | /** |
618 | 649 | * Get array of properties which should be deleted. |
619 | | - * |
| 650 | + * @param $existing array |
| 651 | + * @return array |
620 | 652 | */ |
621 | 653 | function getPropertyDeletions( $existing ) { |
622 | 654 | return array_diff_assoc( $existing, $this->mProperties ); |
— | — | @@ -624,7 +656,8 @@ |
625 | 657 | /** |
626 | 658 | * Given an array of existing interwiki links, returns those links which are not in $this |
627 | 659 | * and thus should be deleted. |
628 | | - * |
| 660 | + * @param $existing array |
| 661 | + * @return array |
629 | 662 | */ |
630 | 663 | function getInterwikiDeletions( $existing ) { |
631 | 664 | $del = array(); |
— | — | @@ -641,6 +674,7 @@ |
642 | 675 | /** |
643 | 676 | * Get an array of existing links, as a 2-D array |
644 | 677 | * |
| 678 | + * @return array |
645 | 679 | */ |
646 | 680 | function getExistingLinks() { |
647 | 681 | $res = $this->mDb->select( 'pagelinks', array( 'pl_namespace', 'pl_title' ), |
— | — | @@ -658,6 +692,7 @@ |
659 | 693 | /** |
660 | 694 | * Get an array of existing templates, as a 2-D array |
661 | 695 | * |
| 696 | + * @return array |
662 | 697 | */ |
663 | 698 | function getExistingTemplates() { |
664 | 699 | $res = $this->mDb->select( 'templatelinks', array( 'tl_namespace', 'tl_title' ), |
— | — | @@ -675,6 +710,7 @@ |
676 | 711 | /** |
677 | 712 | * Get an array of existing images, image names in the keys |
678 | 713 | * |
| 714 | + * @return array |
679 | 715 | */ |
680 | 716 | function getExistingImages() { |
681 | 717 | $res = $this->mDb->select( 'imagelinks', array( 'il_to' ), |
— | — | @@ -689,6 +725,7 @@ |
690 | 726 | /** |
691 | 727 | * Get an array of existing external links, URLs in the keys |
692 | 728 | * |
| 729 | + * @return array |
693 | 730 | */ |
694 | 731 | function getExistingExternals() { |
695 | 732 | $res = $this->mDb->select( 'externallinks', array( 'el_to' ), |
— | — | @@ -703,6 +740,7 @@ |
704 | 741 | /** |
705 | 742 | * Get an array of existing categories, with the name in the key and sort key in the value. |
706 | 743 | * |
| 744 | + * @return array |
707 | 745 | */ |
708 | 746 | function getExistingCategories() { |
709 | 747 | $res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey_prefix' ), |
— | — | @@ -718,6 +756,7 @@ |
719 | 757 | * Get an array of existing interlanguage links, with the language code in the key and the |
720 | 758 | * title in the value. |
721 | 759 | * |
| 760 | + * @return array |
722 | 761 | */ |
723 | 762 | function getExistingInterlangs() { |
724 | 763 | $res = $this->mDb->select( 'langlinks', array( 'll_lang', 'll_title' ), |
— | — | @@ -749,6 +788,7 @@ |
750 | 789 | /** |
751 | 790 | * Get an array of existing categories, with the name in the key and sort key in the value. |
752 | 791 | * |
| 792 | + * @return array |
753 | 793 | */ |
754 | 794 | function getExistingProperties() { |
755 | 795 | $res = $this->mDb->select( 'page_props', array( 'pp_propname', 'pp_value' ), |
— | — | @@ -760,9 +800,9 @@ |
761 | 801 | return $arr; |
762 | 802 | } |
763 | 803 | |
764 | | - |
765 | 804 | /** |
766 | 805 | * Return the title object of the page being updated |
| 806 | + * @return Title |
767 | 807 | */ |
768 | 808 | function getTitle() { |
769 | 809 | return $this->mTitle; |
— | — | @@ -770,6 +810,7 @@ |
771 | 811 | |
772 | 812 | /** |
773 | 813 | * Return the list of images used as generated by the parser |
| 814 | + * @return array |
774 | 815 | */ |
775 | 816 | public function getImages() { |
776 | 817 | return $this->mImages; |
— | — | @@ -777,6 +818,7 @@ |
778 | 819 | |
779 | 820 | /** |
780 | 821 | * Invalidate any necessary link lists related to page property changes |
| 822 | + * @param $changed |
781 | 823 | */ |
782 | 824 | function invalidateProperties( $changed ) { |
783 | 825 | global $wgPagePropLinkInvalidations; |
Index: trunk/phase3/includes/cache/CacheDependency.php |
— | — | @@ -28,6 +28,8 @@ |
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Returns true if any of the dependencies have expired |
| 32 | + * |
| 33 | + * @return bool |
32 | 34 | */ |
33 | 35 | function isExpired() { |
34 | 36 | foreach ( $this->deps as $dep ) { |
— | — | @@ -51,6 +53,7 @@ |
52 | 54 | |
53 | 55 | /** |
54 | 56 | * Get the user-defined value |
| 57 | + * @return bool|\Mixed |
55 | 58 | */ |
56 | 59 | function getValue() { |
57 | 60 | return $this->value; |
— | — | @@ -143,6 +146,9 @@ |
144 | 147 | $this->timestamp = $timestamp; |
145 | 148 | } |
146 | 149 | |
| 150 | + /** |
| 151 | + * @return array |
| 152 | + */ |
147 | 153 | function __sleep() { |
148 | 154 | $this->loadDependencyValues(); |
149 | 155 | return array( 'filename', 'timestamp' ); |
— | — | @@ -265,11 +271,15 @@ |
266 | 272 | |
267 | 273 | /** |
268 | 274 | * Construct a dependency on a list of titles |
| 275 | + * @param $linkBatch LinkBatch |
269 | 276 | */ |
270 | 277 | function __construct( LinkBatch $linkBatch ) { |
271 | 278 | $this->linkBatch = $linkBatch; |
272 | 279 | } |
273 | 280 | |
| 281 | + /** |
| 282 | + * @return array |
| 283 | + */ |
274 | 284 | function calculateTimestamps() { |
275 | 285 | # Initialise values to false |
276 | 286 | $timestamps = array(); |
— | — | @@ -314,6 +324,9 @@ |
315 | 325 | return array( 'timestamps' ); |
316 | 326 | } |
317 | 327 | |
| 328 | + /** |
| 329 | + * @return LinkBatch |
| 330 | + */ |
318 | 331 | function getLinkBatch() { |
319 | 332 | if ( !isset( $this->linkBatch ) ) { |
320 | 333 | $this->linkBatch = new LinkBatch; |
Index: trunk/phase3/includes/FileDeleteForm.php |
— | — | @@ -8,12 +8,23 @@ |
9 | 9 | */ |
10 | 10 | class FileDeleteForm { |
11 | 11 | |
| 12 | + /** |
| 13 | + * @var Title |
| 14 | + */ |
12 | 15 | private $title = null; |
| 16 | + |
| 17 | + /** |
| 18 | + * @var File |
| 19 | + */ |
13 | 20 | private $file = null; |
14 | 21 | |
| 22 | + /** |
| 23 | + * @var File |
| 24 | + */ |
15 | 25 | private $oldfile = null; |
16 | 26 | private $oldimage = ''; |
17 | 27 | |
| 28 | + private $DeleteReason, $DeleteReasonList; |
18 | 29 | /** |
19 | 30 | * Constructor |
20 | 31 | * |
— | — | @@ -295,6 +306,9 @@ |
296 | 307 | * value was provided, does it correspond to an |
297 | 308 | * existing, local, old version of this file? |
298 | 309 | * |
| 310 | + * @param $file File |
| 311 | + * @param $oldfile File |
| 312 | + * @param $oldimage File |
299 | 313 | * @return bool |
300 | 314 | */ |
301 | 315 | public static function haveDeletableFile(&$file, &$oldfile, $oldimage) { |
Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -53,6 +53,9 @@ |
54 | 54 | * Simple wrapper for Http::request( 'GET' ) |
55 | 55 | * @see Http::request() |
56 | 56 | * |
| 57 | + * @param $url |
| 58 | + * @param $timeout string |
| 59 | + * @param $options array |
57 | 60 | * @return string |
58 | 61 | */ |
59 | 62 | public static function get( $url, $timeout = 'default', $options = array() ) { |
— | — | @@ -64,6 +67,8 @@ |
65 | 68 | * Simple wrapper for Http::request( 'POST' ) |
66 | 69 | * @see Http::request() |
67 | 70 | * |
| 71 | + * @param $url |
| 72 | + * @param $options array |
68 | 73 | * @return string |
69 | 74 | */ |
70 | 75 | public static function post( $url, $options = array() ) { |
— | — | @@ -221,6 +226,7 @@ |
222 | 227 | * Generate a new request object |
223 | 228 | * @param $url String: url to use |
224 | 229 | * @param $options Array: (optional) extra params to pass (see Http::request()) |
| 230 | + * @return \CurlHttpRequest|\PhpHttpRequest |
225 | 231 | * @see MWHttpRequest::__construct |
226 | 232 | */ |
227 | 233 | public static function factory( $url, $options = null ) { |
— | — | @@ -295,6 +301,7 @@ |
296 | 302 | |
297 | 303 | /** |
298 | 304 | * Set the user agent |
| 305 | + * @param $UA string |
299 | 306 | */ |
300 | 307 | public function setUserAgent( $UA ) { |
301 | 308 | $this->setHeader( 'User-Agent', $UA ); |
— | — | @@ -302,6 +309,8 @@ |
303 | 310 | |
304 | 311 | /** |
305 | 312 | * Set an arbitrary header |
| 313 | + * @param $name |
| 314 | + * @param $value |
306 | 315 | */ |
307 | 316 | public function setHeader( $name, $value ) { |
308 | 317 | // I feel like I should normalize the case here... |
— | — | @@ -310,6 +319,7 @@ |
311 | 320 | |
312 | 321 | /** |
313 | 322 | * Get an array of the headers |
| 323 | + * @return array |
314 | 324 | */ |
315 | 325 | public function getHeaderList() { |
316 | 326 | $list = array(); |
— | — | @@ -540,6 +550,9 @@ |
541 | 551 | * cookies. Used internally after a request to parse the |
542 | 552 | * Set-Cookie headers. |
543 | 553 | * @see Cookie::set |
| 554 | + * @param $name |
| 555 | + * @param $value null |
| 556 | + * @param $attr null |
544 | 557 | */ |
545 | 558 | public function setCookie( $name, $value = null, $attr = null ) { |
546 | 559 | if ( !$this->cookieJar ) { |
— | — | @@ -614,6 +627,7 @@ |
615 | 628 | /** |
616 | 629 | * Returns true if the backend can follow redirects. Overridden by the |
617 | 630 | * child classes. |
| 631 | + * @return bool |
618 | 632 | */ |
619 | 633 | public function canFollowRedirects() { |
620 | 634 | return true; |
— | — | @@ -634,6 +648,11 @@ |
635 | 649 | protected $curlOptions = array(); |
636 | 650 | protected $headerText = ""; |
637 | 651 | |
| 652 | + /** |
| 653 | + * @param $fh |
| 654 | + * @param $content |
| 655 | + * @return int |
| 656 | + */ |
638 | 657 | protected function readHeader( $fh, $content ) { |
639 | 658 | $this->headerText .= $content; |
640 | 659 | return strlen( $content ); |
— | — | @@ -725,6 +744,9 @@ |
726 | 745 | return $this->status; |
727 | 746 | } |
728 | 747 | |
| 748 | + /** |
| 749 | + * @return bool |
| 750 | + */ |
729 | 751 | public function canFollowRedirects() { |
730 | 752 | if ( strval( ini_get( 'open_basedir' ) ) !== '' || wfIniGetBool( 'safe_mode' ) ) { |
731 | 753 | wfDebug( "Cannot follow redirects in safe mode\n" ); |
— | — | @@ -741,6 +763,11 @@ |
742 | 764 | } |
743 | 765 | |
744 | 766 | class PhpHttpRequest extends MWHttpRequest { |
| 767 | + |
| 768 | + /** |
| 769 | + * @param $url string |
| 770 | + * @return string |
| 771 | + */ |
745 | 772 | protected function urlToTcp( $url ) { |
746 | 773 | $parsedUrl = parse_url( $url ); |
747 | 774 | |
Index: trunk/phase3/includes/Import.php |
— | — | @@ -40,6 +40,7 @@ |
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Creates an ImportXMLReader drawing from the source provided |
| 44 | + * @param $source |
44 | 45 | */ |
45 | 46 | function __construct( $source ) { |
46 | 47 | $this->reader = new XMLReader(); |
— | — | @@ -48,8 +49,7 @@ |
49 | 50 | $id = UploadSourceAdapter::registerSource( $source ); |
50 | 51 | if (defined( 'LIBXML_PARSEHUGE' ) ) { |
51 | 52 | $this->reader->open( "uploadsource://$id", null, LIBXML_PARSEHUGE ); |
52 | | - } |
53 | | - else { |
| 53 | + } else { |
54 | 54 | $this->reader->open( "uploadsource://$id" ); |
55 | 55 | } |
56 | 56 | |
— | — | @@ -87,6 +87,7 @@ |
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Set debug mode... |
| 91 | + * @param $debug bool |
91 | 92 | */ |
92 | 93 | function setDebug( $debug ) { |
93 | 94 | $this->mDebug = $debug; |
— | — | @@ -94,6 +95,7 @@ |
95 | 96 | |
96 | 97 | /** |
97 | 98 | * Set 'no updates' mode. In this mode, the link tables will not be updated by the importer |
| 99 | + * @param $noupdates bool |
98 | 100 | */ |
99 | 101 | function setNoUpdates( $noupdates ) { |
100 | 102 | $this->mNoUpdates = $noupdates; |
— | — | @@ -171,6 +173,8 @@ |
172 | 174 | |
173 | 175 | /** |
174 | 176 | * Set a target namespace to override the defaults |
| 177 | + * @param $namespace |
| 178 | + * @return bool |
175 | 179 | */ |
176 | 180 | public function setTargetNamespace( $namespace ) { |
177 | 181 | if( is_null( $namespace ) ) { |
— | — | @@ -185,7 +189,7 @@ |
186 | 190 | } |
187 | 191 | |
188 | 192 | /** |
189 | | - * @parma $dir |
| 193 | + * @param $dir |
190 | 194 | */ |
191 | 195 | public function setImageBasePath( $dir ) { |
192 | 196 | $this->mImageBasePath = $dir; |
— | — | @@ -201,6 +205,7 @@ |
202 | 206 | /** |
203 | 207 | * Default per-revision callback, performs the import. |
204 | 208 | * @param $revision WikiRevision |
| 209 | + * @return bool |
205 | 210 | */ |
206 | 211 | public function importRevision( $revision ) { |
207 | 212 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -210,6 +215,7 @@ |
211 | 216 | /** |
212 | 217 | * Default per-revision callback, performs the import. |
213 | 218 | * @param $rev WikiRevision |
| 219 | + * @return bool |
214 | 220 | */ |
215 | 221 | public function importLogItem( $rev ) { |
216 | 222 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -218,6 +224,8 @@ |
219 | 225 | |
220 | 226 | /** |
221 | 227 | * Dummy for now... |
| 228 | + * @param $revision |
| 229 | + * @return bool |
222 | 230 | */ |
223 | 231 | public function importUpload( $revision ) { |
224 | 232 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -226,6 +234,12 @@ |
227 | 235 | |
228 | 236 | /** |
229 | 237 | * Mostly for hook use |
| 238 | + * @param $title |
| 239 | + * @param $origTitle |
| 240 | + * @param $revCount |
| 241 | + * @param $sRevCount |
| 242 | + * @param $pageInfo |
| 243 | + * @return |
230 | 244 | */ |
231 | 245 | public function finishImportPage( $title, $origTitle, $revCount, $sRevCount, $pageInfo ) { |
232 | 246 | $args = func_get_args(); |
— | — | @@ -930,6 +944,10 @@ |
931 | 945 | */ |
932 | 946 | class WikiRevision { |
933 | 947 | var $importer = null; |
| 948 | + |
| 949 | + /** |
| 950 | + * @var Title |
| 951 | + */ |
934 | 952 | var $title = null; |
935 | 953 | var $id = 0; |
936 | 954 | var $timestamp = "20010115000000"; |
— | — | @@ -945,6 +963,7 @@ |
946 | 964 | var $sha1base36 = false; |
947 | 965 | var $isTemp = false; |
948 | 966 | var $archiveName = ''; |
| 967 | + var $fileIsTemp; |
949 | 968 | private $mNoUpdates = false; |
950 | 969 | |
951 | 970 | /** |
— | — | @@ -1062,6 +1081,9 @@ |
1063 | 1082 | $this->type = $type; |
1064 | 1083 | } |
1065 | 1084 | |
| 1085 | + /** |
| 1086 | + * @param $action |
| 1087 | + */ |
1066 | 1088 | function setAction( $action ) { |
1067 | 1089 | $this->action = $action; |
1068 | 1090 | } |
— | — | @@ -1428,10 +1450,16 @@ |
1429 | 1451 | $this->mRead = false; |
1430 | 1452 | } |
1431 | 1453 | |
| 1454 | + /** |
| 1455 | + * @return bool |
| 1456 | + */ |
1432 | 1457 | function atEnd() { |
1433 | 1458 | return $this->mRead; |
1434 | 1459 | } |
1435 | 1460 | |
| 1461 | + /** |
| 1462 | + * @return bool|string |
| 1463 | + */ |
1436 | 1464 | function readChunk() { |
1437 | 1465 | if( $this->atEnd() ) { |
1438 | 1466 | return false; |
— | — | @@ -1457,6 +1485,9 @@ |
1458 | 1486 | return feof( $this->mHandle ); |
1459 | 1487 | } |
1460 | 1488 | |
| 1489 | + /** |
| 1490 | + * @return string |
| 1491 | + */ |
1461 | 1492 | function readChunk() { |
1462 | 1493 | return fread( $this->mHandle, 32768 ); |
1463 | 1494 | } |