You are here

public static function MinisiteArchive::open in Mini site 7

Open archive file.

3 calls to MinisiteArchive::open()
minisite_site_asset_info in includes/minisite.site.inc
Fetch minisite information.
minisite_site_extract in includes/minisite.site.inc
Exact minisite files.
_minisite_field_validate_minisite_asset in includes/minisite.field.inc
Validate minisite asset.

File

includes/minisite.archive.inc, line 18
Minisite archive class.

Class

MinisiteArchive
Class MinisiteArchive.

Code

public static function open(\stdClass $file) {
  $archive = new static();
  $file_path = drupal_realpath($file->uri);
  try {
    switch ($file->filemime) {
      case 'application/zip':
        $archive->archiver = new \ArchiverZip($file_path);
        $archive->archiver
          ->listContents();
        break;
      default:
        return FALSE;
    }
  } catch (\Exception $e) {
    return FALSE;
  }
  return $archive;
}