Skip to content

Commit 3764690

Browse files
Remove no-longer-relevant 1024-patches-per-upload limit
1 parent 285b979 commit 3764690

1 file changed

Lines changed: 2 additions & 25 deletions

File tree

src/Vimeo/Vimeo.php

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,9 @@ private function _authHeader(): string
584584
*/
585585
private function perform_upload_tus(string $file_path, $file_size, array $attempt, ?int $override_chunk_size = null): string
586586
{
587-
$default_chunk_size = (100 * 1024 * 1024); // 100 MB
587+
$chunk_size = (100 * 1024 * 1024); // 100 MB
588588
if ($override_chunk_size) {
589-
$default_chunk_size = $override_chunk_size;
589+
$chunk_size = $override_chunk_size;
590590
}
591591

592592
$url = $attempt['body']['upload']['upload_link'];
@@ -600,7 +600,6 @@ private function perform_upload_tus(string $file_path, $file_size, array $attemp
600600

601601
$bytes_uploaded = 0;
602602
$failures = 0;
603-
$chunk_size = $this->getTusUploadChunkSize($default_chunk_size, (int)$file_size);
604603

605604
$client = $this->_tus_client_factory->getTusClient($base_url, $url);
606605
$client->setApiPath($api_path);
@@ -627,26 +626,4 @@ private function perform_upload_tus(string $file_path, $file_size, array $attemp
627626

628627
return $attempt['body']['uri'];
629628
}
630-
631-
/**
632-
* Enforces the notion that a user may supply any `proposed_chunk_size`, as long as it results in 1024 or less
633-
* proposed chunks. In the event it does not, then the chunk size becomes the file size divided by 1024.
634-
*
635-
* @param int $proposed_chunk_size
636-
* @param int $file_size
637-
* @return int
638-
*/
639-
private function getTusUploadChunkSize(int $proposed_chunk_size, int $file_size): int
640-
{
641-
$proposed_chunk_size = ($proposed_chunk_size <= 0) ? 1 : $proposed_chunk_size;
642-
$chunks = floor($file_size / $proposed_chunk_size);
643-
$divides_evenly = $file_size % $proposed_chunk_size === 0;
644-
$number_of_chunks_proposed = ($divides_evenly) ? $chunks : $chunks + 1;
645-
646-
if ($number_of_chunks_proposed > 1024) {
647-
return (int)floor($file_size / 1024) + 1;
648-
}
649-
650-
return $proposed_chunk_size;
651-
}
652629
}

0 commit comments

Comments
 (0)