archiver.inc 1.65 KB
Newer Older
1
<?php
2
// $Id$
3 4 5 6 7 8 9 10 11 12 13 14

/**
 * @file
 * Shared classes and interfaces for the archiver system.
 */

/**
 * Common interface for all Archiver classes.
 */
interface ArchiverInterface {

  /**
15
   * Constructor for a new archiver instance.
16 17 18 19 20 21 22 23 24 25 26 27 28 29
   *
   * @param $file_path
   *   The full system path of the archive to manipulate.  Only local files
   *   are supported.  If the file does not yet exist, it will be created if
   *   appropriate.
   */
  public function __construct($file_path);

  /**
   * Add the specified file or directory to the archive.
   *
   * @param $file_path
   *   The full system path of the file or directory to add. Only local files
   *   and directories are supported.
30
   * @return ArchiverInterface
31 32 33 34 35 36 37 38 39
   *   The called object.
   */
  public function add($file_path);

  /**
   * Remove the specified file from the archive.
   *
   * @param $path
   *   The file name relative to the root of the archive to remove.
40
   * @return ArchiverInterface
41 42 43 44 45 46 47 48 49 50 51 52 53
   *   The called object.
   */
  public function remove($path);

  /**
   * Extract multiple files in the archive to the specified path.
   *
   * @param $path
   *   A full system path of the directory to which to extract files.
   * @param $files
   *   Optionally specify a list of files to be extracted. Files are
   *   relative to the root of the archive. If not specified, all files
   *   in the archive will be extracted
54
   * @return ArchiverInterface
55 56 57 58 59 60 61 62
   *   The called object.
   */
  public function extract($path, Array $files = array());

  /**
   * List all files in the archive.
   *
   * @return
63
   *   An array of file names relative to the root of the archive.
64 65 66 67
   */
  public function listContents();
}