mark a non-API function private; rename it to reflect what it does; call getPath...
authorRuss Nelson <nelson@users.mediawiki.org>
Tue, 19 Jul 2011 03:44:28 +0000 (03:44 +0000)
committerRuss Nelson <nelson@users.mediawiki.org>
Tue, 19 Jul 2011 03:44:28 +0000 (03:44 +0000)
includes/filerepo/README
includes/filerepo/UnregisteredLocalFile.php

index db46ff8..415b8d1 100644 (file)
@@ -48,7 +48,7 @@ File.php defines an abstract class File.
         ForeignDBFile.php extends LocalFile
         Image.php extends LocalFile
     UnregisteredLocalFile.php extends File.
-FileRepo.php defined an abstract class FileRepo.
+FileRepo.php defines an abstract class FileRepo.
     ForeignAPIRepo.php extends FileRepo
     FSRepo extends FileRepo
         LocalRepo.php extends FSRepo
@@ -57,3 +57,4 @@ FileRepo.php defined an abstract class FileRepo.
     NullRepo extends FileRepo
 
 Russ Nelson, March 2011
+
index 2df9a9b..3922a0d 100644 (file)
@@ -74,7 +74,7 @@ class UnregisteredLocalFile extends File {
                $this->dims = array();
        }
 
-       function getPageDimensions( $page = 1 ) {
+       private function cachePageDimensions( $page = 1 ) {
                if ( !isset( $this->dims[$page] ) ) {
                        if ( !$this->getHandler() ) {
                                return false;
@@ -85,19 +85,19 @@ class UnregisteredLocalFile extends File {
        }
 
        function getWidth( $page = 1 ) {
-               $dim = $this->getPageDimensions( $page );
+               $dim = $this->cachePageDimensions( $page );
                return $dim['width'];
        }
 
        function getHeight( $page = 1 ) {
-               $dim = $this->getPageDimensions( $page );
+               $dim = $this->cachePageDimensions( $page );
                return $dim['height'];
        }
 
        function getMimeType() {
                if ( !isset( $this->mime ) ) {
                        $magic = MimeMagic::singleton();
-                       $this->mime = $magic->guessMimeType( $this->path );
+                       $this->mime = $magic->guessMimeType( $this->getPath() );
                }
                return $this->mime;
        }