You are here

function _responsive_favicons_archive_extract in Responsive Favicons 7

Unpacks a downloaded archive file.

Parameters

string $file: The filename of the archive you wish to extract.

string $directory: The directory you wish to extract the archive into.

Return value

Archiver The Archiver object used to extract the archive.

Throws

Exception

1 call to _responsive_favicons_archive_extract()
responsive_favicons_config_page_submit in ./responsive_favicons.admin.inc
Implements additional submit logic for responsive_favicons_settings_form().

File

./responsive_favicons.admin.inc, line 184
Admin page callbacks for the responsive_favicons module.

Code

function _responsive_favicons_archive_extract($file, $directory) {
  $archiver = archiver_get_archiver($file);
  if (!$archiver) {
    throw new Exception(t('Cannot extract %file, not a valid archive.', array(
      '%file' => $file,
    )));
  }
  if (file_exists($directory)) {
    file_unmanaged_delete_recursive($directory);
  }
  $archiver
    ->extract($directory);
  return $archiver;
}