X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilebackend%2FMemoryFileBackend.php;h=7c2f8256ca38e03d5ddf75ccc56d677417a9b953;hb=9f1afadcbc6b6fb592d3e68b0250ee4298fba7bf;hp=6f40957a6e65bda8251710f3ddefa7b3373ed762;hpb=ef92af800a83de51465dd5995897a34f21e19583;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filebackend/MemoryFileBackend.php b/includes/filebackend/MemoryFileBackend.php index 6f40957a6e..7c2f8256ca 100644 --- a/includes/filebackend/MemoryFileBackend.php +++ b/includes/filebackend/MemoryFileBackend.php @@ -45,11 +45,12 @@ class MemoryFileBackend extends FileBackendStore { $dst = $this->resolveHashKey( $params['dst'] ); if ( $dst === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); + return $status; } $this->files[$dst] = array( - 'data' => $params['content'], + 'data' => $params['content'], 'mtime' => wfTimestamp( TS_MW, time() ) ); @@ -62,6 +63,7 @@ class MemoryFileBackend extends FileBackendStore { $dst = $this->resolveHashKey( $params['dst'] ); if ( $dst === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); + return $status; } @@ -70,11 +72,12 @@ class MemoryFileBackend extends FileBackendStore { wfRestoreWarnings(); if ( $data === false ) { // source doesn't exist? $status->fatal( 'backend-fail-store', $params['src'], $params['dst'] ); + return $status; } $this->files[$dst] = array( - 'data' => $data, + 'data' => $data, 'mtime' => wfTimestamp( TS_MW, time() ) ); @@ -87,12 +90,14 @@ class MemoryFileBackend extends FileBackendStore { $src = $this->resolveHashKey( $params['src'] ); if ( $src === null ) { $status->fatal( 'backend-fail-invalidpath', $params['src'] ); + return $status; } $dst = $this->resolveHashKey( $params['dst'] ); if ( $dst === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); + return $status; } @@ -100,11 +105,12 @@ class MemoryFileBackend extends FileBackendStore { if ( empty( $params['ignoreMissingSource'] ) ) { $status->fatal( 'backend-fail-copy', $params['src'], $params['dst'] ); } + return $status; } $this->files[$dst] = array( - 'data' => $this->files[$src]['data'], + 'data' => $this->files[$src]['data'], 'mtime' => wfTimestamp( TS_MW, time() ) ); @@ -117,6 +123,7 @@ class MemoryFileBackend extends FileBackendStore { $src = $this->resolveHashKey( $params['src'] ); if ( $src === null ) { $status->fatal( 'backend-fail-invalidpath', $params['src'] ); + return $status; } @@ -124,6 +131,7 @@ class MemoryFileBackend extends FileBackendStore { if ( empty( $params['ignoreMissingSource'] ) ) { $status->fatal( 'backend-fail-delete', $params['src'] ); } + return $status; } @@ -141,7 +149,7 @@ class MemoryFileBackend extends FileBackendStore { if ( isset( $this->files[$src] ) ) { return array( 'mtime' => $this->files[$src]['mtime'], - 'size' => strlen( $this->files[$src]['data'] ), + 'size' => strlen( $this->files[$src]['data'] ), ); } @@ -167,6 +175,7 @@ class MemoryFileBackend extends FileBackendStore { } $tmpFiles[$srcPath] = $fsFile; } + return $tmpFiles; } @@ -176,6 +185,7 @@ class MemoryFileBackend extends FileBackendStore { $src = $this->resolveHashKey( $params['src'] ); if ( $src === null || !isset( $this->files[$src] ) ) { $status->fatal( 'backend-fail-stream', $params['src'] ); + return $status; } @@ -191,6 +201,7 @@ class MemoryFileBackend extends FileBackendStore { return true; } } + return false; } @@ -219,6 +230,7 @@ class MemoryFileBackend extends FileBackendStore { } } } + return array_keys( $dirs ); } @@ -237,6 +249,7 @@ class MemoryFileBackend extends FileBackendStore { $files[] = $relPath; } } + return $files; } @@ -255,6 +268,7 @@ class MemoryFileBackend extends FileBackendStore { if ( $relPath === null ) { return null; // invalid } + return ( $relPath !== '' ) ? "$fullCont/$relPath" : $fullCont; } }