function ArchiverZip::__construct

Constructs a new archiver instance.

Parameters

$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.

Overrides ArchiverInterface::__construct

File

modules/system/system.archiver.inc, line 87

Class

ArchiverZip
Archiver for .zip files.

Code

public function __construct($file_path) {
    $this->zip = new ZipArchive();
    if ($this->zip
        ->open($file_path) !== TRUE) {
        // @todo: This should be an interface-specific exception some day.
        throw new Exception(t('Cannot open %file_path', array(
            '%file_path' => $file_path,
        )));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.