Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ brick/math/psalm*.xmls

deepdiver/zipstreamer/test

deepdiver1975/tarstreamer/.drone.star
deepdiver1975/tarstreamer/.phan
deepdiver1975/tarstreamer/.php-cs-fixer.dist.php
deepdiver1975/tarstreamer/Makefile
deepdiver1975/tarstreamer/vendor-bin

doctrine/dbal/.doctrine-project.json
doctrine/dbal/.gitmodules
doctrine/dbal/build.*
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"bantu/ini-get-wrapper": "v1.0.1",
"cweagans/composer-patches": "^1.7",
"deepdiver/zipstreamer": "2.0.0",
"deepdiver1975/tarstreamer": "v2.0.0",
"deepdiver1975/tarstreamer": "^2.1.0",
"doctrine/dbal": "3.3.8",
"egulias/email-validator": "^3.2.5",
"fusonic/opengraph": "^2.2",
Expand Down
26 changes: 18 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 18 additions & 8 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -437,29 +437,35 @@
},
{
"name": "deepdiver1975/tarstreamer",
"version": "2.0.0",
"version_normalized": "2.0.0.0",
"version": "v2.1.0",
"version_normalized": "2.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/owncloud/TarStreamer.git",
"reference": "ad48505d1ab54a8e94e6b1cc5297bbed72e956de"
"reference": "163052d7a076fd3dd54d4f50e1ff2705b72604db"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/owncloud/TarStreamer/zipball/ad48505d1ab54a8e94e6b1cc5297bbed72e956de",
"reference": "ad48505d1ab54a8e94e6b1cc5297bbed72e956de",
"url": "https://api.github.com/repos/owncloud/TarStreamer/zipball/163052d7a076fd3dd54d4f50e1ff2705b72604db",
"reference": "163052d7a076fd3dd54d4f50e1ff2705b72604db",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.5",
"pear/archive_tar": "~1.4",
"pear/pear-core-minimal": "v1.10.10",
"phpunit/phpunit": "^7.5"
"pear/pear-core-minimal": "v1.10.13",
"phpunit/phpunit": "^7.5|^8.5|^9.6"
},
"time": "2020-01-08T09:55:35+00:00",
"time": "2023-06-16T08:01:55+00:00",
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": false
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
Expand All @@ -478,6 +484,10 @@
"stream",
"tar"
],
"support": {
"issues": "https://github.com/owncloud/TarStreamer/issues",
"source": "https://github.com/owncloud/TarStreamer/tree/v2.1.0"
},
"install-path": "../deepdiver1975/tarstreamer"
},
{
Expand Down
10 changes: 5 additions & 5 deletions composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'nextcloud/3rdparty',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'cda5f3a36ed1880823a373ba79801f0e75bd5c8d',
'reference' => 'ac62120ff1cdcdac50ad931ee0988ab337867a01',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand Down Expand Up @@ -74,9 +74,9 @@
'dev_requirement' => false,
),
'deepdiver1975/tarstreamer' => array(
'pretty_version' => '2.0.0',
'version' => '2.0.0.0',
'reference' => 'ad48505d1ab54a8e94e6b1cc5297bbed72e956de',
'pretty_version' => 'v2.1.0',
'version' => '2.1.0.0',
'reference' => '163052d7a076fd3dd54d4f50e1ff2705b72604db',
'type' => 'library',
'install_path' => __DIR__ . '/../deepdiver1975/tarstreamer',
'aliases' => array(),
Expand Down Expand Up @@ -310,7 +310,7 @@
'nextcloud/3rdparty' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'cda5f3a36ed1880823a373ba79801f0e75bd5c8d',
'reference' => 'ac62120ff1cdcdac50ad931ee0988ab337867a01',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand Down
52 changes: 25 additions & 27 deletions deepdiver1975/tarstreamer/src/TarHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ class TarHeader {
private $size;

private $mtime = '';

private $checksum;


private $typeflag;

private $linkname = '';
Expand All @@ -37,39 +35,39 @@ class TarHeader {

private $reserved = '';

public function setName($name){
public function setName($name) {
$this->name = $name;
return $this;
}

public function setSize($size){
public function setSize($size) {
$this->size = $size;
return $this;
}

public function setMtime($mtime){
public function setMtime($mtime) {
$this->mtime = $mtime;
return $this;
}

public function setTypeflag($typeflag){
public function setTypeflag($typeflag) {
$this->typeflag = $typeflag;
return $this;
}

public function setPrefix($prefix){
public function setPrefix($prefix) {
$this->prefix = $prefix;
return $this;
}

public function getHeader(){
public function getHeader() {
$fields = [
['a100', substr($this->name, 0, 100)],
['a8', str_pad($this->mode, 7, '0', STR_PAD_LEFT)],
['a8', decoct(str_pad($this->uid, 7, '0', STR_PAD_LEFT))],
['a8', decoct(str_pad($this->gid, 7, '0', STR_PAD_LEFT))],
['a12', str_pad(decoct($this->size), 11, '0', STR_PAD_LEFT)],
['a12', str_pad(decoct($this->mtime), 11, '0', STR_PAD_LEFT)],
['a8', decoct((int) str_pad($this->uid, 7, '0', STR_PAD_LEFT))],
['a8', decoct((int) str_pad($this->gid, 7, '0', STR_PAD_LEFT))],
['a12', str_pad(decoct((int)$this->size), 11, '0', STR_PAD_LEFT)],
['a12', str_pad(decoct((int)$this->mtime), 11, '0', STR_PAD_LEFT)],
// We calculate checksum later
['a8', ''],
['a1', $this->typeflag],
Expand All @@ -89,11 +87,11 @@ public function getHeader(){

// Compute header checksum
$checksum = str_pad(decoct($this->computeUnsignedChecksum($header)), 6, "0", STR_PAD_LEFT);
for ($i = 0; $i < 6; $i++){
for ($i = 0; $i < 6; $i++) {
$header[(148 + $i)] = substr($checksum, $i, 1);
}
$header[154] = chr(0);
$header[155] = chr(32);
$header[154] = \chr(0);
$header[155] = \chr(32);

return $header;
}
Expand All @@ -104,11 +102,11 @@ public function getHeader(){
* @param array $fields key being the format string and value being the data to pack
* @return string binary packed data returned from pack()
*/
protected function packFields($fields){
list ($fmt, $args) = ['', []];
protected function packFields($fields) {
list($fmt, $args) = ['', []];

// populate format string and argument list
foreach ($fields as $field){
foreach ($fields as $field) {
$fmt .= $field[0];
$args[] = $field[1];
}
Expand All @@ -117,24 +115,24 @@ protected function packFields($fields){
array_unshift($args, $fmt);

// build output string from header and compressed data
return call_user_func_array('pack', $args);
return \call_user_func_array('pack', $args);
}

/**
* Generate unsigned checksum of header
*
* @param string $header
* @return string unsigned checksum
* @return float|int unsigned checksum
*/
protected function computeUnsignedChecksum($header){
protected function computeUnsignedChecksum($header) {
$unsignedChecksum = 0;
for ($i = 0; $i < 512; $i++){
$unsignedChecksum += ord($header[$i]);
for ($i = 0; $i < 512; $i++) {
$unsignedChecksum += \ord($header[$i]);
}
for ($i = 0; $i < 8; $i++){
$unsignedChecksum -= ord($header[148 + $i]);
for ($i = 0; $i < 8; $i++) {
$unsignedChecksum -= \ord($header[148 + $i]);
}
$unsignedChecksum += ord(" ") * 8;
$unsignedChecksum += \ord(" ") * 8;

return $unsignedChecksum;
}
Expand Down
Loading