r107308 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107307‎ | r107308 | r107309 >
Date:23:57, 25 December 2011
Author:mah
Status:ok
Tags:
Comment:
w/s
Modified paths:
  • /branches/REL1_18/phase3/includes/filerepo/File.php (modified) (history)
  • /branches/REL1_18/phase3/includes/media/GIF.php (modified) (history)
  • /branches/REL1_18/phase3/includes/media/Generic.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/includes/filerepo/File.php
@@ -117,7 +117,7 @@
118118 *
119119 * @param $old File Old file
120120 * @param $new string New name
121 - *
 121+ *
122122 * @return bool|null
123123 */
124124 static function checkExtensionCompatibility( File $old, $new ) {
@@ -217,7 +217,7 @@
218218 public function getFullUrl() {
219219 return wfExpandUrl( $this->getUrl(), PROTO_RELATIVE );
220220 }
221 -
 221+
222222 public function getCanonicalUrl() {
223223 return wfExpandUrl( $this->getUrl(), PROTO_CANONICAL );
224224 }
@@ -475,7 +475,7 @@
476476
477477 /**
478478 * Accessor for __get()
479 - *
 479+ *
480480 * @return bool
481481 */
482482 protected function getIsSafeFile() {
@@ -891,10 +891,10 @@
892892
893893 /**
894894 * Get the relative path for an archived file
895 - *
 895+ *
896896 * @param $suffix bool|string if not false, the name of an archived thumbnail file
897897 *
898 - * @return string
 898+ * @return string
899899 */
900900 function getArchiveRel( $suffix = false ) {
901901 $path = 'archive/' . $this->getHashPath();
@@ -909,7 +909,7 @@
910910 /**
911911 * Get the relative path for an archived file's thumbs directory
912912 * or a specific thumb if the $suffix is given.
913 - *
 913+ *
914914 * @param $archiveName string the timestamped name of an archived image
915915 * @param $suffix bool|string if not false, the name of a thumbnail file
916916 */
Index: branches/REL1_18/phase3/includes/media/GIF.php
@@ -14,7 +14,7 @@
1515 class GIFHandler extends BitmapHandler {
1616
1717 const BROKEN_FILE = '0'; // value to store in img_metadata if error extracting metadata.
18 -
 18+
1919 function getMetadata( $image, $filename ) {
2020 try {
2121 $parsedGIFMetadata = BitmapMetadataHandler::GIF( $filename );
@@ -118,7 +118,7 @@
119119 wfSuppressWarnings();
120120 $metadata = unserialize($image->getMetadata());
121121 wfRestoreWarnings();
122 -
 122+
123123 if (!$metadata || $metadata['frameCount'] <= 1) {
124124 return $original;
125125 }
@@ -126,19 +126,19 @@
127127 /* Preserve original image info string, but strip the last char ')' so we can add even more */
128128 $info = array();
129129 $info[] = $original;
130 -
 130+
131131 if ( $metadata['looped'] ) {
132132 $info[] = wfMsgExt( 'file-info-gif-looped', 'parseinline' );
133133 }
134 -
 134+
135135 if ( $metadata['frameCount'] > 1 ) {
136136 $info[] = wfMsgExt( 'file-info-gif-frames', 'parseinline', $metadata['frameCount'] );
137137 }
138 -
 138+
139139 if ( $metadata['duration'] ) {
140140 $info[] = $wgLang->formatTimePeriod( $metadata['duration'] );
141141 }
142 -
 142+
143143 return $wgLang->commaList( $info );
144144 }
145145 }
Index: branches/REL1_18/phase3/includes/media/Generic.php
@@ -570,43 +570,43 @@
571571
572572 $srcWidth = $image->getWidth( $params['page'] );
573573 $srcHeight = $image->getHeight( $params['page'] );
574 -
 574+
575575 if ( isset( $params['height'] ) && $params['height'] != -1 ) {
576576 # Height & width were both set
577577 if ( $params['width'] * $srcHeight > $params['height'] * $srcWidth ) {
578578 # Height is the relative smaller dimension, so scale width accordingly
579579 $params['width'] = wfFitBoxWidth( $srcWidth, $srcHeight, $params['height'] );
580 -
 580+
581581 if ( $params['width'] == 0 ) {
582582 # Very small image, so we need to rely on client side scaling :(
583583 $params['width'] = 1;
584584 }
585 -
 585+
586586 $params['physicalWidth'] = $params['width'];
587587 } else {
588588 # Height was crap, unset it so that it will be calculated later
589589 unset( $params['height'] );
590590 }
591591 }
592 -
 592+
593593 if ( !isset( $params['physicalWidth'] ) ) {
594594 # Passed all validations, so set the physicalWidth
595595 $params['physicalWidth'] = $params['width'];
596596 }
597 -
 597+
598598 # Because thumbs are only referred to by width, the height always needs
599599 # to be scaled by the width to keep the thumbnail sizes consistent,
600600 # even if it was set inside the if block above
601 - $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight,
 601+ $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight,
602602 $params['physicalWidth'] );
603603
604 - # Set the height if it was not validated in the if block higher up
 604+ # Set the height if it was not validated in the if block higher up
605605 if ( !isset( $params['height'] ) || $params['height'] == -1 ) {
606606 $params['height'] = $params['physicalHeight'];
607607 }
608608
609 -
610 - if ( !$this->validateThumbParams( $params['physicalWidth'],
 609+
 610+ if ( !$this->validateThumbParams( $params['physicalWidth'],
611611 $params['physicalHeight'], $srcWidth, $srcHeight, $mimeType ) ) {
612612 return false;
613613 }

Status & tagging log