function configuration_download_diff in Configuration Management 7
Download a unified diff.
@todo Not working, will set the files up to just download for now.
File
- ./
configuration.admin.inc, line 1021
Code
function configuration_download_diff($config) {
module_load_include('inc', 'configuration', 'configuration.export');
module_load_include('inc', 'configuration', 'includes/diff.engine');
$code = array();
$config_populate = configuration_populate_sanitize($config);
$export = configuration_populate($config_populate, array());
// Track dependencies on config_export table
_configuration_track_dependencies($export);
$files = configuration_export_render($export, TRUE);
foreach ($files as $component => $activestore) {
$datastore = file_get_contents("config://" . $component . '.inc');
$formatter = new UnifiedDiffFormatter();
//$formatter = new DiffFormatter();
$formatter->leading_context_lines = 2;
$formatter->trailing_context_lines = 2;
//$formatter->show_header = $show_header
$diff = new Diff(explode("\n", $datastore), explode("\n", $activestore));
print '--- ' . $component . ".inc\n";
print '+++ ' . $component . ".inc\n";
print $formatter
->format($diff);
}
exit;
}