Index: trunk/phase3/includes/objectcache/MemcachedPhpBagOStuff.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | * - timeout: The read timeout in microseconds |
23 | 23 | * - connect_timeout: The connect timeout in seconds |
24 | 24 | * |
25 | | - * @params $params array |
| 25 | + * @param $params array |
26 | 26 | */ |
27 | 27 | function __construct( $params ) { |
28 | 28 | if ( !isset( $params['servers'] ) ) { |
— | — | @@ -48,42 +48,90 @@ |
49 | 49 | $this->client->set_debug( $params['debug'] ); |
50 | 50 | } |
51 | 51 | |
| 52 | + /** |
| 53 | + * @param $debug bool |
| 54 | + */ |
52 | 55 | public function setDebug( $debug ) { |
53 | 56 | $this->client->set_debug( $debug ); |
54 | 57 | } |
55 | 58 | |
| 59 | + /** |
| 60 | + * @param $key string |
| 61 | + * @return Mixed |
| 62 | + */ |
56 | 63 | public function get( $key ) { |
57 | 64 | return $this->client->get( $this->encodeKey( $key ) ); |
58 | 65 | } |
59 | | - |
| 66 | + |
| 67 | + /** |
| 68 | + * @param $key string |
| 69 | + * @param $value |
| 70 | + * @param $exptime int |
| 71 | + * @return bool |
| 72 | + */ |
60 | 73 | public function set( $key, $value, $exptime = 0 ) { |
61 | 74 | return $this->client->set( $this->encodeKey( $key ), $value, $exptime ); |
62 | 75 | } |
63 | 76 | |
| 77 | + /** |
| 78 | + * @param $key string |
| 79 | + * @param $time int |
| 80 | + * @return bool |
| 81 | + */ |
64 | 82 | public function delete( $key, $time = 0 ) { |
65 | 83 | return $this->client->delete( $this->encodeKey( $key ), $time ); |
66 | 84 | } |
67 | 85 | |
| 86 | + /** |
| 87 | + * @param $key |
| 88 | + * @param $timeout int |
| 89 | + * @return |
| 90 | + */ |
68 | 91 | public function lock( $key, $timeout = 0 ) { |
69 | 92 | return $this->client->lock( $this->encodeKey( $key ), $timeout ); |
70 | 93 | } |
71 | 94 | |
| 95 | + /** |
| 96 | + * @param $key string |
| 97 | + * @return Mixed |
| 98 | + */ |
72 | 99 | public function unlock( $key ) { |
73 | 100 | return $this->client->unlock( $this->encodeKey( $key ) ); |
74 | 101 | } |
75 | 102 | |
| 103 | + /** |
| 104 | + * @param $key string |
| 105 | + * @param $value int |
| 106 | + * @return Mixed |
| 107 | + */ |
76 | 108 | public function add( $key, $value, $exptime = 0 ) { |
77 | 109 | return $this->client->add( $this->encodeKey( $key ), $value, $exptime ); |
78 | 110 | } |
79 | 111 | |
| 112 | + /** |
| 113 | + * @param $key string |
| 114 | + * @param $value int |
| 115 | + * @param $exptime |
| 116 | + * @return Mixed |
| 117 | + */ |
80 | 118 | public function replace( $key, $value, $exptime = 0 ) { |
81 | 119 | return $this->client->replace( $this->encodeKey( $key ), $value, $exptime ); |
82 | 120 | } |
83 | 121 | |
| 122 | + /** |
| 123 | + * @param $key string |
| 124 | + * @param $value int |
| 125 | + * @return Mixed |
| 126 | + */ |
84 | 127 | public function incr( $key, $value = 1 ) { |
85 | 128 | return $this->client->incr( $this->encodeKey( $key ), $value ); |
86 | 129 | } |
87 | 130 | |
| 131 | + /** |
| 132 | + * @param $key string |
| 133 | + * @param $value int |
| 134 | + * @return Mixed |
| 135 | + */ |
88 | 136 | public function decr( $key, $value = 1 ) { |
89 | 137 | return $this->client->decr( $this->encodeKey( $key ), $value ); |
90 | 138 | } |
— | — | @@ -91,6 +139,8 @@ |
92 | 140 | /** |
93 | 141 | * Get the underlying client object. This is provided for debugging |
94 | 142 | * purposes. |
| 143 | + * |
| 144 | + * @return MemCachedClientforWiki |
95 | 145 | */ |
96 | 146 | public function getClient() { |
97 | 147 | return $this->client; |
— | — | @@ -116,6 +166,10 @@ |
117 | 167 | /** |
118 | 168 | * Decode a key encoded with encodeKey(). This is provided as a convenience |
119 | 169 | * function for debugging. |
| 170 | + * |
| 171 | + * @param $key string |
| 172 | + * |
| 173 | + * @return string |
120 | 174 | */ |
121 | 175 | public function decodeKey( $key ) { |
122 | 176 | return urldecode( $key ); |
Index: trunk/phase3/includes/objectcache/BagOStuff.php |
— | — | @@ -43,6 +43,9 @@ |
44 | 44 | abstract class BagOStuff { |
45 | 45 | private $debugMode = false; |
46 | 46 | |
| 47 | + /** |
| 48 | + * @param $bool bool |
| 49 | + */ |
47 | 50 | public function setDebug( $bool ) { |
48 | 51 | $this->debugMode = $bool; |
49 | 52 | } |
— | — | @@ -53,6 +56,8 @@ |
54 | 57 | /** |
55 | 58 | * Get an item with the given key. Returns false if it does not exist. |
56 | 59 | * @param $key string |
| 60 | + * |
| 61 | + * @return bool|Object |
57 | 62 | */ |
58 | 63 | abstract public function get( $key ); |
59 | 64 | |
Index: trunk/phase3/includes/parser/Tidy.php |
— | — | @@ -17,13 +17,24 @@ |
18 | 18 | */ |
19 | 19 | class MWTidyWrapper { |
20 | 20 | |
21 | | - protected $mTokens, $mUniqPrefix; |
| 21 | + /** |
| 22 | + * @var ReplacementArray |
| 23 | + */ |
| 24 | + protected $mTokens; |
22 | 25 | |
| 26 | + protected $mUniqPrefix; |
| 27 | + |
| 28 | + protected $mMarkerIndex; |
| 29 | + |
23 | 30 | public function __construct() { |
24 | 31 | $this->mTokens = null; |
25 | 32 | $this->mUniqPrefix = null; |
26 | 33 | } |
27 | 34 | |
| 35 | + /** |
| 36 | + * @param $text string |
| 37 | + * @return string |
| 38 | + */ |
28 | 39 | public function getWrapped( $text ) { |
29 | 40 | $this->mTokens = new ReplacementArray; |
30 | 41 | $this->mUniqPrefix = "\x7fUNIQ" . |
— | — | @@ -40,7 +51,9 @@ |
41 | 52 | } |
42 | 53 | |
43 | 54 | /** |
44 | | - * @private |
| 55 | + * @param $m array |
| 56 | + * |
| 57 | + * @return string |
45 | 58 | */ |
46 | 59 | function replaceEditSectionLinksCallback( $m ) { |
47 | 60 | $marker = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}" . Parser::MARKER_SUFFIX; |
— | — | @@ -49,6 +62,10 @@ |
50 | 63 | return $marker; |
51 | 64 | } |
52 | 65 | |
| 66 | + /** |
| 67 | + * @param $text string |
| 68 | + * @return string |
| 69 | + */ |
53 | 70 | public function postprocess( $text ) { |
54 | 71 | return $this->mTokens->replace( $text ); |
55 | 72 | } |
— | — | @@ -187,6 +204,12 @@ |
188 | 205 | * saving the overhead of spawning a new process. |
189 | 206 | * |
190 | 207 | * 'pear install tidy' should be able to compile the extension module. |
| 208 | + * |
| 209 | + * @param $text |
| 210 | + * @param $stderr |
| 211 | + * @param $retval |
| 212 | + * |
| 213 | + * @return string |
191 | 214 | */ |
192 | 215 | private static function execInternalTidy( $text, $stderr = false, &$retval = null ) { |
193 | 216 | global $wgTidyConf, $wgDebugTidy; |
Index: trunk/phase3/includes/TitleArray.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | */ |
13 | 13 | abstract class TitleArray implements Iterator { |
14 | 14 | /** |
15 | | - * @param $res result A MySQL result including at least page_namespace and |
| 15 | + * @param $res ResultWrapper A SQL result including at least page_namespace and |
16 | 16 | * page_title -- also can have page_id, page_len, page_is_redirect, |
17 | 17 | * page_latest (if those will be used). See Title::newFromRow. |
18 | 18 | * @return TitleArrayFromResult |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | | - * @param $res |
| 32 | + * @param $res ResultWrapper |
33 | 33 | * @return TitleArrayFromResult |
34 | 34 | */ |
35 | 35 | protected static function newFromResult_internal( $res ) { |
— | — | @@ -38,6 +38,10 @@ |
39 | 39 | } |
40 | 40 | |
41 | 41 | class TitleArrayFromResult extends TitleArray { |
| 42 | + |
| 43 | + /** |
| 44 | + * @var ResultWrapper |
| 45 | + */ |
42 | 46 | var $res; |
43 | 47 | var $key, $current; |
44 | 48 | |
— | — | @@ -47,6 +51,10 @@ |
48 | 52 | $this->setCurrent( $this->res->current() ); |
49 | 53 | } |
50 | 54 | |
| 55 | + /** |
| 56 | + * @param $row ResultWrapper |
| 57 | + * @return void |
| 58 | + */ |
51 | 59 | protected function setCurrent( $row ) { |
52 | 60 | if ( $row === false ) { |
53 | 61 | $this->current = false; |
— | — | @@ -55,6 +63,9 @@ |
56 | 64 | } |
57 | 65 | } |
58 | 66 | |
| 67 | + /** |
| 68 | + * @return int |
| 69 | + */ |
59 | 70 | public function count() { |
60 | 71 | return $this->res->numRows(); |
61 | 72 | } |
— | — | @@ -79,6 +90,9 @@ |
80 | 91 | $this->setCurrent( $this->res->current() ); |
81 | 92 | } |
82 | 93 | |
| 94 | + /** |
| 95 | + * @return bool |
| 96 | + */ |
83 | 97 | function valid() { |
84 | 98 | return $this->current !== false; |
85 | 99 | } |
Index: trunk/phase3/includes/cache/CacheDependency.php |
— | — | @@ -58,6 +58,10 @@ |
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Store the wrapper to a cache |
| 62 | + * |
| 63 | + * @param $cache BagOStuff |
| 64 | + * @param $key |
| 65 | + * @param $expiry |
62 | 66 | */ |
63 | 67 | function storeToCache( $cache, $key, $expiry = 0 ) { |
64 | 68 | $this->initialiseDeps(); |
— | — | @@ -69,7 +73,7 @@ |
70 | 74 | * it will be generated with the callback function (if present), and the newly |
71 | 75 | * calculated value will be stored to the cache in a wrapper. |
72 | 76 | * |
73 | | - * @param $cache Object: a cache object such as $wgMemc |
| 77 | + * @param $cache BagOStuff a cache object such as $wgMemc |
74 | 78 | * @param $key String: the cache key |
75 | 79 | * @param $expiry Integer: the expiry timestamp or interval in seconds |
76 | 80 | * @param $callback Mixed: the callback for generating the value, or false |
— | — | @@ -156,6 +160,9 @@ |
157 | 161 | } |
158 | 162 | } |
159 | 163 | |
| 164 | + /** |
| 165 | + * @return bool |
| 166 | + */ |
160 | 167 | function isExpired() { |
161 | 168 | if ( !file_exists( $this->filename ) ) { |
162 | 169 | if ( $this->timestamp === false ) { |
— | — | @@ -204,11 +211,16 @@ |
205 | 212 | |
206 | 213 | /** |
207 | 214 | * Get rid of bulky Title object for sleep |
| 215 | + * |
| 216 | + * @return array |
208 | 217 | */ |
209 | 218 | function __sleep() { |
210 | 219 | return array( 'ns', 'dbk', 'touched' ); |
211 | 220 | } |
212 | 221 | |
| 222 | + /** |
| 223 | + * @return Title |
| 224 | + */ |
213 | 225 | function getTitle() { |
214 | 226 | if ( !isset( $this->titleObj ) ) { |
215 | 227 | $this->titleObj = Title::makeTitle( $this->ns, $this->dbk ); |
— | — | @@ -217,6 +229,9 @@ |
218 | 230 | return $this->titleObj; |
219 | 231 | } |
220 | 232 | |
| 233 | + /** |
| 234 | + * @return bool |
| 235 | + */ |
221 | 236 | function isExpired() { |
222 | 237 | $touched = $this->getTitle()->getTouched(); |
223 | 238 | |
— | — | @@ -292,6 +307,9 @@ |
293 | 308 | $this->timestamps = $this->calculateTimestamps(); |
294 | 309 | } |
295 | 310 | |
| 311 | + /** |
| 312 | + * @return array |
| 313 | + */ |
296 | 314 | function __sleep() { |
297 | 315 | return array( 'timestamps' ); |
298 | 316 | } |
— | — | @@ -304,6 +322,9 @@ |
305 | 323 | return $this->linkBatch; |
306 | 324 | } |
307 | 325 | |
| 326 | + /** |
| 327 | + * @return bool |
| 328 | + */ |
308 | 329 | function isExpired() { |
309 | 330 | $newTimestamps = $this->calculateTimestamps(); |
310 | 331 | |
— | — | @@ -345,6 +366,9 @@ |
346 | 367 | $this->value = $GLOBALS[$name]; |
347 | 368 | } |
348 | 369 | |
| 370 | + /** |
| 371 | + * @return bool |
| 372 | + */ |
349 | 373 | function isExpired() { |
350 | 374 | return $GLOBALS[$this->name] != $this->value; |
351 | 375 | } |
— | — | @@ -361,6 +385,9 @@ |
362 | 386 | $this->value = constant( $name ); |
363 | 387 | } |
364 | 388 | |
| 389 | + /** |
| 390 | + * @return bool |
| 391 | + */ |
365 | 392 | function isExpired() { |
366 | 393 | return constant( $this->name ) != $this->value; |
367 | 394 | } |
Index: trunk/phase3/includes/HttpFunctions.old.php |
— | — | @@ -7,6 +7,7 @@ |
8 | 8 | * http://www.php.net/manual/en/class.httprequest.php |
9 | 9 | * |
10 | 10 | * This is for backwards compatibility. |
| 11 | + * @since 1.17 |
11 | 12 | */ |
12 | 13 | |
13 | 14 | class HttpRequest extends MWHttpRequest { } |
Index: trunk/phase3/includes/UserArray.php |
— | — | @@ -1,9 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | abstract class UserArray implements Iterator { |
5 | | - |
6 | 5 | /** |
7 | | - * @param $res |
| 6 | + * @param $res ResultWrapper |
8 | 7 | * @return UserArrayFromResult |
9 | 8 | */ |
10 | 9 | static function newFromResult( $res ) { |
— | — | @@ -33,22 +32,36 @@ |
34 | 33 | return self::newFromResult( $res ); |
35 | 34 | } |
36 | 35 | |
| 36 | + /** |
| 37 | + * @param $res |
| 38 | + * @return UserArrayFromResult |
| 39 | + */ |
37 | 40 | protected static function newFromResult_internal( $res ) { |
38 | | - $userArray = new UserArrayFromResult( $res ); |
39 | | - return $userArray; |
| 41 | + return new UserArrayFromResult( $res ); |
40 | 42 | } |
41 | 43 | } |
42 | 44 | |
43 | 45 | class UserArrayFromResult extends UserArray { |
| 46 | + |
| 47 | + /** |
| 48 | + * @var ResultWrapper |
| 49 | + */ |
44 | 50 | var $res; |
45 | 51 | var $key, $current; |
46 | 52 | |
| 53 | + /** |
| 54 | + * @param $res ResultWrapper |
| 55 | + */ |
47 | 56 | function __construct( $res ) { |
48 | 57 | $this->res = $res; |
49 | 58 | $this->key = 0; |
50 | 59 | $this->setCurrent( $this->res->current() ); |
51 | 60 | } |
52 | 61 | |
| 62 | + /** |
| 63 | + * @param $row |
| 64 | + * @return void |
| 65 | + */ |
53 | 66 | protected function setCurrent( $row ) { |
54 | 67 | if ( $row === false ) { |
55 | 68 | $this->current = false; |
— | — | @@ -57,6 +70,9 @@ |
58 | 71 | } |
59 | 72 | } |
60 | 73 | |
| 74 | + /** |
| 75 | + * @return int |
| 76 | + */ |
61 | 77 | public function count() { |
62 | 78 | return $this->res->numRows(); |
63 | 79 | } |
— | — | @@ -81,6 +97,9 @@ |
82 | 98 | $this->setCurrent( $this->res->current() ); |
83 | 99 | } |
84 | 100 | |
| 101 | + /** |
| 102 | + * @return bool |
| 103 | + */ |
85 | 104 | function valid() { |
86 | 105 | return $this->current !== false; |
87 | 106 | } |