private function TarArchiveReader::readLongHeader in Backup and Migrate 5.0.x
Read a tar file header block for files with long names.
Parameters
array $header:
Return value
array
Throws
\Drupal\backup_migrate\Core\Exception\BackupMigrateException
1 call to TarArchiveReader::readLongHeader()
- TarArchiveReader::readHeader in src/
Core/ Service/ TarArchiveReader.php - Read a tar file header block.
File
- src/
Core/ Service/ TarArchiveReader.php, line 349
Class
- TarArchiveReader
- @package Drupal\backup_migrate\Core\Service
Namespace
Drupal\backup_migrate\Core\ServiceCode
private function readLongHeader(array $header) {
$filename = '';
$filesize = $header['size'];
$n = floor($header['size'] / 512);
for ($i = 0; $i < $n; $i++) {
$content = $this->archive
->readBytes(512);
$filename .= $content;
}
if ($header['size'] % 512 != 0) {
$content = $this->archive
->readBytes(512);
$filename .= $content;
}
$filename = rtrim(substr($filename, 0, $filesize), "\0");
// Read the next header.
$data = $this->archive
->readBytes(512);
$header = $this
->readHeader($data, $header);
$header['filename'] = $filename;
return $header;
}