From 4015ab5a15fe04a419c17f154223a94fa4faa3ff Mon Sep 17 00:00:00 2001 From: Russ Nelson Date: Tue, 19 Jul 2011 03:44:28 +0000 Subject: [PATCH] mark a non-API function private; rename it to reflect what it does; call getPath() rather than accessing object variable directly --- includes/filerepo/README | 3 ++- includes/filerepo/UnregisteredLocalFile.php | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/filerepo/README b/includes/filerepo/README index db46ff8ab6..415b8d1d94 100644 --- a/includes/filerepo/README +++ b/includes/filerepo/README @@ -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 + diff --git a/includes/filerepo/UnregisteredLocalFile.php b/includes/filerepo/UnregisteredLocalFile.php index 2df9a9b5d2..3922a0d753 100644 --- a/includes/filerepo/UnregisteredLocalFile.php +++ b/includes/filerepo/UnregisteredLocalFile.php @@ -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; } -- 2.20.1