public function TarArchiveWriter::addFile in Backup and Migrate 8.4
Parameters
string $real_path: The real path to the file. Can be a stream URI.
string $new_path: The path that the file should have in the archive. Leave blank to use the original path.
Overrides ArchiveWriterInterface::addFile
File
- lib/
backup_migrate_core/ src/ Service/ TarArchiveWriter.php, line 39
Class
- TarArchiveWriter
- Class TarArchiver.
Namespace
BackupMigrate\Core\ServiceCode
public function addFile($real_path, $new_path = '') {
$this->archive
->openForWrite(TRUE);
$new_path = $new_path ? $new_path : $real_path;
$this
->writeHeader($real_path, $new_path);
$fp = @fopen($real_path, "rb");
while (($v_buffer = fread($fp, 512)) != '') {
$v_binary_data = pack("a512", "{$v_buffer}");
$this->archive
->write($v_binary_data);
}
fclose($fp);
}