Index: trunk/phase3/maintenance/importDump.php |
— | — | @@ -117,6 +117,10 @@ |
118 | 118 | $this->error( "Unknown namespace text / index specified: $namespace", true ); |
119 | 119 | } |
120 | 120 | |
| 121 | + /** |
| 122 | + * @param $obj Title|Revision |
| 123 | + * @return bool |
| 124 | + */ |
121 | 125 | private function skippedNamespace( $obj ) { |
122 | 126 | if ( $obj instanceof Title ) { |
123 | 127 | $ns = $obj->getNamespace(); |
— | — | @@ -135,6 +139,10 @@ |
136 | 140 | $this->pageCount++; |
137 | 141 | } |
138 | 142 | |
| 143 | + /** |
| 144 | + * @param $rev Revision |
| 145 | + * @return mixed |
| 146 | + */ |
139 | 147 | function handleRevision( $rev ) { |
140 | 148 | $title = $rev->getTitle(); |
141 | 149 | if ( !$title ) { |
— | — | @@ -161,7 +169,7 @@ |
162 | 170 | function handleUpload( $revision ) { |
163 | 171 | if ( $this->uploads ) { |
164 | 172 | if ( $this->skippedNamespace( $revision ) ) { |
165 | | - return ; |
| 173 | + return; |
166 | 174 | } |
167 | 175 | $this->uploadCount++; |
168 | 176 | // $this->report(); |
— | — | @@ -223,11 +231,9 @@ |
224 | 232 | function importFromFile( $filename ) { |
225 | 233 | if ( preg_match( '/\.gz$/', $filename ) ) { |
226 | 234 | $filename = 'compress.zlib://' . $filename; |
227 | | - } |
228 | | - elseif ( preg_match( '/\.bz2$/', $filename ) ) { |
| 235 | + } elseif ( preg_match( '/\.bz2$/', $filename ) ) { |
229 | 236 | $filename = 'compress.bzip2://' . $filename; |
230 | | - } |
231 | | - elseif ( preg_match( '/\.7z$/', $filename ) ) { |
| 237 | + } elseif ( preg_match( '/\.7z$/', $filename ) ) { |
232 | 238 | $filename = 'mediawiki.compress.7z://' . $filename; |
233 | 239 | } |
234 | 240 | |
Index: trunk/phase3/includes/LocalisationCache.php |
— | — | @@ -40,6 +40,8 @@ |
41 | 41 | |
42 | 42 | /** |
43 | 43 | * The persistent store object. An instance of LCStore. |
| 44 | + * |
| 45 | + * @var LCStore |
44 | 46 | */ |
45 | 47 | var $store; |
46 | 48 | |
— | — | @@ -132,6 +134,8 @@ |
133 | 135 | */ |
134 | 136 | static public $preloadedKeys = array( 'dateFormats', 'namespaceNames' ); |
135 | 137 | |
| 138 | + var $mergeableKeys = array(); |
| 139 | + |
136 | 140 | /** |
137 | 141 | * Constructor. |
138 | 142 | * For constructor parameters, see the documentation in DefaultSettings.php |
— | — | @@ -180,6 +184,8 @@ |
181 | 185 | /** |
182 | 186 | * Returns true if the given key is mergeable, that is, if it is an associative |
183 | 187 | * array which can be merged through a fallback sequence. |
| 188 | + * @param $key |
| 189 | + * @return bool |
184 | 190 | */ |
185 | 191 | public function isMergeableKey( $key ) { |
186 | 192 | if ( !isset( $this->mergeableKeys ) ) { |
— | — | @@ -199,6 +205,9 @@ |
200 | 206 | * |
201 | 207 | * Warning: this may be slow for split items (messages), since it will |
202 | 208 | * need to fetch all of the subitems from the cache individually. |
| 209 | + * @param $code |
| 210 | + * @param $key |
| 211 | + * @return string |
203 | 212 | */ |
204 | 213 | public function getItem( $code, $key ) { |
205 | 214 | if ( !isset( $this->loadedItems[$code][$key] ) ) { |
— | — | @@ -216,6 +225,10 @@ |
217 | 226 | |
218 | 227 | /** |
219 | 228 | * Get a subitem, for instance a single message for a given language. |
| 229 | + * @param $code |
| 230 | + * @param $key |
| 231 | + * @param $subkey |
| 232 | + * @return null |
220 | 233 | */ |
221 | 234 | public function getSubitem( $code, $key, $subkey ) { |
222 | 235 | if ( !isset( $this->loadedSubitems[$code][$key][$subkey] ) |
— | — | @@ -241,6 +254,9 @@ |
242 | 255 | * |
243 | 256 | * Will return null if the item is not found, or false if the item is not an |
244 | 257 | * array. |
| 258 | + * @param $code |
| 259 | + * @param $key |
| 260 | + * @return bool|null|string |
245 | 261 | */ |
246 | 262 | public function getSubitemList( $code, $key ) { |
247 | 263 | if ( in_array( $key, self::$splitKeys ) ) { |
— | — | @@ -257,6 +273,8 @@ |
258 | 274 | |
259 | 275 | /** |
260 | 276 | * Load an item into the cache. |
| 277 | + * @param $code |
| 278 | + * @param $key |
261 | 279 | */ |
262 | 280 | protected function loadItem( $code, $key ) { |
263 | 281 | if ( !isset( $this->initialisedLangs[$code] ) ) { |
— | — | @@ -290,6 +308,10 @@ |
291 | 309 | |
292 | 310 | /** |
293 | 311 | * Load a subitem into the cache |
| 312 | + * @param $code |
| 313 | + * @param $key |
| 314 | + * @param $subkey |
| 315 | + * @return |
294 | 316 | */ |
295 | 317 | protected function loadSubitem( $code, $key, $subkey ) { |
296 | 318 | if ( !in_array( $key, self::$splitKeys ) ) { |
— | — | @@ -350,6 +372,7 @@ |
351 | 373 | |
352 | 374 | /** |
353 | 375 | * Initialise a language in this object. Rebuild the cache if necessary. |
| 376 | + * @param $code |
354 | 377 | */ |
355 | 378 | protected function initLanguage( $code ) { |
356 | 379 | if ( isset( $this->initialisedLangs[$code] ) ) { |
— | — | @@ -406,6 +429,8 @@ |
407 | 430 | /** |
408 | 431 | * Create a fallback from one language to another, without creating a |
409 | 432 | * complete persistent cache. |
| 433 | + * @param $primaryCode |
| 434 | + * @param $fallbackCode |
410 | 435 | */ |
411 | 436 | public function initShallowFallback( $primaryCode, $fallbackCode ) { |
412 | 437 | $this->data[$primaryCode] =& $this->data[$fallbackCode]; |
— | — | @@ -416,6 +441,9 @@ |
417 | 442 | |
418 | 443 | /** |
419 | 444 | * Read a PHP file containing localisation data. |
| 445 | + * @param $_fileName |
| 446 | + * @param $_fileType |
| 447 | + * @return array |
420 | 448 | */ |
421 | 449 | protected function readPHPFile( $_fileName, $_fileType ) { |
422 | 450 | // Disable APC caching |
— | — | @@ -437,6 +465,9 @@ |
438 | 466 | /** |
439 | 467 | * Merge two localisation values, a primary and a fallback, overwriting the |
440 | 468 | * primary value in place. |
| 469 | + * @param $key |
| 470 | + * @param $value |
| 471 | + * @param $fallbackValue |
441 | 472 | */ |
442 | 473 | protected function mergeItem( $key, &$value, $fallbackValue ) { |
443 | 474 | if ( !is_null( $value ) ) { |
— | — | @@ -464,6 +495,10 @@ |
465 | 496 | } |
466 | 497 | } |
467 | 498 | |
| 499 | + /** |
| 500 | + * @param $value |
| 501 | + * @param $fallbackValue |
| 502 | + */ |
468 | 503 | protected function mergeMagicWords( &$value, $fallbackValue ) { |
469 | 504 | foreach ( $fallbackValue as $magicName => $fallbackInfo ) { |
470 | 505 | if ( !isset( $value[$magicName] ) ) { |
— | — | @@ -485,6 +520,11 @@ |
486 | 521 | * |
487 | 522 | * Returns true if any data from the extension array was used, false |
488 | 523 | * otherwise. |
| 524 | + * @param $codeSequence |
| 525 | + * @param $key |
| 526 | + * @param $value |
| 527 | + * @param $fallbackValue |
| 528 | + * @return bool |
489 | 529 | */ |
490 | 530 | protected function mergeExtensionItem( $codeSequence, $key, &$value, $fallbackValue ) { |
491 | 531 | $used = false; |
— | — | @@ -501,6 +541,7 @@ |
502 | 542 | /** |
503 | 543 | * Load localisation data for a given language for both core and extensions |
504 | 544 | * and save it to the persistent cache store and the process cache |
| 545 | + * @param $code |
505 | 546 | */ |
506 | 547 | public function recache( $code ) { |
507 | 548 | global $wgExtensionMessagesFiles, $wgExtensionAliasesFiles; |
— | — | @@ -688,6 +729,8 @@ |
689 | 730 | * |
690 | 731 | * The preload item will be loaded automatically, improving performance |
691 | 732 | * for the commonly-requested items it contains. |
| 733 | + * @param $data |
| 734 | + * @return array |
692 | 735 | */ |
693 | 736 | protected function buildPreload( $data ) { |
694 | 737 | $preload = array( 'messages' => array() ); |
— | — | @@ -710,6 +753,7 @@ |
711 | 754 | /** |
712 | 755 | * Unload the data for a given language from the object cache. |
713 | 756 | * Reduces memory usage. |
| 757 | + * @param $code |
714 | 758 | */ |
715 | 759 | public function unload( $code ) { |
716 | 760 | unset( $this->data[$code] ); |
— | — | @@ -781,6 +825,8 @@ |
782 | 826 | /** |
783 | 827 | * Set a key to a given value. startWrite() must be called before this |
784 | 828 | * is called, and finishWrite() must be called afterwards. |
| 829 | + * @param $key |
| 830 | + * @param $value |
785 | 831 | */ |
786 | 832 | function set( $key, $value ); |
787 | 833 | } |
— | — | @@ -792,7 +838,12 @@ |
793 | 839 | class LCStore_DB implements LCStore { |
794 | 840 | var $currentLang; |
795 | 841 | var $writesDone = false; |
796 | | - var $dbw, $batch; |
| 842 | + |
| 843 | + /** |
| 844 | + * @var DatabaseBase |
| 845 | + */ |
| 846 | + var $dbw; |
| 847 | + var $batch; |
797 | 848 | var $readOnly = false; |
798 | 849 | |
799 | 850 | public function get( $code, $key ) { |
— | — | @@ -999,6 +1050,11 @@ |
1000 | 1051 | */ |
1001 | 1052 | var $maxLoadedLangs = 10; |
1002 | 1053 | |
| 1054 | + /** |
| 1055 | + * @param $fileName |
| 1056 | + * @param $fileType |
| 1057 | + * @return array|mixed |
| 1058 | + */ |
1003 | 1059 | protected function readPHPFile( $fileName, $fileType ) { |
1004 | 1060 | $serialize = $fileType === 'core'; |
1005 | 1061 | if ( !isset( $this->fileCache[$fileName][$fileType] ) ) { |
— | — | @@ -1020,18 +1076,32 @@ |
1021 | 1077 | } |
1022 | 1078 | } |
1023 | 1079 | |
| 1080 | + /** |
| 1081 | + * @param $code |
| 1082 | + * @param $key |
| 1083 | + * @return string |
| 1084 | + */ |
1024 | 1085 | public function getItem( $code, $key ) { |
1025 | 1086 | unset( $this->mruLangs[$code] ); |
1026 | 1087 | $this->mruLangs[$code] = true; |
1027 | 1088 | return parent::getItem( $code, $key ); |
1028 | 1089 | } |
1029 | 1090 | |
| 1091 | + /** |
| 1092 | + * @param $code |
| 1093 | + * @param $key |
| 1094 | + * @param $subkey |
| 1095 | + * @return |
| 1096 | + */ |
1030 | 1097 | public function getSubitem( $code, $key, $subkey ) { |
1031 | 1098 | unset( $this->mruLangs[$code] ); |
1032 | 1099 | $this->mruLangs[$code] = true; |
1033 | 1100 | return parent::getSubitem( $code, $key, $subkey ); |
1034 | 1101 | } |
1035 | 1102 | |
| 1103 | + /** |
| 1104 | + * @param $code |
| 1105 | + */ |
1036 | 1106 | public function recache( $code ) { |
1037 | 1107 | parent::recache( $code ); |
1038 | 1108 | unset( $this->mruLangs[$code] ); |
— | — | @@ -1039,6 +1109,9 @@ |
1040 | 1110 | $this->trimCache(); |
1041 | 1111 | } |
1042 | 1112 | |
| 1113 | + /** |
| 1114 | + * @param $code |
| 1115 | + */ |
1043 | 1116 | public function unload( $code ) { |
1044 | 1117 | unset( $this->mruLangs[$code] ); |
1045 | 1118 | parent::unload( $code ); |
Index: trunk/phase3/includes/DeferredUpdates.php |
— | — | @@ -35,6 +35,8 @@ |
36 | 36 | * HTMLCacheUpdates are the most common deferred update people use. This |
37 | 37 | * is a shortcut method for that. |
38 | 38 | * @see HTMLCacheUpdate::__construct() |
| 39 | + * @param $title |
| 40 | + * @param $table |
39 | 41 | */ |
40 | 42 | public static function addHTMLCacheUpdate( $title, $table ) { |
41 | 43 | self::addUpdate( new HTMLCacheUpdate( $title, $table ) ); |
Index: trunk/phase3/includes/context/ContextSource.php |
— | — | @@ -35,9 +35,9 @@ |
36 | 36 | private $context; |
37 | 37 | |
38 | 38 | /** |
39 | | - * Get the IContextSource object |
| 39 | + * Get the RequestContext object |
40 | 40 | * |
41 | | - * @return IContextSource |
| 41 | + * @return RequestContext |
42 | 42 | */ |
43 | 43 | public function getContext() { |
44 | 44 | if ( $this->context === null ) { |
Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -726,7 +726,7 @@ |
727 | 727 | /** |
728 | 728 | * SQL clause to skip forbidden log types for this user |
729 | 729 | * |
730 | | - * @param $db Database |
| 730 | + * @param $db DatabaseBase |
731 | 731 | * @param $audience string, public/user |
732 | 732 | * @return Mixed: string or false |
733 | 733 | */ |
Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -1259,15 +1259,26 @@ |
1260 | 1260 | $this->headers[$name] = $val; |
1261 | 1261 | } |
1262 | 1262 | |
| 1263 | + /** |
| 1264 | + * @param $key |
| 1265 | + * @return mixed |
| 1266 | + */ |
1263 | 1267 | public function getSessionData( $key ) { |
1264 | 1268 | if( isset( $this->session[$key] ) ) |
1265 | 1269 | return $this->session[$key]; |
1266 | 1270 | } |
1267 | 1271 | |
| 1272 | + /** |
| 1273 | + * @param $key |
| 1274 | + * @param $data |
| 1275 | + */ |
1268 | 1276 | public function setSessionData( $key, $data ) { |
1269 | 1277 | $this->session[$key] = $data; |
1270 | 1278 | } |
1271 | 1279 | |
| 1280 | + /** |
| 1281 | + * @return array|Mixed|null |
| 1282 | + */ |
1272 | 1283 | public function getSessionArray() { |
1273 | 1284 | return $this->session; |
1274 | 1285 | } |
Index: trunk/phase3/includes/cache/HTMLCacheUpdate.php |
— | — | @@ -32,6 +32,12 @@ |
33 | 33 | public $mTable, $mPrefix, $mStart, $mEnd; |
34 | 34 | public $mRowsPerJob, $mRowsPerQuery; |
35 | 35 | |
| 36 | + /** |
| 37 | + * @param $titleTo |
| 38 | + * @param $table |
| 39 | + * @param $start bool |
| 40 | + * @param $end bool |
| 41 | + */ |
36 | 42 | function __construct( $titleTo, $table, $start = false, $end = false ) { |
37 | 43 | global $wgUpdateRowsPerJob, $wgUpdateRowsPerQuery; |
38 | 44 | |
— | — | @@ -50,7 +56,6 @@ |
51 | 57 | return; |
52 | 58 | } |
53 | 59 | |
54 | | - |
55 | 60 | # Get an estimate of the number of rows from the BacklinkCache |
56 | 61 | $numRows = $this->mCache->getNumLinks( $this->mTable ); |
57 | 62 | if ( $numRows > $this->mRowsPerJob * 2 ) { |
— | — | @@ -138,6 +143,9 @@ |
139 | 144 | Job::batchInsert( $jobs ); |
140 | 145 | } |
141 | 146 | |
| 147 | + /** |
| 148 | + * @return mixed |
| 149 | + */ |
142 | 150 | protected function insertJobs() { |
143 | 151 | $batches = $this->mCache->partition( $this->mTable, $this->mRowsPerJob ); |
144 | 152 | if ( !$batches ) { |
— | — | @@ -157,6 +165,7 @@ |
158 | 166 | |
159 | 167 | /** |
160 | 168 | * Invalidate an array (or iterator) of Title objects, right now |
| 169 | + * @param $titleArray array |
161 | 170 | */ |
162 | 171 | protected function invalidateTitles( $titleArray ) { |
163 | 172 | global $wgUseFileCache, $wgUseSquid; |