dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Clean up mediawiki.legacy.protect a bit."
[lhc/web/wiklou.git]
/
includes
/
filebackend
/
MemoryFileBackend.php
diff --git
a/includes/filebackend/MemoryFileBackend.php
b/includes/filebackend/MemoryFileBackend.php
index
3924c12
..
7c2f825
100644
(file)
--- 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'] );
$dst = $this->resolveHashKey( $params['dst'] );
if ( $dst === null ) {
$status->fatal( 'backend-fail-invalidpath', $params['dst'] );
+
return $status;
}
$this->files[$dst] = array(
return $status;
}
$this->files[$dst] = array(
- 'data'
=> $params['content'],
+ 'data' => $params['content'],
'mtime' => wfTimestamp( TS_MW, time() )
);
'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'] );
$dst = $this->resolveHashKey( $params['dst'] );
if ( $dst === null ) {
$status->fatal( 'backend-fail-invalidpath', $params['dst'] );
+
return $status;
}
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'] );
wfRestoreWarnings();
if ( $data === false ) { // source doesn't exist?
$status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
+
return $status;
}
$this->files[$dst] = array(
return $status;
}
$this->files[$dst] = array(
- 'data'
=> $data,
+ 'data' => $data,
'mtime' => wfTimestamp( TS_MW, time() )
);
'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'] );
$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;
}
$dst = $this->resolveHashKey( $params['dst'] );
if ( $dst === null ) {
$status->fatal( 'backend-fail-invalidpath', $params['dst'] );
+
return $status;
}
return $status;
}
@@
-100,11
+105,12
@@
class MemoryFileBackend extends FileBackendStore {
if ( empty( $params['ignoreMissingSource'] ) ) {
$status->fatal( 'backend-fail-copy', $params['src'], $params['dst'] );
}
if ( empty( $params['ignoreMissingSource'] ) ) {
$status->fatal( 'backend-fail-copy', $params['src'], $params['dst'] );
}
+
return $status;
}
$this->files[$dst] = array(
return $status;
}
$this->files[$dst] = array(
- 'data'
=> $this->files[$src]['data'],
+ 'data' => $this->files[$src]['data'],
'mtime' => wfTimestamp( TS_MW, time() )
);
'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'] );
$src = $this->resolveHashKey( $params['src'] );
if ( $src === null ) {
$status->fatal( 'backend-fail-invalidpath', $params['src'] );
+
return $status;
}
return $status;
}
@@
-124,6
+131,7
@@
class MemoryFileBackend extends FileBackendStore {
if ( empty( $params['ignoreMissingSource'] ) ) {
$status->fatal( 'backend-fail-delete', $params['src'] );
}
if ( empty( $params['ignoreMissingSource'] ) ) {
$status->fatal( 'backend-fail-delete', $params['src'] );
}
+
return $status;
}
return $status;
}
@@
-141,7
+149,7
@@
class MemoryFileBackend extends FileBackendStore {
if ( isset( $this->files[$src] ) ) {
return array(
'mtime' => $this->files[$src]['mtime'],
if ( isset( $this->files[$src] ) ) {
return array(
'mtime' => $this->files[$src]['mtime'],
- 'size'
=> strlen( $this->files[$src]['data'] ),
+ 'size' => strlen( $this->files[$src]['data'] ),
);
}
);
}
@@
-155,7
+163,9
@@
class MemoryFileBackend extends FileBackendStore {
if ( $src === null || !isset( $this->files[$src] ) ) {
$fsFile = null;
} else {
if ( $src === null || !isset( $this->files[$src] ) ) {
$fsFile = null;
} else {
- $fsFile = TempFSFile::factory( 'localcopy_' );
+ // Create a new temporary file with the same extension...
+ $ext = FileBackend::extensionFromPath( $src );
+ $fsFile = TempFSFile::factory( 'localcopy_', $ext );
if ( $fsFile ) {
$bytes = file_put_contents( $fsFile->getPath(), $this->files[$src]['data'] );
if ( $bytes !== strlen( $this->files[$src]['data'] ) ) {
if ( $fsFile ) {
$bytes = file_put_contents( $fsFile->getPath(), $this->files[$src]['data'] );
if ( $bytes !== strlen( $this->files[$src]['data'] ) ) {
@@
-165,6
+175,7
@@
class MemoryFileBackend extends FileBackendStore {
}
$tmpFiles[$srcPath] = $fsFile;
}
}
$tmpFiles[$srcPath] = $fsFile;
}
+
return $tmpFiles;
}
return $tmpFiles;
}
@@
-174,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'] );
$src = $this->resolveHashKey( $params['src'] );
if ( $src === null || !isset( $this->files[$src] ) ) {
$status->fatal( 'backend-fail-stream', $params['src'] );
+
return $status;
}
return $status;
}
@@
-189,6
+201,7
@@
class MemoryFileBackend extends FileBackendStore {
return true;
}
}
return true;
}
}
+
return false;
}
return false;
}
@@
-217,6
+230,7
@@
class MemoryFileBackend extends FileBackendStore {
}
}
}
}
}
}
+
return array_keys( $dirs );
}
return array_keys( $dirs );
}
@@
-235,6
+249,7
@@
class MemoryFileBackend extends FileBackendStore {
$files[] = $relPath;
}
}
$files[] = $relPath;
}
}
+
return $files;
}
return $files;
}
@@
-253,6
+268,7
@@
class MemoryFileBackend extends FileBackendStore {
if ( $relPath === null ) {
return null; // invalid
}
if ( $relPath === null ) {
return null; // invalid
}
+
return ( $relPath !== '' ) ? "$fullCont/$relPath" : $fullCont;
}
}
return ( $relPath !== '' ) ? "$fullCont/$relPath" : $fullCont;
}
}