43 public static function register() {
47 stream_wrapper_register(
'mediawiki.compress.7z', self::class );
51 private function stripPath(
$path ) {
52 $prefix =
'mediawiki.compress.7z://';
54 return substr(
$path, strlen( $prefix ) );
58 if ( $mode[0] ==
'r' ) {
59 $options =
'e -bd -so';
60 } elseif ( $mode[0] ==
'w' ) {
61 $options =
'a -bd -si';
65 $arg = Shell::escape( $this->stripPath(
$path ) );
66 $command =
"7za $options $arg";
69 $command .=
' 2>/dev/null';
72 $this->stream = popen( $command, $mode[0] );
73 return ( $this->stream !==
false );
77 return stat( $this->stripPath(
$path ) );
81 return fclose( $this->stream );
85 return fflush( $this->stream );
89 return fread( $this->stream, $count );
93 return fwrite( $this->stream, $data );
97 return ftell( $this->stream );
101 return feof( $this->stream );
105 return fseek( $this->stream, $offset, $whence );
wfIsWindows()
Check if the operating system is Windows.
Stream wrapper around 7za filter program.
stream_open( $path, $mode, $options, &$opened_path)
resource null $context
Must exists on stream wrapper class.
stream_seek( $offset, $whence)