/[drupal]/drupal/modules/system/system.archiver.inc
ViewVC logotype

Contents of /drupal/modules/system/system.archiver.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Fri Oct 16 13:18:32 2009 UTC (5 weeks, 5 days ago) by dries
Branch: MAIN
CVS Tags: DRUPAL-7-0-UNSTABLE-10, HEAD
Changes since 1.1: +1 -0 lines
File MIME type: text/x-php
- Patch #604618 by axyjo, sun: archiver code clean-up.
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Archiver implementations provided by the system module.
7 */
8
9 /**
10 * Archiver for .tar files.
11 */
12 class ArchiverTar implements ArchiverInterface {
13
14 /**
15 * The underlying Archive_Tar instance that does the heavy lifting.
16 *
17 * @var Archive_Tar
18 */
19 protected $tar;
20
21 public function __construct($file_path) {
22 $this->tar = new Archive_Tar($file_path);
23 }
24
25 public function add($file_path) {
26 $this->tar->add($file_path);
27
28 return $this;
29 }
30
31 public function remove($path) {
32 // @todo Archive_Tar doesn't have a remove operation
33 // so we'll have to simulate it somehow, probably by
34 // creating a new archive with everything but the removed
35 // file.
36
37 return $this;
38 }
39
40 public function extract($path, Array $files = array()) {
41 if ($files) {
42 $this->tar->extractList($files, $path);
43 }
44 else {
45 $this->tar->extract($path);
46 }
47
48 return $this;
49 }
50
51 public function listContents() {
52 return $this->tar->listContent();
53 }
54
55 /**
56 * Retrieve the tar engine itself.
57 *
58 * In some cases it may be necessary to directly access the underlying
59 * Archive_Tar object for implementation-specific logic. This is for advanced
60 * use only as it is not shared by other implementations of ArchiveInterface.
61 *
62 * @return
63 * The Archive_Tar object used by this object.
64 */
65 public function getArchive() {
66 return $this->tar;
67 }
68 }

  ViewVC Help
Powered by ViewVC 1.1.2