From: Aryeh Gregor Date: Sun, 24 Jun 2007 06:32:07 +0000 (+0000) Subject: E_STRICT fixes for filerepo stuff. Also, use 'abstract' keyword for File class,... X-Git-Tag: 1.31.0-rc.0~52425 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=ce84509f0b58b63874a9ea154c9ca56cb1750958;p=lhc%2Fweb%2Fwiklou.git 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(). --- diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index 1ddb7f1d27..4e97d0bcea 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -1,8 +1,6 @@ name ) ) { $this->name = $this->repo->getNameFromTitle( $this->title ); } @@ -200,9 +197,8 @@ class File { * * STUB * Overridden by LocalFile, UnregisteredLocalFile - * @public */ - function getWidth( $page = 1 ) { return false; } + public function getWidth( $page = 1 ) { return false; } /** * Return the height of the image. Returns false if the height is unknown @@ -210,24 +206,22 @@ class File { * * STUB * Overridden by LocalFile, UnregisteredLocalFile - * @public */ - function getHeight( $page = 1 ) { return false; } + public function getHeight( $page = 1 ) { return false; } /** * Get handler-specific metadata * Overridden by LocalFile, UnregisteredLocalFile * STUB */ - function getMetadata() { return false; } + public function getMetadata() { return false; } /** * Return the size of the image file, in bytes * Overridden by LocalFile, UnregisteredLocalFile * STUB - * @public */ - function getSize() { return false; } + public function getSize() { return false; } /** * Returns the mime type of the file. @@ -357,9 +351,8 @@ class File { * Overridden by LocalFile to avoid unnecessary stat calls. * * @return boolean Whether file exists in the repository. - * @public */ - function exists() { + public function exists() { return $this->getPath() && file_exists( $this->path ); } @@ -399,9 +392,8 @@ class File { * Return the file name of a thumbnail with the specified parameters * * @param array $params Handler-specific parameters - * @private */ - function thumbName( $params ) { + protected function thumbName( $params ) { if ( !$this->getHandler() ) { return null; } @@ -428,9 +420,8 @@ class File { * * @param integer $width maximum width of the generated thumbnail * @param integer $height maximum height of the image (optional) - * @public */ - function createThumb( $width, $height = -1 ) { + public function createThumb( $width, $height = -1 ) { $params = array( 'width' => $width ); if ( $height != -1 ) { $params['height'] = $height; @@ -453,11 +444,10 @@ class File { * false to just return the URL * * @return ThumbnailImage or null on failure - * @public * * @deprecated use transform() */ - function getThumbnail( $width, $height=-1, $render = true ) { + public function getThumbnail( $width, $height=-1, $render = true ) { $params = array( 'width' => $width ); if ( $height != -1 ) { $params['height'] = $height; @@ -535,7 +525,7 @@ class File { * STUB * Overridden by LocalFile */ - function migrateThumbFile() {} + function migrateThumbFile( $thumbName ) {} /** * Get a MediaHandler instance for this file @@ -624,21 +614,19 @@ class File { * then old versions. Should return an object similar to an image/oldimage * database row. * - * @public * STUB * Overridden in LocalFile */ - function nextHistoryLine() { + public function nextHistoryLine() { return false; } /** * Reset the history pointer to the first element of the history - * @public * STUB * Overridden in LocalFile. */ - function resetHistory() {} + public function resetHistory() {} /** * Get the filename hash component of the directory including trailing slash, diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index d82031763c..cb73fc6278 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -484,7 +484,7 @@ class LocalFile extends File /** * Delete all previously generated thumbnails, refresh metadata in memcached and purge the squid */ - function purgeCache() { + function purgeCache( $archiveFiles = array() ) { // Refresh metadata cache $this->purgeMetadataCache(); diff --git a/includes/filerepo/UnregisteredLocalFile.php b/includes/filerepo/UnregisteredLocalFile.php index ca4dbc4c7c..3a840fb851 100644 --- a/includes/filerepo/UnregisteredLocalFile.php +++ b/includes/filerepo/UnregisteredLocalFile.php @@ -72,7 +72,7 @@ class UnregisteredLocalFile extends File { return $this->mime; } - function getImageSize() { + function getImageSize( $filename ) { if ( !$this->getHandler() ) { return false; } @@ -105,5 +105,7 @@ class UnregisteredLocalFile extends File { return false; } } + + function getMediaType() { return MEDIATYPE_UNKNOWN; } } ?>