X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Flibs%2Ffilebackend%2FMemoryFileBackend.php;h=f3bbecb8141cce657c50a3f432ebb2c1b1749cc5;hp=88b281e3805bf24dc688b6c4b9c6cfb0584f09c6;hb=e390198c4e4be7632b01173e42050061f1cc346a;hpb=32a07dfb3efee9e93dcc252aa87e944ef3791c7c diff --git a/includes/libs/filebackend/MemoryFileBackend.php b/includes/libs/filebackend/MemoryFileBackend.php index 88b281e380..f3bbecb814 100644 --- a/includes/libs/filebackend/MemoryFileBackend.php +++ b/includes/libs/filebackend/MemoryFileBackend.php @@ -41,7 +41,7 @@ class MemoryFileBackend extends FileBackendStore { } public function isPathUsableInternal( $storagePath ) { - return true; + return ( $this->resolveHashKey( $storagePath ) !== null ); } protected function doCreateInternal( array $params ) { @@ -148,7 +148,7 @@ class MemoryFileBackend extends FileBackendStore { protected function doGetFileStat( array $params ) { $src = $this->resolveHashKey( $params['src'] ); if ( $src === null ) { - return false; // invalid path + return self::$RES_ERROR; // invalid path } if ( isset( $this->files[$src] ) ) { @@ -158,15 +158,17 @@ class MemoryFileBackend extends FileBackendStore { ]; } - return false; + return self::$RES_ABSENT; } protected function doGetLocalCopyMulti( array $params ) { $tmpFiles = []; // (path => TempFSFile) foreach ( $params['srcs'] as $srcPath ) { $src = $this->resolveHashKey( $srcPath ); - if ( $src === null || !isset( $this->files[$src] ) ) { - $fsFile = null; + if ( $src === null ) { + $fsFile = self::$RES_ERROR; + } elseif ( !isset( $this->files[$src] ) ) { + $fsFile = self::$RES_ABSENT; } else { // Create a new temporary file with the same extension... $ext = FileBackend::extensionFromPath( $src ); @@ -174,7 +176,7 @@ class MemoryFileBackend extends FileBackendStore { if ( $fsFile ) { $bytes = file_put_contents( $fsFile->getPath(), $this->files[$src]['data'] ); if ( $bytes !== strlen( $this->files[$src]['data'] ) ) { - $fsFile = null; + $fsFile = self::$RES_ERROR; } } }