X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilebackend%2FFileBackend.php;h=f99da6dbc7950214f1caf270f49e172c1759f121;hb=06db1a2335826d7da5da2a47ddec44a08094376d;hp=716ab6e4492f25ca809de7c9ccaf403b6cd20149;hpb=96b04cef361c26bbc6b76be6afbf298e4d22fed3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filebackend/FileBackend.php b/includes/filebackend/FileBackend.php index 716ab6e449..f99da6dbc7 100644 --- a/includes/filebackend/FileBackend.php +++ b/includes/filebackend/FileBackend.php @@ -207,7 +207,7 @@ abstract class FileBackend { /** * Get the a bitfield of extra features supported by the backend medium * - * @return integer Bitfield of FileBackend::ATTR_* flags + * @return int Bitfield of FileBackend::ATTR_* flags * @since 1.23 */ public function getFeatures() { @@ -217,7 +217,7 @@ abstract class FileBackend { /** * Check if the backend medium supports a field of extra features * - * @return integer Bitfield of FileBackend::ATTR_* flags + * @return int Bitfield of FileBackend::ATTR_* flags * @return bool * @since 1.23 */ @@ -941,7 +941,7 @@ abstract class FileBackend { * $params include: * - src : source storage path * - latest : use the latest available data - * @return Array|bool Returns false on failure + * @return array|bool Returns false on failure * @since 1.23 */ abstract public function getFileXAttributes( array $params ); @@ -1128,7 +1128,7 @@ abstract class FileBackend { * @param array $params Parameters include: * - dir : storage directory * - topOnly : only return direct child dirs of the directory - * @return Traversable|Array|null Returns null on failure + * @return Traversable|array|null Returns null on failure * @since 1.20 */ abstract public function getDirectoryList( array $params ); @@ -1143,7 +1143,7 @@ abstract class FileBackend { * * @param array $params Parameters include: * - dir : storage directory - * @return Traversable|Array|null Returns null on failure + * @return Traversable|array|null Returns null on failure * @since 1.20 */ final public function getTopDirectoryList( array $params ) { @@ -1166,7 +1166,7 @@ abstract class FileBackend { * - dir : storage directory * - topOnly : only return direct child files of the directory (since 1.20) * - adviseStat : set to true if stat requests will be made on the files (since 1.22) - * @return Traversable|Array|null Returns null on failure + * @return Traversable|array|null Returns null on failure */ abstract public function getFileList( array $params ); @@ -1181,7 +1181,7 @@ abstract class FileBackend { * @param array $params Parameters include: * - dir : storage directory * - adviseStat : set to true if stat requests will be made on the files (since 1.22) - * @return Traversable|Array|null Returns null on failure + * @return Traversable|array|null Returns null on failure * @since 1.20 */ final public function getTopFileList( array $params ) { @@ -1196,8 +1196,7 @@ abstract class FileBackend { * * @param array $paths Storage paths */ - public function preloadCache( array $paths ) { - } + abstract public function preloadCache( array $paths ); /** * Invalidate any in-process file stat and property cache. @@ -1207,8 +1206,7 @@ abstract class FileBackend { * * @param array $paths Storage paths (optional) */ - public function clearCache( array $paths = null ) { - } + abstract public function clearCache( array $paths = null ); /** * Preload file stat information (concurrently if possible) into in-process cache. @@ -1219,10 +1217,10 @@ abstract class FileBackend { * @param array $params Parameters include: * - srcs : list of source storage paths * - latest : use the latest available data + * @return bool All requests proceeded without I/O errors (since 1.24) * @since 1.23 */ - public function preloadFileStat( array $params ) { - } + abstract public function preloadFileStat( array $params ); /** * Lock the files at the given storage paths in the backend. @@ -1404,12 +1402,20 @@ abstract class FileBackend { * Get the final extension from a storage or FS path * * @param string $path + * @param string $case One of (rawcase, uppercase, lowercase) (since 1.24) * @return string */ - final public static function extensionFromPath( $path ) { + final public static function extensionFromPath( $path, $case = 'lowercase' ) { $i = strrpos( $path, '.' ); + $ext = $i ? substr( $path, $i + 1 ) : ''; + + if ( $case === 'lowercase' ) { + $ext = strtolower( $ext ); + } elseif ( $case === 'uppercase' ) { + $ext = strtoupper( $ext ); + } - return strtolower( $i ? substr( $path, $i + 1 ) : '' ); + return $ext; } /**