You are here

function omega_tools_write_archive in Omega Tools 7.3

@todo

2 calls to omega_tools_write_archive()
omega_tools_subtheme_wizard_finished_form_submit in includes/omega_tools.wizard.inc
@todo
omega_tools_theme_download in includes/omega_tools.admin.inc
@todo

File

./omega_tools.module, line 499

Code

function omega_tools_write_archive($source, $name, $destination = NULL) {
  $destination = isset($destination) ? $destination : 'temporary://omega-tools';
  if (!file_prepare_directory($destination, FILE_CREATE_DIRECTORY)) {
    drupal_set_message(t('Omega Tools could not create the directory %dir', array(
      '%dir' => $destination,
    )), 'error');
    watchdog('Omega Tools', t('Omega Tools could not create the directory %dir', array(
      '%dir' => $destination,
    )), array(), WATCHDOG_ERROR);
    return FALSE;
  }
  $destination = $destination . '/' . $name . '.tar';
  $current = getcwd();
  chdir(drupal_realpath(dirname($source)));
  $archiver = new Archive_Tar(drupal_realpath($destination));
  $archiver
    ->create(basename(rtrim($source, '/')));
  chdir($current);
  return $destination;
}