X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilebackend%2FFSFile.php;h=3a0aa9747db2c36b3d0e66b3268ab1798f33d15a;hb=075b90235e86de663c000db2c90253509bb97375;hp=8f0a13347e43464ae605c7174b07271422bba13c;hpb=94f26422ef97a30e602d99c083cd525dbbaa4f6a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filebackend/FSFile.php b/includes/filebackend/FSFile.php index 8f0a13347e..3a0aa9747d 100644 --- a/includes/filebackend/FSFile.php +++ b/includes/filebackend/FSFile.php @@ -27,8 +27,11 @@ * @ingroup FileBackend */ class FSFile { - protected $path; // path to file - protected $sha1Base36; // file SHA-1 in base 36 + /** @var string Path to file */ + protected $path; + + /** @var string File SHA-1 in base 36 */ + protected $sha1Base36; /** * Sets up the file object @@ -82,6 +85,7 @@ class FSFile { if ( $timestamp !== false ) { $timestamp = wfTimestamp( TS_MW, $timestamp ); } + return $timestamp; } @@ -98,7 +102,7 @@ class FSFile { * Get an associative array containing information about * a file with the given storage path. * - * @param Mixed $ext: the file extension, or true to extract it from the filename. + * @param mixed $ext The file extension, or true to extract it from the filename. * Set it to false to ignore the extension. * * @return array @@ -147,13 +151,14 @@ class FSFile { } wfProfileOut( __METHOD__ ); + return $info; } /** * Placeholder file properties to use for files that don't exist * - * @return Array + * @return array */ public static function placeholderProps() { $info = array(); @@ -165,6 +170,7 @@ class FSFile { $info['width'] = 0; $info['height'] = 0; $info['bits'] = 0; + return $info; } @@ -172,7 +178,7 @@ class FSFile { * Exract image size information * * @param array $gis - * @return Array + * @return array */ protected function extractImageSizeInfo( array $gis ) { $info = array(); @@ -184,6 +190,7 @@ class FSFile { } else { $info['bits'] = 0; } + return $info; } @@ -202,6 +209,7 @@ class FSFile { if ( $this->sha1Base36 !== null && !$recache ) { wfProfileOut( __METHOD__ ); + return $this->sha1Base36; } @@ -214,6 +222,7 @@ class FSFile { } wfProfileOut( __METHOD__ ); + return $this->sha1Base36; } @@ -225,6 +234,7 @@ class FSFile { */ public static function extensionFromPath( $path ) { $i = strrpos( $path, '.' ); + return strtolower( $i ? substr( $path, $i + 1 ) : '' ); } @@ -232,12 +242,13 @@ class FSFile { * Get an associative array containing information about a file in the local filesystem. * * @param string $path absolute local filesystem path - * @param Mixed $ext: the file extension, or true to extract it from the filename. - * Set it to false to ignore the extension. + * @param mixed $ext The file extension, or true to extract it from the filename. + * Set it to false to ignore the extension. * @return array */ public static function getPropsFromPath( $path, $ext = true ) { $fsFile = new self( $path ); + return $fsFile->getProps( $ext ); } @@ -253,6 +264,7 @@ class FSFile { */ public static function getSha1Base36FromPath( $path ) { $fsFile = new self( $path ); + return $fsFile->getSha1Base36(); } }