Change the Archive_Tar _addFile function to make it possible to use a different filename

This commit is contained in:
Bart Visscher 2012-10-13 21:01:00 +02:00
parent 3fef4564f0
commit fea6ac46ef
1 changed files with 24 additions and 21 deletions

View File

@ -981,7 +981,7 @@ class Archive_Tar extends PEAR
// }}} // }}}
// {{{ _addFile() // {{{ _addFile()
function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir) function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $v_stored_filename=null)
{ {
if (!$this->_file) { if (!$this->_file) {
$this->_error('Invalid file descriptor'); $this->_error('Invalid file descriptor');
@ -993,8 +993,10 @@ class Archive_Tar extends PEAR
return false; return false;
} }
// ownCloud change to make it possible to specify the filename to use
if(is_null($v_stored_filename)) {
// ----- Calculate the stored filename // ----- Calculate the stored filename
$p_filename = $this->_translateWinPath($p_filename, false);; $p_filename = $this->_translateWinPath($p_filename, false);
$v_stored_filename = $p_filename; $v_stored_filename = $p_filename;
if (strcmp($p_filename, $p_remove_dir) == 0) { if (strcmp($p_filename, $p_remove_dir) == 0) {
return true; return true;
@ -1015,6 +1017,7 @@ class Archive_Tar extends PEAR
} }
$v_stored_filename = $this->_pathReduction($v_stored_filename); $v_stored_filename = $this->_pathReduction($v_stored_filename);
}
if ($this->_isArchive($p_filename)) { if ($this->_isArchive($p_filename)) {
if (($v_file = @fopen($p_filename, "rb")) == 0) { if (($v_file = @fopen($p_filename, "rb")) == 0) {