r23313 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23312‎ | r23313 | r23314 >
Date:06:32, 24 June 2007
Author:simetrical
Status:old
Tags:
Comment:
E_STRICT fixes for filerepo stuff. Also, use 'abstract' keyword for File class, and mark some public methods public (and one private method protected, which I think is what was meant but no harm if private was actually meant). Couldn't fix the non-matching declarations of Image::newFromTitle() and LocalFile::newFromTitle().
Modified paths:
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/UnregisteredLocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -484,7 +484,7 @@
485485 /**
486486 * Delete all previously generated thumbnails, refresh metadata in memcached and purge the squid
487487 */
488 - function purgeCache() {
 488+ function purgeCache( $archiveFiles = array() ) {
489489 // Refresh metadata cache
490490 $this->purgeMetadataCache();
491491
Index: trunk/phase3/includes/filerepo/UnregisteredLocalFile.php
@@ -72,7 +72,7 @@
7373 return $this->mime;
7474 }
7575
76 - function getImageSize() {
 76+ function getImageSize( $filename ) {
7777 if ( !$this->getHandler() ) {
7878 return false;
7979 }
@@ -105,5 +105,7 @@
106106 return false;
107107 }
108108 }
 109+
 110+ function getMediaType() { return MEDIATYPE_UNKNOWN; }
109111 }
110112 ?>
Index: trunk/phase3/includes/filerepo/File.php
@@ -1,8 +1,6 @@
22 <?php
33
44 /**
5 - * Base file class. Do not instantiate.
6 - *
75 * Implements some public methods and some protected utility functions which
86 * are required by multiple child classes. Contains stub functionality for
97 * unimplemented public methods.
@@ -21,7 +19,7 @@
2220 *
2321 * @addtogroup FileRepo
2422 */
25 -class File {
 23+abstract class File {
2624 const DELETED_FILE = 1;
2725 const DELETED_COMMENT = 2;
2826 const DELETED_USER = 4;
@@ -115,9 +113,8 @@
116114
117115 /**
118116 * Return the name of this file
119 - * @public
120117 */
121 - function getName() {
 118+ public function getName() {
122119 if ( !isset( $this->name ) ) {
123120 $this->name = $this->repo->getNameFromTitle( $this->title );
124121 }
@@ -200,9 +197,8 @@
201198 *
202199 * STUB
203200 * Overridden by LocalFile, UnregisteredLocalFile
204 - * @public
205201 */
206 - function getWidth( $page = 1 ) { return false; }
 202+ public function getWidth( $page = 1 ) { return false; }
207203
208204 /**
209205 * Return the height of the image. Returns false if the height is unknown
@@ -210,24 +206,22 @@
211207 *
212208 * STUB
213209 * Overridden by LocalFile, UnregisteredLocalFile
214 - * @public
215210 */
216 - function getHeight( $page = 1 ) { return false; }
 211+ public function getHeight( $page = 1 ) { return false; }
217212
218213 /**
219214 * Get handler-specific metadata
220215 * Overridden by LocalFile, UnregisteredLocalFile
221216 * STUB
222217 */
223 - function getMetadata() { return false; }
 218+ public function getMetadata() { return false; }
224219
225220 /**
226221 * Return the size of the image file, in bytes
227222 * Overridden by LocalFile, UnregisteredLocalFile
228223 * STUB
229 - * @public
230224 */
231 - function getSize() { return false; }
 225+ public function getSize() { return false; }
232226
233227 /**
234228 * Returns the mime type of the file.
@@ -357,9 +351,8 @@
358352 * Overridden by LocalFile to avoid unnecessary stat calls.
359353 *
360354 * @return boolean Whether file exists in the repository.
361 - * @public
362355 */
363 - function exists() {
 356+ public function exists() {
364357 return $this->getPath() && file_exists( $this->path );
365358 }
366359
@@ -399,9 +392,8 @@
400393 * Return the file name of a thumbnail with the specified parameters
401394 *
402395 * @param array $params Handler-specific parameters
403 - * @private
404396 */
405 - function thumbName( $params ) {
 397+ protected function thumbName( $params ) {
406398 if ( !$this->getHandler() ) {
407399 return null;
408400 }
@@ -428,9 +420,8 @@
429421 *
430422 * @param integer $width maximum width of the generated thumbnail
431423 * @param integer $height maximum height of the image (optional)
432 - * @public
433424 */
434 - function createThumb( $width, $height = -1 ) {
 425+ public function createThumb( $width, $height = -1 ) {
435426 $params = array( 'width' => $width );
436427 if ( $height != -1 ) {
437428 $params['height'] = $height;
@@ -453,11 +444,10 @@
454445 * false to just return the URL
455446 *
456447 * @return ThumbnailImage or null on failure
457 - * @public
458448 *
459449 * @deprecated use transform()
460450 */
461 - function getThumbnail( $width, $height=-1, $render = true ) {
 451+ public function getThumbnail( $width, $height=-1, $render = true ) {
462452 $params = array( 'width' => $width );
463453 if ( $height != -1 ) {
464454 $params['height'] = $height;
@@ -535,7 +525,7 @@
536526 * STUB
537527 * Overridden by LocalFile
538528 */
539 - function migrateThumbFile() {}
 529+ function migrateThumbFile( $thumbName ) {}
540530
541531 /**
542532 * Get a MediaHandler instance for this file
@@ -624,21 +614,19 @@
625615 * then old versions. Should return an object similar to an image/oldimage
626616 * database row.
627617 *
628 - * @public
629618 * STUB
630619 * Overridden in LocalFile
631620 */
632 - function nextHistoryLine() {
 621+ public function nextHistoryLine() {
633622 return false;
634623 }
635624
636625 /**
637626 * Reset the history pointer to the first element of the history
638 - * @public
639627 * STUB
640628 * Overridden in LocalFile.
641629 */
642 - function resetHistory() {}
 630+ public function resetHistory() {}
643631
644632 /**
645633 * Get the filename hash component of the directory including trailing slash,

Follow-up revisions

RevisionCommit summaryAuthorDate
r23407Merged revisions 23203-23405 via svnmerge from...david23:00, 25 June 2007

Status & tagging log