You are here

public function ArchiveTar::extractList in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Archiver/ArchiveTar.php \Drupal\Core\Archiver\ArchiveTar::extractList()

This method extract from the archive only the files indicated in the $p_filelist. These files are extracted in the current directory or in the directory indicated by the optional $p_path parameter. If indicated the $p_remove_path can be used in the same way as it is used in extractModify() method.

Parameters

array $p_filelist An array of filenames and directory names,: or a single string with names separated by a single blank space.

string $p_path The path of the directory where the: files/dir need to by extracted.

string $p_remove_path Part of the memorized path that can be: removed if present at the beginning of the file/dir path.

boolean $p_preserve Preserve user/group ownership of files:

Return value

true on success, false on error.

See also

extractModify()

File

core/lib/Drupal/Core/Archiver/ArchiveTar.php, line 668

Class

ArchiveTar

Namespace

Drupal\Core\Archiver

Code

public function extractList($p_filelist, $p_path = '', $p_remove_path = '', $p_preserve = false) {
  $v_result = true;
  $v_list_detail = array();
  if (is_array($p_filelist)) {
    $v_list = $p_filelist;
  }
  elseif (is_string($p_filelist)) {
    $v_list = explode($this->_separator, $p_filelist);
  }
  else {
    $this
      ->_error('Invalid string list');
    return false;
  }
  if ($v_result = $this
    ->_openRead()) {
    $v_result = $this
      ->_extractList($p_path, $v_list_detail, "partial", $v_list, $p_remove_path, $p_preserve);
    $this
      ->_close();
  }
  return $v_result;
}