This commit is contained in:
Daniil Gentili 2019-12-27 21:24:50 +01:00
parent 1110a70bcd
commit 99300304f1
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
4 changed files with 32 additions and 23 deletions

View File

@ -123,6 +123,7 @@ Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgro
* [Putting it all together](https://docs.madelineproto.xyz/docs/CALLS.html#putting-it-all-together)
* [Accepting calls](https://docs.madelineproto.xyz/docs/CALLS.html#accepting-calls)
* [Uploading and downloading files](https://docs.madelineproto.xyz/docs/FILES.html)
* [Bot API file IDs](https://docs.madelineproto.xyz/docs/FILES.html#bot-api-file-ids)
* [Uploading & sending files](https://docs.madelineproto.xyz/docs/FILES.html#sending-files)
* [Security notice](https://docs.madelineproto.xyz/docs/FILES.html#security-notice)
* [Photos](https://docs.madelineproto.xyz/docs/FILES.html#inputmediauploadedphoto)
@ -133,13 +134,15 @@ Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgro
* [Videos](https://docs.madelineproto.xyz/docs/FILES.html#documentattributevideo-to-send-a-video)
* [Audio & Voice](https://docs.madelineproto.xyz/docs/FILES.html#documentattributeaudio-to-send-an-audio-file)
* [Uploading files](https://docs.madelineproto.xyz/docs/FILES.html#uploading-files)
* [Bot API file IDs](https://docs.madelineproto.xyz/docs/FILES.html#bot-api-file-ids)
* [Reusing uploaded files](https://docs.madelineproto.xyz/docs/FILES.html#reusing-uploaded-files)
* [Renaming files](https://docs.madelineproto.xyz/docs/FILES.html#renaming-files)
* [Downloading files](https://docs.madelineproto.xyz/docs/FILES.html#downloading-files)
* [Extracting download info](https://docs.madelineproto.xyz/docs/FILES.html#extracting-download-info)
* [Downloading profile pictures](https://docs.madelineproto.xyz/docs/FILES.html#downloading-profile-pictures)
* [Download to directory](https://docs.madelineproto.xyz/docs/FILES.html#download-to-directory)
* [Download to file](https://docs.madelineproto.xyz/docs/FILES.html#download-to-file)
* [Download to stream](https://docs.madelineproto.xyz/docs/FILES.html#download-to-stream)
* [Download to callback](https://docs.madelineproto.xyz/docs/FILES.html#download-to-callback)
* [Download to browser (streaming)](https://docs.madelineproto.xyz/docs/FILES.html#download-to-browser-with-streams)
* [Getting progress](https://docs.madelineproto.xyz/docs/FILES.html#getting-progress)
* [Getting info about chats](https://docs.madelineproto.xyz/docs/CHAT_INFO.html)

2
docs

@ -1 +1 @@
Subproject commit 4bc0ee99f5e5a2f52b419675b572165452fe824c
Subproject commit 1e235370a12eaeb14892da99833d42638420e722

View File

@ -4797,7 +4797,7 @@ class InternalDoc extends APIFactory
/**
* Upload file from stream.
*
* @param mixed $stream Stream
* @param mixed $stream PHP resource or AMPHP async stream
* @param integer $size File size
* @param string $mime Mime type
* @param string $file_name File name
@ -4813,19 +4813,22 @@ class InternalDoc extends APIFactory
/**
* Upload file from callable.
*
* The callable must accept two parameters: int $offset, int $size
* The callable must return a string with the contest of the file at the specified offset and size.
*
* @param mixed $callable Callable
* @param integer $size File size
* @param string $mime Mime type
* @param string $file_name File name
* @param callable $cb Callback (DEPRECATED, use FileCallbackInterface)
* @param boolean $refetchable Whether each chunk can be refetched more than once
* @param boolean $seekable Whether chunks can be fetched out of order
* @param boolean $encrypted Whether to encrypt file for secret chats
*
* @return array
*/
public function uploadFromCallable($callable, int $size, string $mime, string $file_name = '', $cb = null, bool $refetchable = true, bool $encrypted = false, array $extra = [])
public function uploadFromCallable($callable, int $size, string $mime, string $file_name = '', $cb = null, bool $seekable = true, bool $encrypted = false, array $extra = [])
{
return $this->__call(__FUNCTION__, [$callable, $size, $mime, $file_name, $cb, $refetchable, $encrypted, $extra]);
return $this->__call(__FUNCTION__, [$callable, $size, $mime, $file_name, $cb, $seekable, $encrypted, $extra]);
}
/**
* Upload file to secret chat.

View File

@ -146,7 +146,7 @@ trait Files
/**
* Upload file from stream.
*
* @param mixed $stream Stream
* @param mixed $stream PHP resource or AMPHP async stream
* @param integer $size File size
* @param string $mime Mime type
* @param string $file_name File name
@ -218,17 +218,20 @@ trait Files
/**
* Upload file from callable.
*
* The callable must accept two parameters: int $offset, int $size
* The callable must return a string with the contest of the file at the specified offset and size.
*
* @param mixed $callable Callable
* @param integer $size File size
* @param string $mime Mime type
* @param string $file_name File name
* @param callable $cb Callback (DEPRECATED, use FileCallbackInterface)
* @param boolean $refetchable Whether each chunk can be refetched more than once
* @param boolean $seekable Whether chunks can be fetched out of order
* @param boolean $encrypted Whether to encrypt file for secret chats
*
* @return array
*/
public function uploadFromCallable($callable, int $size, string $mime, string $file_name = '', $cb = null, bool $refetchable = true, bool $encrypted = false)
public function uploadFromCallable($callable, int $size, string $mime, string $file_name = '', $cb = null, bool $seekable = true, bool $encrypted = false)
{
if (\is_object($callable) && $callable instanceof FileCallbackInterface) {
$cb = $callable;
@ -267,7 +270,7 @@ trait Files
$ige->setIV($iv);
$ige->setKey($key);
$ige->enableContinuousBuffer();
$refetchable = false;
$seekable = false;
}
$ctx = \hash_init('md5');
$promises = [];
@ -299,7 +302,7 @@ trait Files
return ['file_id' => $file_id, 'file_part' => $part_num, 'file_total_parts' => $part_total_num, 'bytes' => $bytes];
},
$refetchable
$seekable
),
['heavy' => true, 'file' => true, 'datacenter' => &$datacenter]
);