function Archive_Tar::_addList
Parameters
array $p_list:
string $p_add_dir:
string $p_remove_dir:
Return value
bool
2 calls to Archive_Tar::_addList()
- Archive_Tar::createModify in modules/
system/ system.tar.inc - This method creates the archive file and add the files / directories that are listed in $p_filelist. If the file already exists and is writable, it is replaced by the new tar. It is a create and not an add. If the file exists and is read-only or is a…
- Archive_Tar::_append in modules/
system/ system.tar.inc
File
-
modules/
system/ system.tar.inc, line 1194
Class
Code
public function _addList($p_list, $p_add_dir, $p_remove_dir) {
$v_result = true;
$v_header = array();
// ----- Remove potential windows directory separator
$p_add_dir = $this->_translateWinPath($p_add_dir);
$p_remove_dir = $this->_translateWinPath($p_remove_dir, false);
if (!$this->_file) {
$this->_error('Invalid file descriptor');
return false;
}
if (sizeof($p_list) == 0) {
return true;
}
foreach ($p_list as $v_filename) {
if (!$v_result) {
break;
}
// ----- Skip the current tar name
if ($v_filename == $this->_tarname) {
continue;
}
if ($v_filename == '') {
continue;
}
// ----- ignore files and directories matching the ignore regular expression
if ($this->_ignore_regexp && preg_match($this->_ignore_regexp, '/' . $v_filename)) {
$this->_warning("File '{$v_filename}' ignored");
continue;
}
if (!file_exists($v_filename) && !is_link($v_filename)) {
$this->_warning("File '{$v_filename}' does not exist");
continue;
}
// ----- Add the file or directory header
if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir)) {
return false;
}
if (@is_dir($v_filename) && !@is_link($v_filename)) {
if (!($p_hdir = opendir($v_filename))) {
$this->_warning("Directory '{$v_filename}' can not be read");
continue;
}
while (false !== ($p_hitem = readdir($p_hdir))) {
if ($p_hitem != '.' && $p_hitem != '..') {
if ($v_filename != ".") {
$p_temp_list[0] = $v_filename . '/' . $p_hitem;
}
else {
$p_temp_list[0] = $p_hitem;
}
$v_result = $this->_addList($p_temp_list, $p_add_dir, $p_remove_dir);
}
}
unset($p_temp_list);
unset($p_hdir);
unset($p_hitem);
}
}
return $v_result;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.