1 system.tar.inc | public Archive_Tar::_addList($p_list, $p_add_dir, $p_remove_dir) |
Parameters
array $p_list:
string $p_add_dir:
string $p_remove_dir:
Return value
bool:
File
- core/
modules/ system/ system.tar.inc, line 1196
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;
}