You are here

protected function views_data_export_plugin_display_export::outputfile_create in Views data export 7.4

Same name and namespace in other branches
  1. 6.3 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::outputfile_create()
  2. 6 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::outputfile_create()
  3. 6.2 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::outputfile_create()
  4. 7 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::outputfile_create()
  5. 7.3 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::outputfile_create()

Called on export initialization Creates the output file, registers it as a temporary file with Drupal and returns the fid

1 call to views_data_export_plugin_display_export::outputfile_create()
views_data_export_plugin_display_export::execute_initial in plugins/views_data_export_plugin_display_export.inc
Initializes the whole export process and starts off the batch process.

File

plugins/views_data_export_plugin_display_export.inc, line 702
Contains the bulk export display plugin.

Class

views_data_export_plugin_display_export
The plugin that batches its rendering.

Code

protected function outputfile_create() {
  $dir = variable_get('views_data_export_directory', 'temporary://views_plugin_display');

  // Make sure the directory exists first.
  if (!file_prepare_directory($dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
    $this
      ->abort_export(t('Could not create temporary directory for result export (@dir). Check permissions.', array(
      '@dir' => $dir,
    )));
  }
  $path = drupal_tempnam($dir, 'views_data_export');

  // Save the file into the DB.
  $file = $this
    ->file_save_file($path);
  return $file->fid;
}