diff options
Diffstat (limited to 'phpBB/includes/functions_compress.php')
| -rw-r--r-- | phpBB/includes/functions_compress.php | 69 | 
1 files changed, 63 insertions, 6 deletions
| diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index a7ee29dd91..e768a0f47b 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -184,7 +184,7 @@ class compress  }  /** -* Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier Müller, Loïc Chapeaux, +* Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier Müller, Loïc Chapeaux,  * Marc Delisle, http://www.phpmyadmin.net/  *  * Zip extraction function by Alexandre Tedeschi, alexandrebr at gmail dot com @@ -204,11 +204,19 @@ class compress_zip extends compress  	var $datasec_len = 0;  	/** +	 * @var \phpbb\filesystem\filesystem_interface +	 */ +	protected $filesystem; + +	/**  	* Constructor  	*/  	function compress_zip($mode, $file)  	{ +		global $phpbb_filesystem; +  		$this->fp = @fopen($file, $mode . 'b'); +		$this->filesystem = ($phpbb_filesystem instanceof \phpbb\filesystem\filesystem_interface) ? $phpbb_filesystem : new \phpbb\filesystem\filesystem();  		if (!$this->fp)  		{ @@ -286,7 +294,15 @@ class compress_zip extends compress  									{  										trigger_error("Could not create directory $folder");  									} -									phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + +									try +									{ +										$this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); +									} +									catch (\phpbb\filesystem\exception\filesystem_exception $e) +									{ +										// Do nothing +									}  								}  							}  						} @@ -315,7 +331,15 @@ class compress_zip extends compress  								{  									trigger_error("Could not create directory $folder");  								} -								phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + +								try +								{ +									$this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); +								} +								catch (\phpbb\filesystem\exception\filesystem_exception $e) +								{ +									// Do nothing +								}  							}  						}  					} @@ -539,10 +563,17 @@ class compress_tar extends compress  	var $wrote = false;  	/** +	 * @var \phpbb\filesystem\filesystem_interface +	 */ +	protected $filesystem; + +	/**  	* Constructor  	*/  	function compress_tar($mode, $file, $type = '')  	{ +		global $phpbb_filesystem; +  		$type = (!$type) ? $file : $type;  		$this->isgz = preg_match('#(\.tar\.gz|\.tgz)$#', $type);  		$this->isbz = preg_match('#\.tar\.bz2$#', $type); @@ -551,6 +582,8 @@ class compress_tar extends compress  		$this->file = &$file;  		$this->type = &$type;  		$this->open(); + +		$this->filesystem = ($phpbb_filesystem instanceof \phpbb\filesystem\filesystem_interface) ? $phpbb_filesystem : new \phpbb\filesystem\filesystem();  	}  	/** @@ -601,7 +634,15 @@ class compress_tar extends compress  								{  									trigger_error("Could not create directory $folder");  								} -								phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + +								try +								{ +									$this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); +								} +								catch (\phpbb\filesystem\exception\filesystem_exception $e) +								{ +									// Do nothing +								}  							}  						}  					} @@ -628,7 +669,15 @@ class compress_tar extends compress  							{  								trigger_error("Could not create directory $folder");  							} -							phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + +							try +							{ +								$this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); +							} +							catch (\phpbb\filesystem\exception\filesystem_exception $e) +							{ +								// Do nothing +							}  						}  					} @@ -637,7 +686,15 @@ class compress_tar extends compress  					{  						trigger_error("Couldn't create file $filename");  					} -					phpbb_chmod($target_filename, CHMOD_READ); + +					try +					{ +						$this->filesystem->phpbb_chmod($target_filename, CHMOD_READ); +					} +					catch (\phpbb\filesystem\exception\filesystem_exception $e) +					{ +						// Do nothing +					}  					// Grab the file contents  					fwrite($fp, ($filesize) ? $fzread($this->fp, ($filesize + 511) &~ 511) : '', $filesize); | 
