*/
class MemoryFileBackend extends FileBackendStore {
/** @var array Map of (file path => (data,mtime) */
- protected $files = array();
+ protected $files = [];
+
+ public function getFeatures() {
+ return self::ATTR_UNICODE_PATHS;
+ }
public function isPathUsableInternal( $storagePath ) {
return true;
return $status;
}
- $this->files[$dst] = array(
+ $this->files[$dst] = [
'data' => $params['content'],
'mtime' => wfTimestamp( TS_MW, time() )
- );
+ ];
return $status;
}
return $status;
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$data = file_get_contents( $params['src'] );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $data === false ) { // source doesn't exist?
$status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
return $status;
}
- $this->files[$dst] = array(
+ $this->files[$dst] = [
'data' => $data,
'mtime' => wfTimestamp( TS_MW, time() )
- );
+ ];
return $status;
}
return $status;
}
- $this->files[$dst] = array(
+ $this->files[$dst] = [
'data' => $this->files[$src]['data'],
'mtime' => wfTimestamp( TS_MW, time() )
- );
+ ];
return $status;
}
}
if ( isset( $this->files[$src] ) ) {
- return array(
+ return [
'mtime' => $this->files[$src]['mtime'],
'size' => strlen( $this->files[$src]['data'] ),
- );
+ ];
}
return false;
}
protected function doGetLocalCopyMulti( array $params ) {
- $tmpFiles = array(); // (path => TempFSFile)
+ $tmpFiles = []; // (path => TempFSFile)
foreach ( $params['srcs'] as $srcPath ) {
$src = $this->resolveHashKey( $srcPath );
if ( $src === null || !isset( $this->files[$src] ) ) {
}
public function getDirectoryListInternal( $container, $dir, array $params ) {
- $dirs = array();
+ $dirs = [];
$prefix = rtrim( "$container/$dir", '/' ) . '/';
$prefixLen = strlen( $prefix );
foreach ( $this->files as $path => $data ) {
}
public function getFileListInternal( $container, $dir, array $params ) {
- $files = array();
+ $files = [];
$prefix = rtrim( "$container/$dir", '/' ) . '/';
$prefixLen = strlen( $prefix );
foreach ( $this->files as $path => $data ) {