예제 #1
0
 /**
  * {@inheritdoc}
  */
 function saveFile(BackupFileReadableInterface $file)
 {
     $out = array();
     // 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;
 }