What I did is I modified the file controllers\dashboard\migration\export.php in the migration tool.
There’s a method named download_files()
I created a new method called download_files_missing() in the same file.
public function download_files_missing()
{
@ini_set('memory_limit', '-1');
@set_time_limit(0);
$id = $_POST['id'];
if ($id) {
$batch = MigrationBatch::getByID($id);
}
if (!is_object($batch)) {
$this->error->add(t('Invalid Batch'));
}
if (!$this->token->validate('download_files')) {
$this->error->add($this->token->getErrorMessage());
}
$fh = Loader::helper('file');
$vh = Loader::helper('validation/identifier');
if (!$this->error->has()) {
$temp = sys_get_temp_dir();
if (!$temp) {
$temp = $fh->getTemporaryDirectory();
}
$filename = $temp.'/'.$vh->getString().'.zip';
$files = array();
$prefixes = array();
Loader::model('file_list');
$fileList = new FileList();
$fmFiles = $fileList->get();
$batchFID = (array) $_POST['batchFileID'];
foreach ($fmFiles as $f) {
// foreach ((array) $_POST['batchFileID'] as $fID) {
if ($f->isError()) {
continue;
}
if (in_array($f->getFileID(), $batchFID)) {
continue;
}
// $fp = new Permissions($f);
// if ($fp->canRead()) {
if (!in_array($f->getPath(), $files) && file_exists($f->getPath())) {
$files[] = $f->getPath();
$prefixes[] = $f->getPrefix();
}
// }
}
if (empty($files)) {
throw new Exception(t('None of the requested files could be found.'));
}
if (class_exists('ZipArchive', false)) {
$zip = new ZipArchive();
$res = $zip->open($filename, ZipArchive::CREATE);
if ($res !== true) {
throw new Exception(t('Could not open with ZipArchive::CREATE'));
}
for ($i = 0; $i < count($files); $i++) {
$f = $files[$i];
$prefix = $prefixes[$i];
$zip->addFile($f, $prefix . '_' . basename($f));
}
$zip->close();
} else {
throw new \Exception(t('ZipArchive extension required.'));
}
$fh->forceDownload($filename);
}
exit;
}
So first you would export your files normally. Then you would use this new method to export the other files. The method would export only files that were not already exported using the normal method.
To do so you would modify the file single_pages\dashboard\migration\export.php
Look for the line:
<form method="post" action="<?=View::url('/dashboard/migration/export', 'download_files')?>">
and modify it to use the new method name like so:
<form method="post" action="<?=View::url('/dashboard/migration/export', 'download_files_missing')?>">
Then on the page where you export the files (reload it) select all the files listed (the ones already exported) and click on the button to export. It will export all the other files that are not in the list.
Make sure you select all the files on the page to exclude them from the modified export, so the same file doesn’t get exported twice.
Technically, you could forego exporting the files normally first and just use my modified method directly. You would do it without checking any of the files in the list, and the resulting file would contain absolutely all the files.
But by doing it the other way, you can still make sure you know which files are required by core blocks and which are only required by third-party blocks.