We are using views bonus to generate CSV files of large set of nodes. Since views may not be fast enough to process that amount of data within the HTTP timeout delay (30s), we use the batch api to generate the CSV file chunk by chunk. To achieve this, we do something like:
$view = views_get_view('my_view');
$view->set_display('feed_1');
$view->set_items_per_page(100);
$view->set_offset($context['sandbox']['progress']);
$view->execute('feed_1');
// Do not export to file: we want to grab the export data.
unset($view->style_plugin->definition['export headers']);
unset($view->style_plugin->options['filename']);
// Only output CSV headers for the first chunk.
if ($context['sandbox']['progress'] > 0) {
$view->style_plugin->options['header'] = 0;
}
$context['results']['data'][] = $view->render('feed_1');
The actual file transfer only happens at the end of the batch operation.
However, in views_bonus_export_views_post_render(), there is a cache control directive that cause Google to use its cached copy of the batch progress page instead of querying the server (Firefox seems to ignore this directive):
drupal_set_header('Cache-Control: max-age=60, must-revalidate');
My understanding of this directive is that a cached copy of the page should be used for 60 seconds, then the browser should revalidate with the server (so Chrome is behaving correctly).
I suggest that this directive, if still necessary, be moved in the if ($filename) section of the function. Patch attached.
Closed: outdated
1.1
Views Export
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.