summaryrefslogtreecommitdiffstats
path: root/includes/archiver.inc
blob: 3ce1173906b29625660830137e836f29c0c87bdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php

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

/**
 * Defines the common interface for all Archiver classes.
 */
interface ArchiverInterface {

  /**
   * Constructs a new archiver instance.
   *
   * @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);

  /**
   * Adds 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.
   *
   * @return ArchiverInterface
   *   The called object.
   */
  public function add($file_path);

  /**
   * Removes the specified file from the archive.
   *
   * @param $path
   *   The file name relative to the root of the archive to remove.
   *
   * @return ArchiverInterface
   *   The called object.
   */
  public function remove($path);

  /**
   * Extracts 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.
   *
   * @return ArchiverInterface
   *   The called object.
   */
  public function extract($path, array $files = array());

  /**
   * Lists all files in the archive.
   *
   * @return
   *   An array of file names relative to the root of the archive.
   */
  public function listContents();
}