X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Ffilebackend%2FFileBackendStore.php;h=9bfdbe8cd6daee72b6248ce7080137564858314c;hb=7babd362babcbf7f20adb8e12edb4f4bc1d4249f;hp=039bd4250874b1d48bba2b7fc6c05df5eb7497ba;hpb=2dd58ade75d15a5895c0c010e17b6f729a0f72fe;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/filebackend/FileBackendStore.php b/includes/libs/filebackend/FileBackendStore.php index 039bd42508..da8b4ce9da 100644 --- a/includes/libs/filebackend/FileBackendStore.php +++ b/includes/libs/filebackend/FileBackendStore.php @@ -19,7 +19,6 @@ * * @file * @ingroup FileBackend - * @author Aaron Schulz */ use Wikimedia\Timestamp\ConvertibleTimestamp; @@ -1009,13 +1008,13 @@ abstract class FileBackendStore extends FileBackend { */ final public function getOperationsInternal( array $ops ) { $supportedOps = [ - 'store' => 'StoreFileOp', - 'copy' => 'CopyFileOp', - 'move' => 'MoveFileOp', - 'delete' => 'DeleteFileOp', - 'create' => 'CreateFileOp', - 'describe' => 'DescribeFileOp', - 'null' => 'NullFileOp' + 'store' => StoreFileOp::class, + 'copy' => CopyFileOp::class, + 'move' => MoveFileOp::class, + 'delete' => DeleteFileOp::class, + 'create' => CreateFileOp::class, + 'describe' => DescribeFileOp::class, + 'null' => NullFileOp::class ]; $performOps = []; // array of FileOp objects @@ -1715,7 +1714,7 @@ abstract class FileBackendStore extends FileBackend { return; // invalid storage path } $mtime = ConvertibleTimestamp::convert( TS_UNIX, $val['mtime'] ); - $ttl = $this->memCache->adaptiveTTL( $mtime, 7 * 86400, 300, .1 ); + $ttl = $this->memCache->adaptiveTTL( $mtime, 7 * 86400, 300, 0.1 ); $key = $this->fileCacheKey( $path ); // Set the cache unless it is currently salted. $this->memCache->set( $key, $val, $ttl ); @@ -1841,14 +1840,8 @@ abstract class FileBackendStore extends FileBackend { return call_user_func_array( $this->mimeCallback, func_get_args() ); } - $mime = null; - if ( $fsPath !== null && function_exists( 'finfo_file' ) ) { - $finfo = finfo_open( FILEINFO_MIME_TYPE ); - $mime = finfo_file( $finfo, $fsPath ); - finfo_close( $finfo ); - } - - return is_string( $mime ) ? $mime : 'unknown/unknown'; + $mime = ( $fsPath !== null ) ? mime_content_type( $fsPath ) : false; + return $mime ?: 'unknown/unknown'; } }