Index: trunk/phase3/includes/OutputHandler.php |
— | — | @@ -7,7 +7,9 @@ |
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Standard output handler for use with ob_start |
11 | | - * |
| 11 | + * |
| 12 | + * @param $s string |
| 13 | + * |
12 | 14 | * @return string |
13 | 15 | */ |
14 | 16 | function wfOutputHandler( $s ) { |
Index: trunk/phase3/includes/objectcache/ObjectCache.php |
— | — | @@ -10,6 +10,10 @@ |
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Get a cached instance of the specified type of cache object. |
| 14 | + * |
| 15 | + * @param $id |
| 16 | + * |
| 17 | + * @return object |
14 | 18 | */ |
15 | 19 | static function getInstance( $id ) { |
16 | 20 | if ( isset( self::$instances[$id] ) ) { |
— | — | @@ -44,6 +48,8 @@ |
45 | 49 | |
46 | 50 | /** |
47 | 51 | * Create a new cache object from parameters |
| 52 | + * |
| 53 | + * @param $params array |
48 | 54 | */ |
49 | 55 | static function newFromParams( $params ) { |
50 | 56 | if ( isset( $params['factory'] ) ) { |
— | — | @@ -94,6 +100,10 @@ |
95 | 101 | * Factory function that creates a memcached client object. |
96 | 102 | * The idea of this is that it might eventually detect and automatically |
97 | 103 | * support the PECL extension, assuming someone can get it to compile. |
| 104 | + * |
| 105 | + * @param $params array |
| 106 | + * |
| 107 | + * @return MemcachedPhpBagOStuff |
98 | 108 | */ |
99 | 109 | static function newMemcached( $params ) { |
100 | 110 | return new MemcachedPhpBagOStuff( $params ); |
Index: trunk/phase3/includes/objectcache/MultiWriteBagOStuff.php |
— | — | @@ -14,6 +14,8 @@ |
15 | 15 | * - caches: This should have a numbered array of cache parameter |
16 | 16 | * structures, in the style required by $wgObjectCaches. See |
17 | 17 | * the documentation of $wgObjectCaches for more detail. |
| 18 | + * |
| 19 | + * @param $params array |
18 | 20 | */ |
19 | 21 | public function __construct( $params ) { |
20 | 22 | if ( !isset( $params['caches'] ) ) { |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -111,6 +111,10 @@ |
112 | 112 | var $mFirstCall = true; |
113 | 113 | |
114 | 114 | # Initialised by initialiseVariables() |
| 115 | + |
| 116 | + /** |
| 117 | + * @var MagicWordArray |
| 118 | + */ |
115 | 119 | var $mVariables; |
116 | 120 | |
117 | 121 | /** |
— | — | @@ -169,6 +173,11 @@ |
170 | 174 | var $mRevIdForTs; # The revision ID which was used to fetch the timestamp |
171 | 175 | |
172 | 176 | /** |
| 177 | + * @var string |
| 178 | + */ |
| 179 | + var $mUniqPrefix; |
| 180 | + |
| 181 | + /** |
173 | 182 | * Constructor |
174 | 183 | */ |
175 | 184 | public function __construct( $conf = array() ) { |
— | — | @@ -507,6 +516,8 @@ |
508 | 517 | |
509 | 518 | /** |
510 | 519 | * Get a random string |
| 520 | + * |
| 521 | + * @return string |
511 | 522 | */ |
512 | 523 | static public function getRandomString() { |
513 | 524 | return dechex( mt_rand( 0, 0x7fffffff ) ) . dechex( mt_rand( 0, 0x7fffffff ) ); |
— | — | @@ -542,6 +553,8 @@ |
543 | 554 | |
544 | 555 | /** |
545 | 556 | * Set the context title |
| 557 | + * |
| 558 | + * @param $t Title |
546 | 559 | */ |
547 | 560 | function setTitle( $t ) { |
548 | 561 | if ( !$t || $t instanceof FakeTitle ) { |
— | — | @@ -630,10 +643,16 @@ |
631 | 644 | return wfSetVar( $this->mOptions, $x ); |
632 | 645 | } |
633 | 646 | |
| 647 | + /** |
| 648 | + * @return int |
| 649 | + */ |
634 | 650 | function nextLinkID() { |
635 | 651 | return $this->mLinkID++; |
636 | 652 | } |
637 | 653 | |
| 654 | + /** |
| 655 | + * @param $id int |
| 656 | + */ |
638 | 657 | function setLinkID( $id ) { |
639 | 658 | $this->mLinkID = $id; |
640 | 659 | } |
— | — | @@ -689,10 +708,10 @@ |
690 | 709 | * array( 'param' => 'x' ), |
691 | 710 | * '<element param="x">tag content</element>' ) ) |
692 | 711 | * |
693 | | - * @param $elements list of element names. Comments are always extracted. |
694 | | - * @param $text Source text string. |
695 | | - * @param $matches Out parameter, Array: extracted tags |
696 | | - * @param $uniq_prefix |
| 712 | + * @param $elements array list of element names. Comments are always extracted. |
| 713 | + * @param $text string Source text string. |
| 714 | + * @param $matches array Out parameter, Array: extracted tags |
| 715 | + * @param $uniq_prefix string |
697 | 716 | * @return String: stripped text |
698 | 717 | */ |
699 | 718 | public static function extractTagsAndParams( $elements, $text, &$matches, $uniq_prefix = '' ) { |
— | — | @@ -759,6 +778,8 @@ |
760 | 779 | |
761 | 780 | /** |
762 | 781 | * Get a list of strippable XML-like elements |
| 782 | + * |
| 783 | + * @return array |
763 | 784 | */ |
764 | 785 | function getStripList() { |
765 | 786 | return $this->mStripList; |
— | — | @@ -960,6 +981,9 @@ |
961 | 982 | * is repeated twice. |
962 | 983 | * |
963 | 984 | * @private |
| 985 | + * @param $cell |
| 986 | + * @param $tagName |
| 987 | + * @return array |
964 | 988 | */ |
965 | 989 | function getCellAttr ( $cell, $tagName ) { |
966 | 990 | $attributes = null; |
— | — | @@ -1176,6 +1200,11 @@ |
1177 | 1201 | return $text; |
1178 | 1202 | } |
1179 | 1203 | |
| 1204 | + /** |
| 1205 | + * @throws MWException |
| 1206 | + * @param $m array |
| 1207 | + * @return HTML|string |
| 1208 | + */ |
1180 | 1209 | function magicLinkCallback( $m ) { |
1181 | 1210 | if ( isset( $m[1] ) && $m[1] !== '' ) { |
1182 | 1211 | # Skip anchor |
Index: trunk/phase3/includes/parser/Preprocessor.php |
— | — | @@ -22,6 +22,8 @@ |
23 | 23 | /** |
24 | 24 | * Create a new custom frame for programmatic use of parameter replacement as used in some extensions |
25 | 25 | * |
| 26 | + * @param $args array |
| 27 | + * |
26 | 28 | * @return PPFrame |
27 | 29 | */ |
28 | 30 | function newCustomFrame( $args ); |
— | — | @@ -51,6 +53,8 @@ |
52 | 54 | |
53 | 55 | /** |
54 | 56 | * Create a child frame |
| 57 | + * |
| 58 | + * @return PPFrame |
55 | 59 | */ |
56 | 60 | function newChild( $args = false, $title = false ); |
57 | 61 | |
Index: trunk/phase3/includes/filerepo/FileRepoStatus.php |
— | — | @@ -13,6 +13,10 @@ |
14 | 14 | class FileRepoStatus extends Status { |
15 | 15 | /** |
16 | 16 | * Factory function for fatal errors |
| 17 | + * |
| 18 | + * @param $repo FileRepo |
| 19 | + * |
| 20 | + * @return FileRepoStatus |
17 | 21 | */ |
18 | 22 | static function newFatal( $repo /*, parameters...*/ ) { |
19 | 23 | $params = array_slice( func_get_args(), 1 ); |
— | — | @@ -22,6 +26,11 @@ |
23 | 27 | return $result; |
24 | 28 | } |
25 | 29 | |
| 30 | + /** |
| 31 | + * @param $repo FileRepo |
| 32 | + * @param $value |
| 33 | + * @return FileRepoStatus |
| 34 | + */ |
26 | 35 | static function newGood( $repo = false, $value = null ) { |
27 | 36 | $result = new self( $repo ); |
28 | 37 | $result->value = $value; |
Index: trunk/phase3/includes/ZhClient.php |
— | — | @@ -19,6 +19,8 @@ |
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Check if connection to zhdaemon is successful |
| 23 | + * |
| 24 | + * @return bool |
23 | 25 | */ |
24 | 26 | function isconnected() { |
25 | 27 | return $this->mConnected; |
— | — | @@ -28,6 +30,8 @@ |
29 | 31 | * Establish conncetion |
30 | 32 | * |
31 | 33 | * @access private |
| 34 | + * |
| 35 | + * @return bool |
32 | 36 | */ |
33 | 37 | function connect() { |
34 | 38 | wfSuppressWarnings(); |
Index: trunk/phase3/includes/Cdb_PHP.php |
— | — | @@ -16,6 +16,7 @@ |
17 | 17 | /** |
18 | 18 | * Take a modulo of a signed integer as if it were an unsigned integer. |
19 | 19 | * $b must be less than 0x40000000 and greater than 0 |
| 20 | + * @return int |
20 | 21 | */ |
21 | 22 | public static function unsignedMod( $a, $b ) { |
22 | 23 | if ( $a & 0x80000000 ) { |
— | — | @@ -25,9 +26,12 @@ |
26 | 27 | return $a % $b; |
27 | 28 | } |
28 | 29 | } |
29 | | - |
| 30 | + |
30 | 31 | /** |
31 | 32 | * Shift a signed integer right as if it were unsigned |
| 33 | + * @param $a |
| 34 | + * @param $b |
| 35 | + * @return int |
32 | 36 | */ |
33 | 37 | public static function unsignedShiftRight( $a, $b ) { |
34 | 38 | if ( $b == 0 ) { |
— | — | @@ -42,6 +46,9 @@ |
43 | 47 | |
44 | 48 | /** |
45 | 49 | * The CDB hash function. |
| 50 | + * |
| 51 | + * @param $s |
| 52 | + * @return |
46 | 53 | */ |
47 | 54 | public static function hash( $s ) { |
48 | 55 | $h = 5381; |
— | — | @@ -103,8 +110,9 @@ |
104 | 111 | } |
105 | 112 | |
106 | 113 | function close() { |
107 | | - if( isset($this->handle) ) |
| 114 | + if( isset( $this->handle ) ) { |
108 | 115 | fclose( $this->handle ); |
| 116 | + } |
109 | 117 | unset( $this->handle ); |
110 | 118 | } |
111 | 119 | |
— | — | @@ -117,6 +125,11 @@ |
118 | 126 | } |
119 | 127 | } |
120 | 128 | |
| 129 | + /** |
| 130 | + * @param $key |
| 131 | + * @param $pos |
| 132 | + * @return bool |
| 133 | + */ |
121 | 134 | protected function match( $key, $pos ) { |
122 | 135 | $buf = $this->read( strlen( $key ), $pos ); |
123 | 136 | return $buf === $key; |
— | — | @@ -126,6 +139,12 @@ |
127 | 140 | $this->loop = 0; |
128 | 141 | } |
129 | 142 | |
| 143 | + /** |
| 144 | + * @throws MWException |
| 145 | + * @param $length |
| 146 | + * @param $pos |
| 147 | + * @return string |
| 148 | + */ |
130 | 149 | protected function read( $length, $pos ) { |
131 | 150 | if ( fseek( $this->handle, $pos ) == -1 ) { |
132 | 151 | // This can easily happen if the internal pointers are incorrect |
— | — | @@ -145,6 +164,8 @@ |
146 | 165 | |
147 | 166 | /** |
148 | 167 | * Unpack an unsigned integer and throw an exception if it needs more than 31 bits |
| 168 | + * @param $s |
| 169 | + * @return |
149 | 170 | */ |
150 | 171 | protected function unpack31( $s ) { |
151 | 172 | $data = unpack( 'V', $s ); |
— | — | @@ -156,12 +177,18 @@ |
157 | 178 | |
158 | 179 | /** |
159 | 180 | * Unpack a 32-bit signed integer |
| 181 | + * @param $s |
| 182 | + * @return int |
160 | 183 | */ |
161 | 184 | protected function unpackSigned( $s ) { |
162 | 185 | $data = unpack( 'va/vb', $s ); |
163 | 186 | return $data['a'] | ( $data['b'] << 16 ); |
164 | 187 | } |
165 | 188 | |
| 189 | + /** |
| 190 | + * @param $key |
| 191 | + * @return bool |
| 192 | + */ |
166 | 193 | protected function findNext( $key ) { |
167 | 194 | if ( !$this->loop ) { |
168 | 195 | $u = CdbFunctions::hash( $key ); |
— | — | @@ -204,6 +231,10 @@ |
205 | 232 | return false; |
206 | 233 | } |
207 | 234 | |
| 235 | + /** |
| 236 | + * @param $key |
| 237 | + * @return bool |
| 238 | + */ |
208 | 239 | protected function find( $key ) { |
209 | 240 | $this->findStart(); |
210 | 241 | return $this->findNext( $key ); |
— | — | @@ -240,6 +271,11 @@ |
241 | 272 | } |
242 | 273 | } |
243 | 274 | |
| 275 | + /** |
| 276 | + * @param $key |
| 277 | + * @param $value |
| 278 | + * @return |
| 279 | + */ |
244 | 280 | public function set( $key, $value ) { |
245 | 281 | if ( strval( $key ) === '' ) { |
246 | 282 | // DBA cross-check hack |
— | — | @@ -251,10 +287,14 @@ |
252 | 288 | $this->addend( strlen( $key ), strlen( $value ), CdbFunctions::hash( $key ) ); |
253 | 289 | } |
254 | 290 | |
| 291 | + /** |
| 292 | + * @throws MWException |
| 293 | + */ |
255 | 294 | public function close() { |
256 | 295 | $this->finish(); |
257 | | - if( isset($this->handle) ) |
| 296 | + if( isset($this->handle) ) { |
258 | 297 | fclose( $this->handle ); |
| 298 | + } |
259 | 299 | if ( wfIsWindows() && file_exists($this->realFileName) ) { |
260 | 300 | unlink( $this->realFileName ); |
261 | 301 | } |
— | — | @@ -264,6 +304,10 @@ |
265 | 305 | unset( $this->handle ); |
266 | 306 | } |
267 | 307 | |
| 308 | + /** |
| 309 | + * @throws MWException |
| 310 | + * @param $buf |
| 311 | + */ |
268 | 312 | protected function write( $buf ) { |
269 | 313 | $len = fwrite( $this->handle, $buf ); |
270 | 314 | if ( $len !== strlen( $buf ) ) { |
— | — | @@ -271,6 +315,10 @@ |
272 | 316 | } |
273 | 317 | } |
274 | 318 | |
| 319 | + /** |
| 320 | + * @throws MWException |
| 321 | + * @param $len |
| 322 | + */ |
275 | 323 | protected function posplus( $len ) { |
276 | 324 | $newpos = $this->pos + $len; |
277 | 325 | if ( $newpos > 0x7fffffff ) { |
— | — | @@ -291,6 +339,11 @@ |
292 | 340 | $this->posplus( $datalen ); |
293 | 341 | } |
294 | 342 | |
| 343 | + /** |
| 344 | + * @throws MWException |
| 345 | + * @param $keylen |
| 346 | + * @param $datalen |
| 347 | + */ |
295 | 348 | protected function addbegin( $keylen, $datalen ) { |
296 | 349 | if ( $keylen > 0x7fffffff ) { |
297 | 350 | throw new MWException( __METHOD__.': key length too long' ); |
Index: trunk/phase3/includes/media/IPTC.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | * |
14 | 14 | * @see http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf |
15 | 15 | * |
16 | | - * @param String $data app13 block from jpeg containing iptc/iim data |
| 16 | + * @param $rawData String app13 block from jpeg containing iptc/iim data |
17 | 17 | * @return Array iptc metadata array |
18 | 18 | */ |
19 | 19 | static function parse( $rawData ) { |
Index: trunk/phase3/includes/media/Tiff.php |
— | — | @@ -16,6 +16,8 @@ |
17 | 17 | /** |
18 | 18 | * Conversion to PNG for inline display can be disabled here... |
19 | 19 | * Note scaling should work with ImageMagick, but may not with GD scaling. |
| 20 | + * |
| 21 | + * @return bool |
20 | 22 | */ |
21 | 23 | function canRender( $file ) { |
22 | 24 | global $wgTiffThumbnailType; |
— | — | @@ -25,29 +27,42 @@ |
26 | 28 | /** |
27 | 29 | * Browsers don't support TIFF inline generally... |
28 | 30 | * For inline display, we need to convert to PNG. |
| 31 | + * |
| 32 | + * @return bool |
29 | 33 | */ |
30 | 34 | function mustRender( $file ) { |
31 | 35 | return true; |
32 | 36 | } |
33 | 37 | |
| 38 | + /** |
| 39 | + * @param $ext |
| 40 | + * @param $mime |
| 41 | + * @param null $params |
| 42 | + * @return bool |
| 43 | + */ |
34 | 44 | function getThumbType( $ext, $mime, $params = null ) { |
35 | 45 | global $wgTiffThumbnailType; |
36 | 46 | return $wgTiffThumbnailType; |
37 | 47 | } |
38 | 48 | |
39 | | - function getMetadata( $image, $filename ) { |
40 | | - global $wgShowEXIF; |
41 | | - if ( $wgShowEXIF && file_exists( $filename ) ) { |
42 | | - $exif = new Exif( $filename ); |
43 | | - $data = $exif->getFilteredData(); |
44 | | - if ( $data ) { |
45 | | - $data['MEDIAWIKI_EXIF_VERSION'] = Exif::version(); |
46 | | - return serialize( $data ); |
47 | | - } else { |
48 | | - return JpegOrTiffHandler::BROKEN_FILE; |
49 | | - } |
50 | | - } else { |
51 | | - return ''; |
52 | | - } |
53 | | - } |
| 49 | + /** |
| 50 | + * @param $image |
| 51 | + * @param $filename |
| 52 | + * @return string |
| 53 | + */ |
| 54 | + function getMetadata( $image, $filename ) { |
| 55 | + global $wgShowEXIF; |
| 56 | + if ( $wgShowEXIF && file_exists( $filename ) ) { |
| 57 | + $exif = new Exif( $filename ); |
| 58 | + $data = $exif->getFilteredData(); |
| 59 | + if ( $data ) { |
| 60 | + $data['MEDIAWIKI_EXIF_VERSION'] = Exif::version(); |
| 61 | + return serialize( $data ); |
| 62 | + } else { |
| 63 | + return JpegOrTiffHandler::BROKEN_FILE; |
| 64 | + } |
| 65 | + } else { |
| 66 | + return ''; |
| 67 | + } |
| 68 | + } |
54 | 69 | } |
Index: trunk/phase3/includes/StreamFile.php |
— | — | @@ -5,7 +5,10 @@ |
6 | 6 | * @file |
7 | 7 | */ |
8 | 8 | |
9 | | -/** */ |
| 9 | +/** |
| 10 | + * @param $fname string |
| 11 | + * @param $headers array |
| 12 | + */ |
10 | 13 | function wfStreamFile( $fname, $headers = array() ) { |
11 | 14 | $stat = @stat( $fname ); |
12 | 15 | if ( !$stat ) { |
Index: trunk/phase3/includes/specials/SpecialListredirects.php |
— | — | @@ -65,6 +65,7 @@ |
66 | 66 | * Cache page existence for performance |
67 | 67 | * |
68 | 68 | * @param $db DatabaseBase |
| 69 | + * @param $res ResultWrapper |
69 | 70 | */ |
70 | 71 | function preprocessResults( $db, $res ) { |
71 | 72 | $batch = new LinkBatch; |
Index: trunk/phase3/includes/Autopromote.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | /** |
10 | 10 | * Get the groups for the given user based on $wgAutopromote. |
11 | 11 | * |
12 | | - * @param $user The user to get the groups for |
| 12 | + * @param $user User The user to get the groups for |
13 | 13 | * @return array Array of groups to promote to. |
14 | 14 | */ |
15 | 15 | public static function getAutopromoteGroups( User $user ) { |
Index: trunk/phase3/includes/ImageFunctions.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | * i.e. articles where the image may occur inline. |
17 | 17 | * |
18 | 18 | * @param $name string the image name to check |
19 | | - * @param $contextTitle Title: the page on which the image occurs, if known |
| 19 | + * @param $contextTitle Title the page on which the image occurs, if known |
20 | 20 | * @return bool |
21 | 21 | */ |
22 | 22 | function wfIsBadImage( $name, $contextTitle = false ) { |
Index: trunk/phase3/includes/HistoryBlob.php |
— | — | @@ -12,6 +12,8 @@ |
13 | 13 | * You must call setLocation() on the stub object before storing it to the |
14 | 14 | * database |
15 | 15 | * |
| 16 | + * @param $text string |
| 17 | + * |
16 | 18 | * @return String: the key for getItem() |
17 | 19 | */ |
18 | 20 | function addItem( $text ); |
— | — | @@ -19,6 +21,8 @@ |
20 | 22 | /** |
21 | 23 | * Get item by key, or false if the key is not present |
22 | 24 | * |
| 25 | + * @param $key string |
| 26 | + * |
23 | 27 | * @return String or false |
24 | 28 | */ |
25 | 29 | function getItem( $key ); |
— | — | @@ -30,6 +34,8 @@ |
31 | 35 | * be other revisions in the same object. |
32 | 36 | * |
33 | 37 | * Default text is not required for two-part external storage URLs. |
| 38 | + * |
| 39 | + * @param $text string |
34 | 40 | */ |
35 | 41 | function setText( $text ); |
36 | 42 | |
— | — | @@ -59,6 +65,10 @@ |
60 | 66 | } |
61 | 67 | } |
62 | 68 | |
| 69 | + /** |
| 70 | + * @param $text string |
| 71 | + * @return string |
| 72 | + */ |
63 | 73 | public function addItem( $text ) { |
64 | 74 | $this->uncompress(); |
65 | 75 | $hash = md5( $text ); |
— | — | @@ -69,6 +79,10 @@ |
70 | 80 | return $hash; |
71 | 81 | } |
72 | 82 | |
| 83 | + /** |
| 84 | + * @param $hash string |
| 85 | + * @return array|bool |
| 86 | + */ |
73 | 87 | public function getItem( $hash ) { |
74 | 88 | $this->uncompress(); |
75 | 89 | if ( array_key_exists( $hash, $this->mItems ) ) { |
— | — | @@ -78,11 +92,18 @@ |
79 | 93 | } |
80 | 94 | } |
81 | 95 | |
| 96 | + /** |
| 97 | + * @param $text string |
| 98 | + * @return void |
| 99 | + */ |
82 | 100 | public function setText( $text ) { |
83 | 101 | $this->uncompress(); |
84 | 102 | $this->mDefaultHash = $this->addItem( $text ); |
85 | 103 | } |
86 | 104 | |
| 105 | + /** |
| 106 | + * @return array|bool |
| 107 | + */ |
87 | 108 | public function getText() { |
88 | 109 | $this->uncompress(); |
89 | 110 | return $this->getItem( $this->mDefaultHash ); |
— | — | @@ -90,6 +111,8 @@ |
91 | 112 | |
92 | 113 | /** |
93 | 114 | * Remove an item |
| 115 | + * |
| 116 | + * @param $hash string |
94 | 117 | */ |
95 | 118 | public function removeItem( $hash ) { |
96 | 119 | $this->mSize -= strlen( $this->mItems[$hash] ); |
— | — | @@ -116,7 +139,9 @@ |
117 | 140 | } |
118 | 141 | } |
119 | 142 | |
120 | | - |
| 143 | + /** |
| 144 | + * @return array |
| 145 | + */ |
121 | 146 | function __sleep() { |
122 | 147 | $this->compress(); |
123 | 148 | return array( 'mVersion', 'mCompressed', 'mItems', 'mDefaultHash' ); |
— | — | @@ -129,6 +154,8 @@ |
130 | 155 | /** |
131 | 156 | * Helper function for compression jobs |
132 | 157 | * Returns true until the object is "full" and ready to be committed |
| 158 | + * |
| 159 | + * @return bool |
133 | 160 | */ |
134 | 161 | public function isHappy() { |
135 | 162 | return $this->mSize < $this->mMaxSize |
— | — | @@ -137,8 +164,6 @@ |
138 | 165 | } |
139 | 166 | |
140 | 167 | |
141 | | - |
142 | | - |
143 | 168 | /** |
144 | 169 | * Pointer object for an item within a CGZ blob stored in the text table. |
145 | 170 | */ |
— | — | @@ -183,6 +208,9 @@ |
184 | 209 | return $this->mRef; |
185 | 210 | } |
186 | 211 | |
| 212 | + /** |
| 213 | + * @return string |
| 214 | + */ |
187 | 215 | function getText() { |
188 | 216 | $fname = 'HistoryBlobStub::getText'; |
189 | 217 | |
— | — | @@ -198,11 +226,11 @@ |
199 | 227 | if( in_array( 'external', $flags ) ) { |
200 | 228 | $url=$row->old_text; |
201 | 229 | @list( /* $proto */ ,$path)=explode('://',$url,2); |
202 | | - if ($path=="") { |
| 230 | + if ( $path == "" ) { |
203 | 231 | wfProfileOut( $fname ); |
204 | 232 | return false; |
205 | 233 | } |
206 | | - $row->old_text=ExternalStore::fetchFromUrl($url); |
| 234 | + $row->old_text = ExternalStore::fetchFromUrl($url); |
207 | 235 | |
208 | 236 | } |
209 | 237 | if( !in_array( 'object', $flags ) ) { |
— | — | @@ -232,6 +260,8 @@ |
233 | 261 | |
234 | 262 | /** |
235 | 263 | * Get the content hash |
| 264 | + * |
| 265 | + * @return string |
236 | 266 | */ |
237 | 267 | function getHash() { |
238 | 268 | return $this->mHash; |
— | — | @@ -265,6 +295,9 @@ |
266 | 296 | $this->mCurId = $id; |
267 | 297 | } |
268 | 298 | |
| 299 | + /** |
| 300 | + * @return string|false |
| 301 | + */ |
269 | 302 | function getText() { |
270 | 303 | $dbr = wfGetDB( DB_SLAVE ); |
271 | 304 | $row = $dbr->selectRow( 'cur', array( 'cur_text' ), array( 'cur_id' => $this->mCurId ) ); |
— | — | @@ -336,6 +369,11 @@ |
337 | 370 | } |
338 | 371 | } |
339 | 372 | |
| 373 | + /** |
| 374 | + * @throws MWException |
| 375 | + * @param $text string |
| 376 | + * @return int |
| 377 | + */ |
340 | 378 | function addItem( $text ) { |
341 | 379 | if ( $this->mFrozen ) { |
342 | 380 | throw new MWException( __METHOD__.": Cannot add more items after sleep/wakeup" ); |
— | — | @@ -347,18 +385,31 @@ |
348 | 386 | return count( $this->mItems ) - 1; |
349 | 387 | } |
350 | 388 | |
| 389 | + /** |
| 390 | + * @param $key string |
| 391 | + * @return string |
| 392 | + */ |
351 | 393 | function getItem( $key ) { |
352 | 394 | return $this->mItems[$key]; |
353 | 395 | } |
354 | 396 | |
| 397 | + /** |
| 398 | + * @param $text string |
| 399 | + */ |
355 | 400 | function setText( $text ) { |
356 | 401 | $this->mDefaultKey = $this->addItem( $text ); |
357 | 402 | } |
358 | 403 | |
| 404 | + /** |
| 405 | + * @return string |
| 406 | + */ |
359 | 407 | function getText() { |
360 | 408 | return $this->getItem( $this->mDefaultKey ); |
361 | 409 | } |
362 | 410 | |
| 411 | + /** |
| 412 | + * @throws MWException |
| 413 | + */ |
363 | 414 | function compress() { |
364 | 415 | if ( !function_exists( 'xdiff_string_rabdiff' ) ){ |
365 | 416 | throw new MWException( "Need xdiff 1.5+ support to write DiffHistoryBlob\n" ); |