mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Merge pull request #13058 from appwrite/chore/migrate-to-storage-4
Migrate to utopia-php/storage 4.0
This commit is contained in:
18 files changed
+91
-65
No files matched your search
+2
-2
@@ -87,7 +87,7 @@
|
||||
"utopia-php/lock": "0.2.*",
|
||||
"utopia-php/logger": "0.8.*",
|
||||
"utopia-php/messaging": "^2.0",
|
||||
"utopia-php/migration": "^1.18.0",
|
||||
"utopia-php/migration": "^1.21.0",
|
||||
"utopia-php/platform": "^1.0@RC",
|
||||
"utopia-php/pools": "1.*",
|
||||
"utopia-php/span": "3.0.*",
|
||||
@@ -95,7 +95,7 @@
|
||||
"utopia-php/queue": "^0.22",
|
||||
"utopia-php/servers": "0.4.*",
|
||||
"utopia-php/registry": "0.5.*",
|
||||
"utopia-php/storage": "^3.1",
|
||||
"utopia-php/storage": "^4.0",
|
||||
"utopia-php/system": "0.10.*",
|
||||
"utopia-php/telemetry": "^0.4",
|
||||
"utopia-php/user-agent": "0.1.*",
|
||||
|
||||
Generated
+14
-14
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "a811ab43bece6d9d01be1caab8a08a75",
|
||||
"content-hash": "dd9294ec6748886d8819aa3c8ae438f8",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/jwt",
|
||||
@@ -4358,16 +4358,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/migration",
|
||||
"version": "1.20.1",
|
||||
"version": "1.21.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/migration.git",
|
||||
"reference": "9dc829536b545d548e1cd4a924776c625c3edab8"
|
||||
"reference": "4806dce18d6793b1cfd1b513b425245761933670"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/migration/zipball/9dc829536b545d548e1cd4a924776c625c3edab8",
|
||||
"reference": "9dc829536b545d548e1cd4a924776c625c3edab8",
|
||||
"url": "https://api.github.com/repos/utopia-php/migration/zipball/4806dce18d6793b1cfd1b513b425245761933670",
|
||||
"reference": "4806dce18d6793b1cfd1b513b425245761933670",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4378,7 +4378,7 @@
|
||||
"php": ">=8.5",
|
||||
"utopia-php/database": "^6.0.0",
|
||||
"utopia-php/dsn": "0.2.*",
|
||||
"utopia-php/storage": "3.*"
|
||||
"utopia-php/storage": "4.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-pdo": "*",
|
||||
@@ -4407,9 +4407,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/migration/issues",
|
||||
"source": "https://github.com/utopia-php/migration/tree/1.20.1"
|
||||
"source": "https://github.com/utopia-php/migration/tree/1.21.0"
|
||||
},
|
||||
"time": "2026-07-22T04:10:07+00:00"
|
||||
"time": "2026-07-31T09:11:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/mongo",
|
||||
@@ -4926,16 +4926,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/storage",
|
||||
"version": "3.1.0",
|
||||
"version": "4.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/storage.git",
|
||||
"reference": "38bfc0c14a16a7de2a86b3331865dad1230ed739"
|
||||
"reference": "ad05f341a9a62a4de73c5312f4ab6fe69f7d0051"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/storage/zipball/38bfc0c14a16a7de2a86b3331865dad1230ed739",
|
||||
"reference": "38bfc0c14a16a7de2a86b3331865dad1230ed739",
|
||||
"url": "https://api.github.com/repos/utopia-php/storage/zipball/ad05f341a9a62a4de73c5312f4ab6fe69f7d0051",
|
||||
"reference": "ad05f341a9a62a4de73c5312f4ab6fe69f7d0051",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4970,9 +4970,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/storage/issues",
|
||||
"source": "https://github.com/utopia-php/storage/tree/3.1.0"
|
||||
"source": "https://github.com/utopia-php/storage/tree/4.0.0"
|
||||
},
|
||||
"time": "2026-07-22T15:57:57+00:00"
|
||||
"time": "2026-07-23T20:37:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/system",
|
||||
|
||||
@@ -236,7 +236,7 @@ class Create extends Action
|
||||
}
|
||||
|
||||
if ($deployment->isEmpty()) {
|
||||
$deviceForFunctions->prepareUpload($path, $metadata['content_type'] ?? '', $chunks, $metadata);
|
||||
$deviceForFunctions->prepare($path, $metadata['content_type'] ?? '', $chunks, $metadata);
|
||||
|
||||
if (!empty($contentRange)) {
|
||||
$deployment = $deployments->upload($function, $deployment->setAttributes([
|
||||
@@ -266,7 +266,14 @@ class Create extends Action
|
||||
return;
|
||||
}
|
||||
|
||||
$chunksUploaded = $deviceForFunctions->uploadChunk($deviceForLocal->read($fileTmpName), $path, $chunk, $chunks, $metadata);
|
||||
$chunksUploaded = $deviceForFunctions->upload(
|
||||
$deviceForLocal->read($fileTmpName),
|
||||
$path,
|
||||
$metadata['content_type'] ?? '',
|
||||
$chunk,
|
||||
$chunks,
|
||||
$metadata
|
||||
);
|
||||
|
||||
if (empty($chunksUploaded)) {
|
||||
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed moving file');
|
||||
@@ -295,7 +302,7 @@ class Create extends Action
|
||||
$chunksUploaded = max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0));
|
||||
|
||||
if ($chunksUploaded === $chunks && $uploaded < $chunks) {
|
||||
$deviceForFunctions->finalizeUpload($path, $chunks, $metadata);
|
||||
$deviceForFunctions->finalize($path, $chunks, $metadata);
|
||||
|
||||
$fileSize = $deviceForFunctions->getFileSize($path);
|
||||
|
||||
|
||||
@@ -158,14 +158,14 @@ class Get extends Action
|
||||
->addHeader('Content-Length', $end - $start + 1)
|
||||
->setStatusCode(Response::STATUS_CODE_PARTIALCONTENT);
|
||||
|
||||
$response->send($device->read($path, $start, ($end - $start + 1)));
|
||||
$response->send((string) $device->read($path, $start, ($end - $start + 1)));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($size > APP_STORAGE_READ_BUFFER) {
|
||||
for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) {
|
||||
$response->chunk(
|
||||
$device->read(
|
||||
(string) $device->read(
|
||||
$path,
|
||||
($i * MAX_OUTPUT_CHUNK_SIZE),
|
||||
min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE))
|
||||
@@ -174,7 +174,7 @@ class Get extends Action
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$response->send($device->read($path));
|
||||
$response->send((string) $device->read($path));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ class Create extends Action
|
||||
$destination = '';
|
||||
if ($hasSource) {
|
||||
$destination = $deviceForFunctions->getPath($deploymentId . '.' . \pathinfo('code.tar.gz', PATHINFO_EXTENSION));
|
||||
$deviceForFunctions->transfer($path, $destination, $deviceForFunctions);
|
||||
$deviceForFunctions->copy($path, $destination);
|
||||
}
|
||||
|
||||
// Cloning the source deployment's attributes onto the new one, with
|
||||
|
||||
@@ -16,6 +16,7 @@ use Utopia\Database\Document;
|
||||
use Utopia\Database\Helpers\ID;
|
||||
use Utopia\Database\Query;
|
||||
use Utopia\Platform\Action;
|
||||
use Utopia\Psr7\Stream;
|
||||
use Utopia\Queue\Message;
|
||||
use Utopia\Span\Span;
|
||||
use Utopia\Storage\Device;
|
||||
@@ -171,7 +172,7 @@ class Screenshots extends Action
|
||||
$fileName = $fileId . '.png';
|
||||
$path = $deviceForFiles->getPath($fileName);
|
||||
$path = str_ireplace($deviceForFiles->getRoot(), $deviceForFiles->getRoot() . DIRECTORY_SEPARATOR . $bucket->getId(), $path); // Add bucket id to path after root
|
||||
$success = $deviceForFiles->write($path, $screenshot, $mimeType);
|
||||
$success = $deviceForFiles->write($path, new Stream($screenshot), $mimeType);
|
||||
|
||||
if (!$success) {
|
||||
throw new \Exception("Screenshot failed to save");
|
||||
|
||||
@@ -6,6 +6,7 @@ use Appwrite\Utopia\Response;
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Platform\Action;
|
||||
use Utopia\Platform\Scope\HTTP;
|
||||
use Utopia\Psr7\Stream;
|
||||
use Utopia\Storage\Device;
|
||||
|
||||
class Get extends Action
|
||||
@@ -42,11 +43,11 @@ class Get extends Action
|
||||
$path = $device->getPath(\uniqid('health', true));
|
||||
|
||||
try {
|
||||
if (!$device->write($path, 'test', 'text/plain')) {
|
||||
if (!$device->write($path, new Stream('test'), 'text/plain')) {
|
||||
throw new \Exception("Failed writing test file to {$device->getRoot()}");
|
||||
}
|
||||
|
||||
$content = $device->read($path);
|
||||
$content = (string) $device->read($path);
|
||||
if ($content !== 'test') {
|
||||
throw new \Exception("Failed reading test file from {$device->getRoot()}: content mismatch");
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ use Utopia\Migration\Transfer;
|
||||
use Utopia\Platform\Action;
|
||||
use Utopia\Platform\Enum;
|
||||
use Utopia\Platform\Scope\HTTP;
|
||||
use Utopia\Psr7\Stream;
|
||||
use Utopia\Storage\Device;
|
||||
use Utopia\System\System;
|
||||
use Utopia\Validator\Boolean;
|
||||
@@ -132,7 +133,7 @@ class Create extends Action
|
||||
$newPath = $deviceForMigrations->getPath($migrationId . '_' . $fileId . '.csv');
|
||||
|
||||
if ($hasEncryption || $hasCompression) {
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
|
||||
if ($hasEncryption) {
|
||||
$source = OpenSSL::decrypt(
|
||||
@@ -157,10 +158,10 @@ class Create extends Action
|
||||
}
|
||||
|
||||
// Manual write after decryption and/or decompression
|
||||
if (!$deviceForMigrations->write($newPath, $source, 'text/csv')) {
|
||||
if (!$deviceForMigrations->write($newPath, new Stream($source), 'text/csv')) {
|
||||
throw new \Exception('Unable to copy file');
|
||||
}
|
||||
} elseif (!$deviceForFiles->transfer($path, $newPath, $deviceForMigrations)) {
|
||||
} elseif (!$deviceForFiles->copy($path, $newPath, $deviceForMigrations)) {
|
||||
throw new \Exception('Unable to copy file');
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ use Utopia\Migration\Transfer;
|
||||
use Utopia\Platform\Action;
|
||||
use Utopia\Platform\Enum;
|
||||
use Utopia\Platform\Scope\HTTP;
|
||||
use Utopia\Psr7\Stream;
|
||||
use Utopia\Storage\Device;
|
||||
use Utopia\System\System;
|
||||
use Utopia\Validator\Boolean;
|
||||
@@ -131,7 +132,7 @@ class Create extends Action
|
||||
$newPath = $deviceForMigrations->getPath($migrationId . '_' . $fileId . '.json');
|
||||
|
||||
if ($hasEncryption || $hasCompression) {
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
|
||||
if ($hasEncryption) {
|
||||
$source = OpenSSL::decrypt(
|
||||
@@ -156,10 +157,10 @@ class Create extends Action
|
||||
}
|
||||
|
||||
// Manual write after decryption and/or decompression
|
||||
if (!$deviceForMigrations->write($newPath, $source, 'application/json')) {
|
||||
if (!$deviceForMigrations->write($newPath, new Stream($source), 'application/json')) {
|
||||
throw new \Exception('Unable to copy file');
|
||||
}
|
||||
} elseif (!$deviceForFiles->transfer($path, $newPath, $deviceForMigrations)) {
|
||||
} elseif (!$deviceForFiles->copy($path, $newPath, $deviceForMigrations)) {
|
||||
throw new \Exception('Unable to copy file');
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ class Create extends Action
|
||||
}
|
||||
|
||||
if ($deployment->isEmpty()) {
|
||||
$deviceForSites->prepareUpload($path, $metadata['content_type'] ?? '', $chunks, $metadata);
|
||||
$deviceForSites->prepare($path, $metadata['content_type'] ?? '', $chunks, $metadata);
|
||||
|
||||
if (!empty($contentRange)) {
|
||||
$deployment = $deployments->upload($site, $deployment->setAttributes([
|
||||
@@ -306,7 +306,14 @@ class Create extends Action
|
||||
return;
|
||||
}
|
||||
|
||||
$chunksUploaded = $deviceForSites->uploadChunk($deviceForLocal->read($fileTmpName), $path, $chunk, $chunks, $metadata);
|
||||
$chunksUploaded = $deviceForSites->upload(
|
||||
$deviceForLocal->read($fileTmpName),
|
||||
$path,
|
||||
$metadata['content_type'] ?? '',
|
||||
$chunk,
|
||||
$chunks,
|
||||
$metadata
|
||||
);
|
||||
|
||||
if (empty($chunksUploaded)) {
|
||||
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed moving file');
|
||||
@@ -335,7 +342,7 @@ class Create extends Action
|
||||
$chunksUploaded = max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0));
|
||||
|
||||
if ($chunksUploaded === $chunks && $uploaded < $chunks) {
|
||||
$deviceForSites->finalizeUpload($path, $chunks, $metadata);
|
||||
$deviceForSites->finalize($path, $chunks, $metadata);
|
||||
|
||||
$fileSize = $deviceForSites->getFileSize($path);
|
||||
$isNewDeployment = $deployment->isEmpty();
|
||||
|
||||
@@ -157,14 +157,14 @@ class Get extends Action
|
||||
->addHeader('Content-Length', $end - $start + 1)
|
||||
->setStatusCode(Response::STATUS_CODE_PARTIALCONTENT);
|
||||
|
||||
$response->send($device->read($path, $start, ($end - $start + 1)));
|
||||
$response->send((string) $device->read($path, $start, ($end - $start + 1)));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($size > APP_STORAGE_READ_BUFFER) {
|
||||
for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) {
|
||||
$response->chunk(
|
||||
$device->read(
|
||||
(string) $device->read(
|
||||
$path,
|
||||
($i * MAX_OUTPUT_CHUNK_SIZE),
|
||||
min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE))
|
||||
@@ -173,7 +173,7 @@ class Get extends Action
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$response->send($device->read($path));
|
||||
$response->send((string) $device->read($path));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ class Create extends Action
|
||||
$destination = '';
|
||||
if ($hasSource) {
|
||||
$destination = $deviceForSites->getPath($deploymentId . '.' . \pathinfo('code.tar.gz', PATHINFO_EXTENSION));
|
||||
$deviceForSites->transfer($path, $destination, $deviceForSites);
|
||||
$deviceForSites->copy($path, $destination);
|
||||
}
|
||||
|
||||
$commands = [];
|
||||
|
||||
@@ -34,6 +34,7 @@ use Utopia\Http\Adapter\Swoole\Request;
|
||||
use Utopia\Lock\Exception\Contention as LockContention;
|
||||
use Utopia\Platform\Action;
|
||||
use Utopia\Platform\Scope\HTTP;
|
||||
use Utopia\Psr7\Stream;
|
||||
use Utopia\Storage\Device;
|
||||
use Utopia\Storage\DeviceType;
|
||||
use Utopia\Storage\Validator\FileExt;
|
||||
@@ -287,7 +288,7 @@ class Create extends Action
|
||||
}
|
||||
|
||||
if ($file->isEmpty()) {
|
||||
$deviceForFiles->prepareUpload($path, $metadata['content_type'] ?? '', $chunks, $metadata);
|
||||
$deviceForFiles->prepare($path, $metadata['content_type'] ?? '', $chunks, $metadata);
|
||||
|
||||
if (!empty($contentRange)) {
|
||||
$doc = new Document([
|
||||
@@ -357,7 +358,7 @@ class Create extends Action
|
||||
$chunksUploaded = max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0));
|
||||
|
||||
if ($chunksUploaded === $chunks && $uploaded < $chunks) {
|
||||
$deviceForFiles->finalizeUpload($path, $chunks, $metadata);
|
||||
$deviceForFiles->finalize($path, $chunks, $metadata);
|
||||
|
||||
if (System::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled' && $bucket->getAttribute('antivirus', true) && $fileSize <= APP_LIMIT_ANTIVIRUS && $deviceForFiles->getType() === DeviceType::Local) {
|
||||
$antivirus = new Network(
|
||||
@@ -379,7 +380,7 @@ class Create extends Action
|
||||
// Compression
|
||||
$algorithm = $bucket->getAttribute('compression', Compression::NONE);
|
||||
if ($fileSize <= APP_STORAGE_READ_BUFFER && $algorithm != Compression::NONE) {
|
||||
$data = $deviceForFiles->read($path);
|
||||
$data = (string) $deviceForFiles->read($path);
|
||||
switch ($algorithm) {
|
||||
case Compression::ZSTD:
|
||||
$compressor = new Zstd();
|
||||
@@ -399,7 +400,7 @@ class Create extends Action
|
||||
|
||||
if ($bucket->getAttribute('encryption', true) && $fileSize <= APP_STORAGE_READ_BUFFER) {
|
||||
if (empty($data)) {
|
||||
$data = $deviceForFiles->read($path);
|
||||
$data = (string) $deviceForFiles->read($path);
|
||||
}
|
||||
$key = System::getEnv('_APP_OPENSSL_KEY_V1');
|
||||
$iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM));
|
||||
@@ -407,7 +408,7 @@ class Create extends Action
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
if (!$deviceForFiles->write($path, $data, $mimeType)) {
|
||||
if (!$deviceForFiles->write($path, new Stream($data), $mimeType)) {
|
||||
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to save file');
|
||||
}
|
||||
}
|
||||
@@ -516,7 +517,14 @@ class Create extends Action
|
||||
};
|
||||
|
||||
try {
|
||||
$chunksUploaded = $deviceForFiles->uploadChunk($deviceForLocal->read($fileTmpName), $path, $chunk, $chunks, $metadata);
|
||||
$chunksUploaded = $deviceForFiles->upload(
|
||||
$deviceForLocal->read($fileTmpName),
|
||||
$path,
|
||||
$metadata['content_type'] ?? '',
|
||||
$chunk,
|
||||
$chunks,
|
||||
$metadata
|
||||
);
|
||||
|
||||
if (empty($chunksUploaded)) {
|
||||
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed uploading file');
|
||||
|
||||
@@ -159,7 +159,7 @@ class Get extends Action
|
||||
|
||||
$source = '';
|
||||
if (!empty($file->getAttribute('openSSLCipher'))) { // Decrypt
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
$source = OpenSSL::decrypt(
|
||||
$source,
|
||||
$file->getAttribute('openSSLCipher'),
|
||||
@@ -173,14 +173,14 @@ class Get extends Action
|
||||
switch ($file->getAttribute('algorithm', Compression::NONE)) {
|
||||
case Compression::ZSTD:
|
||||
if (empty($source)) {
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
}
|
||||
$compressor = new Zstd();
|
||||
$source = $compressor->decompress($source);
|
||||
break;
|
||||
case Compression::GZIP:
|
||||
if (empty($source)) {
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
}
|
||||
$compressor = new GZIP();
|
||||
$source = $compressor->decompress($source);
|
||||
@@ -197,14 +197,14 @@ class Get extends Action
|
||||
}
|
||||
|
||||
if (!empty($rangeHeader)) {
|
||||
$response->send($deviceForFiles->read($path, $start, ($end - $start + 1)));
|
||||
$response->send((string) $deviceForFiles->read($path, $start, ($end - $start + 1)));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($size > APP_STORAGE_READ_BUFFER) {
|
||||
for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) {
|
||||
$response->chunk(
|
||||
$deviceForFiles->read(
|
||||
(string) $deviceForFiles->read(
|
||||
$path,
|
||||
($i * MAX_OUTPUT_CHUNK_SIZE),
|
||||
min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE))
|
||||
@@ -213,7 +213,7 @@ class Get extends Action
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$response->send($deviceForFiles->read($path));
|
||||
$response->send((string) $deviceForFiles->read($path));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,7 +210,7 @@ class Get extends Action
|
||||
|
||||
$startTime = \microtime(true);
|
||||
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
|
||||
$downloadTime = \microtime(true) - $startTime;
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ class Get extends Action
|
||||
|
||||
$source = '';
|
||||
if (!empty($file->getAttribute('openSSLCipher'))) { // Decrypt
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
$source = OpenSSL::decrypt(
|
||||
$source,
|
||||
$file->getAttribute('openSSLCipher'),
|
||||
@@ -165,14 +165,14 @@ class Get extends Action
|
||||
switch ($file->getAttribute('algorithm', Compression::NONE)) {
|
||||
case Compression::ZSTD:
|
||||
if (empty($source)) {
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
}
|
||||
$compressor = new Zstd();
|
||||
$source = $compressor->decompress($source);
|
||||
break;
|
||||
case Compression::GZIP:
|
||||
if (empty($source)) {
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
}
|
||||
$compressor = new GZIP();
|
||||
$source = $compressor->decompress($source);
|
||||
@@ -189,7 +189,7 @@ class Get extends Action
|
||||
}
|
||||
|
||||
if (!empty($rangeHeader)) {
|
||||
$response->send($deviceForFiles->read($path, $start, ($end - $start + 1)));
|
||||
$response->send((string) $deviceForFiles->read($path, $start, ($end - $start + 1)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ class Get extends Action
|
||||
if ($size > APP_STORAGE_READ_BUFFER) {
|
||||
for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) {
|
||||
$response->chunk(
|
||||
$deviceForFiles->read(
|
||||
(string) $deviceForFiles->read(
|
||||
$path,
|
||||
($i * MAX_OUTPUT_CHUNK_SIZE),
|
||||
min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE))
|
||||
@@ -206,7 +206,7 @@ class Get extends Action
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$response->send($deviceForFiles->read($path));
|
||||
$response->send((string) $deviceForFiles->read($path));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ class Get extends Action
|
||||
|
||||
$source = '';
|
||||
if (!empty($file->getAttribute('openSSLCipher'))) { // Decrypt
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
$source = OpenSSL::decrypt(
|
||||
$source,
|
||||
$file->getAttribute('openSSLCipher'),
|
||||
@@ -184,14 +184,14 @@ class Get extends Action
|
||||
switch ($file->getAttribute('algorithm', Compression::NONE)) {
|
||||
case Compression::ZSTD:
|
||||
if (empty($source)) {
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
}
|
||||
$compressor = new Zstd();
|
||||
$source = $compressor->decompress($source);
|
||||
break;
|
||||
case Compression::GZIP:
|
||||
if (empty($source)) {
|
||||
$source = $deviceForFiles->read($path);
|
||||
$source = (string) $deviceForFiles->read($path);
|
||||
}
|
||||
$compressor = new GZIP();
|
||||
$source = $compressor->decompress($source);
|
||||
@@ -208,7 +208,7 @@ class Get extends Action
|
||||
}
|
||||
|
||||
if (!empty($rangeHeader)) {
|
||||
$response->send($deviceForFiles->read($path, $start, ($end - $start + 1)));
|
||||
$response->send((string) $deviceForFiles->read($path, $start, ($end - $start + 1)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ class Get extends Action
|
||||
if ($size > APP_STORAGE_READ_BUFFER) {
|
||||
for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) {
|
||||
$response->chunk(
|
||||
$deviceForFiles->read(
|
||||
(string) $deviceForFiles->read(
|
||||
$path,
|
||||
($i * MAX_OUTPUT_CHUNK_SIZE),
|
||||
min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE))
|
||||
@@ -225,7 +225,7 @@ class Get extends Action
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$response->send($deviceForFiles->read($path));
|
||||
$response->send((string) $deviceForFiles->read($path));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1008,7 +1008,7 @@ class Messaging extends Action
|
||||
}
|
||||
|
||||
if ($deviceForFiles->getType() !== DeviceType::Local) {
|
||||
$deviceForFiles->transfer($path, $path, $this->getLocalDevice($project));
|
||||
$deviceForFiles->copy($path, $path, $this->getLocalDevice($project));
|
||||
}
|
||||
|
||||
$attachment = new Attachment(
|
||||
|
||||
Reference in new issue
Block a user