diff --git a/Tar.php b/ArchiveTar.1.4.0.php index 07550e6..a7bd19c 100644 --- a/Tar.php +++ b/ArchiveTar.1.4.0.php @@ -1,7 +1,7 @@ error_object = &$this->raiseError($p_message); + * to throw new \Exception($p_message); + */ + + +// drupal addition +namespace Drupal\Core\Archiver; + +// drupal removal require_once 'PEAR.php'; + +// drupal addition OS_WINDOWS as defined in PEAR.php +if (substr(PHP_OS, 0, 3) == 'WIN') { + define('OS_WINDOWS', true); +} else { + define('OS_WINDOWS', false); +} define('ARCHIVE_TAR_ATT_SEPARATOR', 90001); define('ARCHIVE_TAR_END_BLOCK', pack("a512", '')); @@ -73,7 +101,8 @@ if (!function_exists('gzseek') && function_exists('gzseek64')) { * @license http://www.opensource.org/licenses/bsd-license.php New BSD License * @version $Revision$ */ -class Archive_Tar extends PEAR +// drupal change class Archive_Tar extends PEAR +class ArchiveTar { /** * @var string Name of the Tar @@ -132,7 +161,7 @@ class Archive_Tar extends PEAR */ public function __construct($p_tarname, $p_compress = null) { - parent::__construct(); + // drupal removal parent::__construct(); $this->_compress = false; $this->_compress_type = 'none'; @@ -227,7 +256,7 @@ class Archive_Tar extends PEAR $this->_close(); // ----- Look for a local copy to delete if ($this->_temp_tarname != '') { - @unlink($this->_temp_tarname); + @drupal_unlink($this->_temp_tarname); } } @@ -705,7 +734,8 @@ class Archive_Tar extends PEAR */ public function _error($p_message) { - $this->error_object = $this->raiseError($p_message); + // drupal change $this->error_object = $this->raiseError($p_message); + throw new \Exception($p_message); } /** @@ -713,7 +743,8 @@ class Archive_Tar extends PEAR */ public function _warning($p_message) { - $this->error_object = $this->raiseError($p_message); + // drupal change $this->error_object = $this->raiseError($p_message); + throw new \Exception($p_message); } /** @@ -918,7 +949,7 @@ class Archive_Tar extends PEAR // ----- Look if a local copy need to be erase // Note that it might be interesting to keep the url for a time : ToDo if ($this->_temp_tarname != '') { - @unlink($this->_temp_tarname); + @drupal_unlink($this->_temp_tarname); $this->_temp_tarname = ''; } @@ -935,11 +966,11 @@ class Archive_Tar extends PEAR // ----- Look for a local copy if ($this->_temp_tarname != '') { // ----- Remove the local copy but not the remote tarname - @unlink($this->_temp_tarname); + @drupal_unlink($this->_temp_tarname); $this->_temp_tarname = ''; } else { // ----- Remove the local tarname file - @unlink($this->_tarname); + @drupal_unlink($this->_tarname); } $this->_tarname = ''; @@ -2015,7 +2046,7 @@ class Archive_Tar extends PEAR } } elseif ($v_header['typeflag'] == "2") { if (@file_exists($v_header['filename'])) { - @unlink($v_header['filename']); + @drupal_unlink($v_header['filename']); } if (!@symlink($v_header['link'], $v_header['filename'])) { $this->_error( @@ -2222,7 +2253,7 @@ class Archive_Tar extends PEAR @xzclose($v_temp_tar); } - if (!@unlink($this->_tarname . ".tmp")) { + if (!@drupal_unlink($this->_tarname . ".tmp")) { $this->_error( 'Error while deleting temporary file \'' . $this->_tarname . '.tmp\''