DebugDestination.php in Backup and Migrate 8.4
File
lib/backup_migrate_core/src/Destination/DebugDestination.php
View source
<?php
namespace BackupMigrate\Core\Destination;
use BackupMigrate\Core\Config\Config;
use BackupMigrate\Core\File\BackupFileReadableInterface;
use BackupMigrate\Core\Plugin\PluginCallerInterface;
class DebugDestination extends StreamDestination implements WritableDestinationInterface {
function saveFile(BackupFileReadableInterface $file) {
if ($this
->confGet('format') == 'html') {
print '<pre>';
}
if ($this
->confGet('showmeta')) {
print "---------------------\n";
print "Metadata: \n";
print_r($file
->getMetaAll());
print "---------------------\n";
}
if ($this
->confGet('showbody')) {
print "---------------------\n";
print "Body: \n";
$max = $this
->confGet('maxbody');
$chunk = min($max, 1024);
if ($file
->openForRead()) {
while ($max > 0 && ($data = $file
->readBytes($chunk))) {
print $data;
$max -= $chunk;
}
$file
->close();
}
print "---------------------\n";
}
if ($this
->confGet('format') == 'html') {
print '</pre>';
}
exit;
}
public function configDefaults() {
return new Config([
'showmeta' => TRUE,
'showbody' => TRUE,
'maxbody' => 1024 * 16,
'format' => 'text',
]);
}
}