Project

General

Profile

Paste
Download (1.66 KB) Statistics
| Branch: | Revision:

root / drupal7 / includes / archiver.inc @ a8cee257

1
<?php
2

    
3
/**
4
 * @file
5
 * Shared classes and interfaces for the archiver system.
6
 */
7

    
8
/**
9
 * Defines the common interface for all Archiver classes.
10
 */
11
interface ArchiverInterface {
12

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

    
23
  /**
24
   * Adds the specified file or directory to the archive.
25
   *
26
   * @param $file_path
27
   *   The full system path of the file or directory to add. Only local files
28
   *   and directories are supported.
29
   *
30
   * @return ArchiverInterface
31
   *   The called object.
32
   */
33
  public function add($file_path);
34

    
35
  /**
36
   * Removes the specified file from the archive.
37
   *
38
   * @param $path
39
   *   The file name relative to the root of the archive to remove.
40
   *
41
   * @return ArchiverInterface
42
   *   The called object.
43
   */
44
  public function remove($path);
45

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

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