This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

concrete5 makes it easy to work with ZIP archives from your own custom class. 

Create your class

First, create your custom class that you wish to enable ZIP archive usage in. This class must extend the Archive Library. 

 <?
Loader::library(‘archive’);
class MyArchive extends Archive {

}

Specify the target directory for ZIP files to be unzipped to, and make the install() method public.

<?
Loader::library(‘archive’);
class MyArchive extends Archive {
    public function install($file, $inplace=false) {
        parent::install($file, $inplace);
    }
public function __construct() {         parent::__construct();
        $this->targetDirectory = ‘/path/to/some/directory’;
    }
}

Run MyArchive::install($file)

Where $file = the name of a file WITHOUT THE .ZIP EXTENSION, as found in the temporary directory. The file will be unzipped to the targetDirectory. If an error occurs, an Exception will be thrown.

Loading Conversation