protected function views_data_export_plugin_display_export::outputfile_create in Views data export 6.3
Same name and namespace in other branches
- 6 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::outputfile_create()
- 6.2 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::outputfile_create()
- 7.4 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::outputfile_create()
- 7 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::outputfile_create()
- 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 582 - 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 = file_directory_temp() . '/views_plugin_display';
// Make sure the directory exists first.
if (!file_check_directory($dir, FILE_CREATE_DIRECTORY)) {
$this
->abort_export(t('Could not create temporary directory for result export (@dir). Check permissions.', array(
'@dir' => $dir,
)));
}
// TODO: do we need the realpath here?
$path = tempnam(realpath($dir), 'views_data');
// Create the file.
if (($output_filename = file_create_path($path)) === FALSE) {
$this
->abort_export(t('Could not create temporary output file for result export (@file). Check permissions.', array(
'@file' => $path,
)));
}
// Save the file into the DB.
$file = $this
->file_save_file($output_filename);
return $file->fid;
}