download: disable time limit

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/653/head
Varun Patil 2023-04-21 11:06:04 -07:00
parent 5e0af5a2e9
commit 0abdb57f28
1 changed files with 3 additions and 5 deletions

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Memories\Controller;
use bantu\IniGetWrapper\IniGetWrapper;
use OCA\Memories\Exceptions;
use OCA\Memories\Util;
use OCP\AppFramework\Http;
@ -210,6 +209,9 @@ class DownloadController extends GenericApiController
// Start output buffering
ob_start();
// Disable time limit
@set_time_limit(0);
while (!feof($res) && $seekStart <= $seekEnd) {
$lenLeft = $seekEnd - $seekStart + 1;
$buffer = fread($res, min(1024 * 1024, $lenLeft));
@ -253,7 +255,6 @@ class DownloadController extends GenericApiController
{
return Util::guardExDirect(function ($out) use ($name, $fileIds) {
// Disable time limit
$executionTime = (int) \OC::$server->get(IniGetWrapper::class)->getNumeric('max_execution_time');
@set_time_limit(0);
// Ensure we can abort the request if user stops it
@ -349,9 +350,6 @@ class DownloadController extends GenericApiController
}
}
// Restore time limit
@set_time_limit($executionTime);
// Done
$streamer->finalize();
});