This part of the API seems universally ignored. If anybody needs this, they're going...
[lhc/web/wiklou.git] / includes / filerepo / File.php
index 1fed356..c8b1cde 100644 (file)
@@ -229,7 +229,6 @@ abstract class File {
        * i.e. whether the files are all found in the same directory,
        * or in hashed paths like /images/3/3c.
        *
-       * May return false if the file is not locally accessible.
        */
        public function getPath() {
                if ( !isset( $this->path ) ) {
@@ -240,8 +239,11 @@ abstract class File {
 
        /**
        * Alias for getPath()
+       *
+       * @deprecated Use getPath().
        */
        public function getFullPath() {
+               wfDeprecated( __METHOD__ );
                return $this->getPath();
        }
 
@@ -303,6 +305,26 @@ abstract class File {
         */
        public function getMetadata() { return false; }
 
+       /**
+       * get versioned metadata
+       *
+       * @param $metadata Mixed Array or String of (serialized) metadata
+       * @param $version integer version number.
+       * @return Array containing metadata, or what was passed to it on fail (unserializing if not array)
+       */
+       public function convertMetadataVersion($metadata, $version) {
+               $handler = $this->getHandler();
+               if ( !is_array( $metadata ) ) {
+                       //just to make the return type consistant
+                       $metadata = unserialize( $metadata ); 
+               }
+               if ( $handler ) {
+                       return $handler->convertMetadataVersion( $metadata, $version );
+               } else {
+                       return $metadata;
+               }
+       }
+
        /**
         * Return the bit depth of the file
         * Overridden by LocalFile
@@ -538,30 +560,6 @@ abstract class File {
                return $thumb->getUrl();
        }
 
-       /**
-        * As createThumb, but returns a ThumbnailImage object. This can
-        * provide access to the actual file, the real size of the thumb,
-        * and can produce a convenient \<img\> tag for you.
-        *
-        * For non-image formats, this may return a filetype-specific icon.
-        *
-        * @param $width Integer: maximum width of the generated thumbnail
-        * @param $height Integer: maximum height of the image (optional)
-        * @param $render Integer: Deprecated
-        *
-        * @return ThumbnailImage or null on failure
-        *
-        * @deprecated use transform()
-        */
-       public function getThumbnail( $width, $height=-1, $render = true ) {
-               wfDeprecated( __METHOD__ );
-               $params = array( 'width' => $width );
-               if ( $height != -1 ) {
-                       $params['height'] = $height;
-               }
-               return $this->transform( $params, 0 );
-       }
-
        /**
         * Transform a media file
         *
@@ -1331,8 +1329,9 @@ abstract class File {
        
        function getRedirectedTitle() {
                if ( $this->redirected ) {
-                       if ( !$this->redirectTitle )
+                       if ( !$this->redirectTitle ) {
                                $this->redirectTitle = Title::makeTitle( NS_FILE, $this->redirected );
+                       }
                        return $this->redirectTitle;
                }
        }