DebugDestination.php in Backup and Migrate 5.0.x
File
src/Core/Destination/DebugDestination.php
View source
<?php
namespace Drupal\backup_migrate\Core\Destination;
use Drupal\backup_migrate\Core\Config\Config;
use Drupal\backup_migrate\Core\File\BackupFileReadableInterface;
class DebugDestination extends StreamDestination implements WritableDestinationInterface {
public 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',
]);
}
}