r89049 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89048‎ | r89049 | r89050 >
Date:17:51, 28 May 2011
Author:reedy
Status:deferred
Tags:
Comment:
And some more....
Modified paths:
  • /trunk/phase3/includes/Cdb_PHP.php (modified) (history)
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)
  • /trunk/phase3/includes/HistoryBlob.php (modified) (history)
  • /trunk/phase3/includes/db/LBFactory_Single.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignDBFile.php (modified) (history)
  • /trunk/phase3/includes/media/Tiff.php (modified) (history)
  • /trunk/phase3/includes/parser/ParserOutput.php (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/ParserOutput.php
@@ -26,9 +26,8 @@
2727 * setCacheTime() sets the timestamp expressing when the page has been rendered.
2828 * This doesn not control expiry, see updateCacheExpiry() for that!
2929 */
30 - function setCacheTime( $t ) { return wfSetVar( $this->mCacheTime, $t ); }
 30+ function setCacheTime( $t ) { return wfSetVar( $this->mCacheTime, $t ); }
3131
32 -
3332 /**
3433 * Sets the number of seconds after which this object should expire.
3534 * This value is used with the ParserCache.
@@ -40,12 +39,14 @@
4140 function updateCacheExpiry( $seconds ) {
4241 $seconds = (int)$seconds;
4342
44 - if ( $this->mCacheExpiry === null || $this->mCacheExpiry > $seconds )
45 - $this->mCacheExpiry = $seconds;
 43+ if ( $this->mCacheExpiry === null || $this->mCacheExpiry > $seconds ) {
 44+ $this->mCacheExpiry = $seconds;
 45+ }
4646
4747 // hack: set old-style marker for uncacheable entries.
48 - if ( $this->mCacheExpiry !== null && $this->mCacheExpiry <= 0 )
 48+ if ( $this->mCacheExpiry !== null && $this->mCacheExpiry <= 0 ) {
4949 $this->mCacheTime = -1;
 50+ }
5051 }
5152
5253 /**
@@ -59,28 +60,36 @@
6061 function getCacheExpiry() {
6162 global $wgParserCacheExpireTime;
6263
63 - if ( $this->mCacheTime < 0 ) return 0; // old-style marker for "not cachable"
 64+ if ( $this->mCacheTime < 0 ) {
 65+ return 0;
 66+ } // old-style marker for "not cachable"
6467
6568 $expire = $this->mCacheExpiry;
6669
67 - if ( $expire === null )
 70+ if ( $expire === null ) {
6871 $expire = $wgParserCacheExpireTime;
69 - else
 72+ } else {
7073 $expire = min( $expire, $wgParserCacheExpireTime );
 74+ }
7175
7276 if( $this->containsOldMagic() ) { //compatibility hack
7377 $expire = min( $expire, 3600 ); # 1 hour
7478 }
7579
76 - if ( $expire <= 0 ) return 0; // not cachable
77 - else return $expire;
 80+ if ( $expire <= 0 ) {
 81+ return 0; // not cachable
 82+ } else {
 83+ return $expire;
 84+ }
7885 }
7986
80 -
 87+ /**
 88+ * @return bool
 89+ */
8190 function isCacheable() {
8291 return $this->getCacheExpiry() > 0;
8392 }
84 -
 93+
8594 /**
8695 * Return true if this cached output object predates the global or
8796 * per-article cache invalidation timestamps, or if it comes from
Index: trunk/phase3/includes/parser/Preprocessor.php
@@ -9,7 +9,11 @@
1010 * @ingroup Parser
1111 */
1212 interface Preprocessor {
13 - /** Create a new preprocessor object based on an initialised Parser object */
 13+ /**
 14+ * Create a new preprocessor object based on an initialised Parser object
 15+ *
 16+ * @param $parser Parser
 17+ */
1418 function __construct( $parser );
1519
1620 /**
@@ -28,12 +32,19 @@
2933 */
3034 function newCustomFrame( $args );
3135
32 - /** Create a new custom node for programmatic use of parameter replacement as used in some extensions */
 36+ /**
 37+ * Create a new custom node for programmatic use of parameter replacement as used in some extensions
 38+ *
 39+ * @param $values
 40+ */
3341 function newPartNodeArray( $values );
3442
3543 /**
3644 * Preprocess text to a PPNode
3745 *
 46+ * @param $text
 47+ * @param $flags
 48+ *
3849 * @return PPNode
3950 */
4051 function preprocessToObj( $text, $flags = 0 );
@@ -54,6 +65,9 @@
5566 /**
5667 * Create a child frame
5768 *
 69+ * @param $args array
 70+ * @param $title Title
 71+ *
5872 * @return PPFrame
5973 */
6074 function newChild( $args = false, $title = false );
@@ -86,6 +100,8 @@
87101
88102 /**
89103 * Returns true if there are no arguments in this frame
 104+ *
 105+ * @return bool
90106 */
91107 function isEmpty();
92108
@@ -111,6 +127,8 @@
112128
113129 /**
114130 * Returns true if the infinite loop check is OK, false if a loop is detected
 131+ *
 132+ * @return bool
115133 */
116134 function loopCheck( $title );
117135
Index: trunk/phase3/includes/db/LBFactory_Single.php
@@ -15,6 +15,8 @@
1616 }
1717
1818 /**
 19+ * @param $wiki
 20+ *
1921 * @return LoadBalancer_Single
2022 */
2123 function newMainLB( $wiki = false ) {
@@ -22,6 +24,8 @@
2325 }
2426
2527 /**
 28+ * @param $wiki
 29+ *
2630 * @return LoadBalancer_Single
2731 */
2832 function getMainLB( $wiki = false ) {
@@ -29,6 +33,9 @@
3034 }
3135
3236 /**
 37+ * @param $cluster
 38+ * @param $wiki
 39+ *
3340 * @return LoadBalancer_Single
3441 */
3542 function newExternalLB( $cluster, $wiki = false ) {
@@ -36,12 +43,19 @@
3744 }
3845
3946 /**
 47+ * @param $cluster
 48+ * @param $wiki
 49+ *
4050 * @return LoadBalancer_Single
4151 */
4252 function &getExternalLB( $cluster, $wiki = false ) {
4353 return $this->lb;
4454 }
4555
 56+ /**
 57+ * @param $callback string|array
 58+ * @param $params array
 59+ */
4660 function forEachLB( $callback, $params = array() ) {
4761 call_user_func_array( $callback, array_merge( array( $this->lb ), $params ) );
4862 }
@@ -57,6 +71,9 @@
5872 */
5973 var $db;
6074
 75+ /**
 76+ * @param $params array
 77+ */
6178 function __construct( $params ) {
6279 $this->db = $params['connection'];
6380 parent::__construct( array( 'servers' => array( array(
Index: trunk/phase3/includes/filerepo/ForeignDBFile.php
@@ -12,6 +12,13 @@
1313 * @ingroup FileRepo
1414 */
1515 class ForeignDBFile extends LocalFile {
 16+
 17+ /**
 18+ * @param $title
 19+ * @param $repo
 20+ * @param $unused
 21+ * @return ForeignDBFile
 22+ */
1623 static function newFromTitle( $title, $repo, $unused = null ) {
1724 return new self( $title, $repo );
1825 }
@@ -19,6 +26,11 @@
2027 /**
2128 * Create a ForeignDBFile from a title
2229 * Do not call this except from inside a repo class.
 30+ *
 31+ * @param $row
 32+ * @param $repo
 33+ *
 34+ * @return ForeignDBFile
2335 */
2436 static function newFromRow( $row, $repo ) {
2537 $title = Title::makeTitle( NS_FILE, $row->img_name );
@@ -35,21 +47,30 @@
3648 $watch = false, $timestamp = false ) {
3749 $this->readOnlyError();
3850 }
 51+
3952 function restore( $versions = array(), $unsuppress = false ) {
4053 $this->readOnlyError();
4154 }
 55+
4256 function delete( $reason, $suppress = false ) {
4357 $this->readOnlyError();
4458 }
 59+
4560 function move( $target ) {
4661 $this->readOnlyError();
4762 }
48 -
 63+
 64+ /**
 65+ * @return string
 66+ */
4967 function getDescriptionUrl() {
5068 // Restore remote behaviour
5169 return File::getDescriptionUrl();
5270 }
5371
 72+ /**
 73+ * @return string
 74+ */
5475 function getDescriptionText() {
5576 // Restore remote behaviour
5677 return File::getDescriptionText();
Index: trunk/phase3/includes/HTMLForm.php
@@ -861,7 +861,7 @@
862862
863863 /**
864864 * Initialise the object
865 - * @param $params Associative Array. See HTMLForm doc for syntax.
 865+ * @param $params array Associative Array. See HTMLForm doc for syntax.
866866 */
867867 function __construct( $params ) {
868868 $this->mParams = $params;
Index: trunk/phase3/includes/Cdb_PHP.php
@@ -16,6 +16,10 @@
1717 /**
1818 * Take a modulo of a signed integer as if it were an unsigned integer.
1919 * $b must be less than 0x40000000 and greater than 0
 20+ *
 21+ * @param $a
 22+ * @param $b
 23+ *
2024 * @return int
2125 */
2226 public static function unsignedMod( $a, $b ) {
@@ -48,6 +52,7 @@
4953 * The CDB hash function.
5054 *
5155 * @param $s
 56+ *
5257 * @return
5358 */
5459 public static function hash( $s ) {
@@ -116,6 +121,10 @@
117122 unset( $this->handle );
118123 }
119124
 125+ /**
 126+ * @param $key
 127+ * @return bool|string
 128+ */
120129 public function get( $key ) {
121130 // strval is required
122131 if ( $this->find( strval( $key ) ) ) {
@@ -327,6 +336,11 @@
328337 $this->pos = $newpos;
329338 }
330339
 340+ /**
 341+ * @param $keylen
 342+ * @param $datalen
 343+ * @param $h
 344+ */
331345 protected function addend( $keylen, $datalen, $h ) {
332346 $this->hplist[] = array(
333347 'h' => $h,
@@ -355,6 +369,9 @@
356370 $this->write( $buf );
357371 }
358372
 373+ /**
 374+ * @throws MWException
 375+ */
359376 protected function finish() {
360377 // Hack for DBA cross-check
361378 $this->hplist = array_reverse( $this->hplist );
Index: trunk/phase3/includes/media/Tiff.php
@@ -17,6 +17,8 @@
1818 * Conversion to PNG for inline display can be disabled here...
1919 * Note scaling should work with ImageMagick, but may not with GD scaling.
2020 *
 21+ * @param $file
 22+ *
2123 * @return bool
2224 */
2325 function canRender( $file ) {
@@ -28,6 +30,8 @@
2931 * Browsers don't support TIFF inline generally...
3032 * For inline display, we need to convert to PNG.
3133 *
 34+ * @param $file
 35+ *
3236 * @return bool
3337 */
3438 function mustRender( $file ) {
@@ -35,9 +39,9 @@
3640 }
3741
3842 /**
39 - * @param $ext
40 - * @param $mime
41 - * @param null $params
 43+ * @param $ext
 44+ * @param $mime
 45+ * @param $params
4246 * @return bool
4347 */
4448 function getThumbType( $ext, $mime, $params = null ) {
Index: trunk/phase3/includes/HistoryBlob.php
@@ -290,6 +290,8 @@
291291 /**
292292 * Sets the location (cur_id) of the main object to which this object
293293 * points
 294+ *
 295+ * @param $id int
294296 */
295297 function setLocation( $id ) {
296298 $this->mCurId = $id;
@@ -482,6 +484,11 @@
483485 }
484486 }
485487
 488+ /**
 489+ * @param $t1
 490+ * @param $t2
 491+ * @return string
 492+ */
486493 function diff( $t1, $t2 ) {
487494 # Need to do a null concatenation with warnings off, due to bugs in the current version of xdiff
488495 # "String is not zero-terminated"
@@ -491,6 +498,11 @@
492499 return $diff;
493500 }
494501
 502+ /**
 503+ * @param $base
 504+ * @param $diff
 505+ * @return bool|string
 506+ */
495507 function patch( $base, $diff ) {
496508 if ( function_exists( 'xdiff_string_bpatch' ) ) {
497509 wfSuppressWarnings();
@@ -561,6 +573,9 @@
562574 }
563575 }
564576
 577+ /**
 578+ * @return array
 579+ */
565580 function __sleep() {
566581 $this->compress();
567582 if ( !count( $this->mItems ) ) {
@@ -626,6 +641,8 @@
627642 /**
628643 * Helper function for compression jobs
629644 * Returns true until the object is "full" and ready to be committed
 645+ *
 646+ * @return bool
630647 */
631648 function isHappy() {
632649 return $this->mSize < $this->mMaxSize

Status & tagging log