class ArchiverTar

  1. cis7 modules/system/ ArchiverTar
  2. cle7 modules/system/ ArchiverTar
  3. elmsmedia7 modules/system/ ArchiverTar
  4. icor7 modules/system/ ArchiverTar
  5. meedjum_blog7 modules/system/ ArchiverTar
  6. mooc7 modules/system/ ArchiverTar

Archiver for .tar files.


Expanded class hierarchy of ArchiverTar


Contains filters are case sensitive
Namesort descending Modifiers Type Description
ArchiverTar::$tar protected property The underlying Archive_Tar instance that does the heavy lifting.
ArchiverTar::add public function Adds the specified file or directory to the archive. Overrides ArchiverInterface::add
ArchiverTar::extract public function Extracts multiple files in the archive to the specified path. Overrides ArchiverInterface::extract
ArchiverTar::getArchive public function Retrieve the tar engine itself.
ArchiverTar::listContents public function Lists all files in the archive. Overrides ArchiverInterface::listContents
ArchiverTar::remove public function Removes the specified file from the archive. Overrides ArchiverInterface::remove
ArchiverTar::__construct public function Constructs a new archiver instance. Overrides ArchiverInterface::__construct


modules/system/, line 11
Archiver implementations provided by the system module.

View source
class ArchiverTar implements ArchiverInterface {

   * The underlying Archive_Tar instance that does the heavy lifting.
   * @var Archive_Tar
  protected $tar;

  public function __construct($file_path) {
    $this->tar = new Archive_Tar($file_path);

  public function add($file_path) {

    return $this;

  public function remove($file_path) {
    // @todo Archive_Tar doesn't have a remove operation
    // so we'll have to simulate it somehow, probably by
    // creating a new archive with everything but the removed
    // file.

    return $this;

  public function extract($path, Array $files = array()) {
    if ($files) {
      $this->tar->extractList($files, $path);
    else {

    return $this;

  public function listContents() {
    $files = array();
    foreach ($this->tar->listContent() as $file_data) {
      $files[] = $file_data['filename'];
    return $files;

   * Retrieve the tar engine itself.
   * In some cases it may be necessary to directly access the underlying
   * Archive_Tar object for implementation-specific logic. This is for advanced
   * use only as it is not shared by other implementations of ArchiveInterface.
   * @return
   *   The Archive_Tar object used by this object.
  public function getArchive() {
    return $this->tar;
3 string references to 'ArchiverTar'
hook_archiver_info in modules/system/system.api.php
Declare archivers to the system.
og-7.x-1.x.database.php in sites/all/modules/ulmus/og/tests/og-7.x-1.x.database.php
Filled installation of Drupal 7.0, for test purposes.
system_archiver_info in modules/system/system.module
Implements hook_archiver_info().