function DebugDestination::saveFile in Backup and Migrate 8.4
Save a file to the destination.
Parameters
\BackupMigrate\Core\File\BackupFileReadableInterface $file: The file to save.
Overrides StreamDestination::saveFile
File
- lib/
backup_migrate_core/ src/ Destination/ DebugDestination.php, line 19
Class
- DebugDestination
- Class DebugDestination.
Namespace
BackupMigrate\Core\DestinationCode
function saveFile(BackupFileReadableInterface $file) {
// Quick and dirty way to html format this output.
if ($this
->confGet('format') == 'html') {
print '<pre>';
}
// Output the metadata.
if ($this
->confGet('showmeta')) {
print "---------------------\n";
print "Metadata: \n";
print_r($file
->getMetaAll());
print "---------------------\n";
}
// Output the body.
if ($this
->confGet('showbody')) {
print "---------------------\n";
print "Body: \n";
$max = $this
->confGet('maxbody');
$chunk = min($max, 1024);
if ($file
->openForRead()) {
// Transfer file in 1024 byte chunks to save memory usage.
while ($max > 0 && ($data = $file
->readBytes($chunk))) {
print $data;
$max -= $chunk;
}
$file
->close();
}
print "---------------------\n";
}
// Quick and dirty way to html format this output.
if ($this
->confGet('format') == 'html') {
print '</pre>';
}
exit;
}