function views_data_export_plugin_display_export::execute_initial 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::execute_initial()
- 6.2 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::execute_initial()
- 7.4 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::execute_initial()
- 7 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::execute_initial()
- 7.3 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::execute_initial()
Initializes the whole export process and starts off the batch process.
Page execution will be ended at the end of this function.
1 call to views_data_export_plugin_display_export::execute_initial()
- views_data_export_plugin_display_export::execute in plugins/
views_data_export_plugin_display_export.inc - Execute this display handler.
File
- plugins/
views_data_export_plugin_display_export.inc, line 216 - Contains the bulk export display plugin.
Class
- views_data_export_plugin_display_export
- The plugin that batches its rendering.
Code
function execute_initial() {
// Register this export with our central table - get a unique eid
// Also store our view in a cache to be retrieved with each batch call
$this->batched_execution_state = views_data_export_new($this->view->name, $this->view->current_display, $this
->outputfile_create());
views_data_export_view_store($this->batched_execution_state->eid, $this->view);
// We need to build the index right now, before we lose $_GET etc.
$this
->initialize_index();
//$this->batched_execution_state->fid = $this->outputfile_create();
// Initialize the progress counter
$this->batched_execution_state->sandbox['max'] = db_result(db_query('SELECT COUNT(*) FROM {' . $this
->index_tablename() . '}'));
// Record the time we started.
list($usec, $sec) = explode(' ', microtime());
$this->batched_execution_state->sandbox['started'] = (double) $usec + (double) $sec;
// Build up our querystring for the final page callback.
$querystring = array(
'eid' => $this->batched_execution_state->eid,
);
// If we were attached to another view, grab that for the final URL.
if (!empty($_GET['attach']) && isset($this->view->display[$_GET['attach']])) {
// Get the path of the attached display:
$querystring['return-url'] = $this->view->display[$_GET['attach']]->handler
->get_path();
}
$querystring_built = drupal_query_string_encode($querystring);
//Set the batch off
$batch = array(
'operations' => array(
array(
'_views_data_export_batch_process',
array(
$this->batched_execution_state->eid,
$this->view->current_display,
),
),
),
'title' => t('Building export'),
'init_message' => t('Export is starting up.'),
'progress_message' => t('Exporting @percentage% complete,'),
'error_message' => t('Export has encountered an error.'),
);
// We do not return, so update database sandbox now
views_data_export_update($this->batched_execution_state);
$final_destination = $this->view
->get_url();
// Provide a way in for others at this point
// e.g. Drush to grab this batch and yet execute it in
// it's own special way
$batch['view_name'] = $this->view->name;
$batch['display_id'] = $this->view->current_display;
$batch['eid'] = $this->batched_execution_state->eid;
$batch['__drupal_alter_by_ref']['final_destination'] =& $final_destination;
$batch['__drupal_alter_by_ref']['querystring'] =& $querystring_built;
drupal_alter('views_data_export_batch', $batch);
// Modules may have cleared out $batch, indicating that we shouldn't process further.
if (!empty($batch)) {
batch_set($batch);
// batch_process exits
batch_process(array(
$final_destination,
$querystring_built,
));
}
}