You are here

function views_bulk_operations_archive_action_submit in Views Bulk Operations (VBO) 7.3

Assembles a sanitized and unique URI for the archive.

@returns array A URI array used by the action callback (views_bulk_operations_archive_action).

File

actions/archive.action.inc, line 117
Provides an action for creating a zip archive of selected files.

Code

function views_bulk_operations_archive_action_submit($form, $form_state) {

  // Validate the scheme, fallback to public if it's somehow invalid.
  $scheme = $form_state['values']['scheme'];
  if (!file_stream_wrapper_valid_scheme($scheme)) {
    $scheme = 'public';
  }
  $destination = $scheme . '://' . basename($form_state['values']['filename']) . '.zip';

  // If the chosen filename already exists, file_destination() will append
  // an integer to it in order to make it unique.
  $destination = file_destination($destination, FILE_EXISTS_RENAME);
  return array(
    'destination' => $destination,
  );
}