public static function ConfigurationManagement::exportAsTar in Configuration Management 7.2
Download the entire configuration packaged up into tar file
2 calls to ConfigurationManagement::exportAsTar()
- configuration_ui_export_to_tar_file_form_submit in ui/
configuration_ui.admin.inc - Submit handler for export to a tar file.
- configuration_ui_export_traked_to_tar_file_form_submit in ui/
configuration_ui.admin.inc - Submit handler for export tracked configurations to a tar file.
File
- lib/
Drupal/ configuration/ Config/ ConfigurationManagement.php, line 674 - Definition of Drupal\configuration\Config\ConfigurationManagement.
Class
Namespace
Drupal\configuration\ConfigCode
public static function exportAsTar($list = array(), $export_dependencies = TRUE, $export_optionals = TRUE) {
$excluded = static::excludedConfigurations();
$settings = new ConfigIteratorSettings(array(
'build_callback' => 'build',
'callback' => 'printRaw',
'process_dependencies' => $export_dependencies,
'process_optionals' => $export_optionals,
'info' => array(
'exported' => array(),
'exported_files' => array(),
'hash' => array(),
'modules' => array(),
'excluded' => $excluded,
),
'settings' => array(
'format' => 'tar',
'tar_folder' => 'configuration',
),
));
module_invoke_all('configuration_pre_export', $settings);
$filename = 'configuration.' . time() . '.tar';
// Clear out output buffer to remove any garbage from tar output.
if (ob_get_level()) {
ob_end_clean();
}
drupal_add_http_header('Content-type', 'application/x-tar');
drupal_add_http_header('Content-Disposition', 'attachment; filename="' . $filename . '"');
drupal_send_headers();
foreach ($list as $component) {
if (in_array($component, $excluded)) {
continue;
}
$config = static::createConfigurationInstance($component);
// Make sure the object is built before start to iterate on its
// dependencies.
$config
->setContext($settings);
$config
->build();
$config
->iterate($settings);
}
$exported = $settings
->getInfo('exported');
module_invoke_all('configuration_post_export', $settings);
$file_content = "<?php\n\n";
$file_content .= "// This file contains the list of configurations contained in this package.\n\n";
$file_content .= "\$configurations = array(\n";
foreach ($exported as $config) {
$file_content .= " '{$config}',\n";
}
$file_content .= ");\n\n";
$file_content .= "\$modules = array(\n";
foreach (array_unique($settings
->getInfo('modules')) as $module) {
$file_content .= " '{$module}',\n";
}
$file_content .= ");\n";
print static::createTarContent($settings
->getSetting('tar_folder') . "/configurations.inc", $file_content);
print pack("a1024", "");
exit;
}