debug: add more debug console log

This commit is contained in:
Mustaque Ahmed
2025-09-26 15:37:36 +05:30
parent 241342db64
commit eae3982599
2 changed files with 19 additions and 13 deletions
+17 -13
View File
@@ -563,7 +563,11 @@ App::post('/v1/storage/buckets/:bucketId/files')
$file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId);
$metadata = ['content_type' => $deviceForLocal->getFileMimeType($fileTmpName)];
$print_mime_type = ['content_type' => $deviceForLocal->getFileMimeType($fileTmpName)];
Console::log('@@@debug-mustaq content type of file ' . $print_mime_type);
Console::log('@@@debug-mustaq device for files ' . json_encode($deviceForFiles));
Console::log('@@@debug-mustaq device for local ' . json_encode($deviceForLocal));
$metadata = ['content_type' => 'image/jpeg'];
if (!$file->isEmpty()) {
$chunks = $file->getAttribute('chunksTotal', 1);
$uploaded = $file->getAttribute('chunksUploaded', 0);
@@ -985,18 +989,18 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
$fileSecurity = $bucket->getAttribute('fileSecurity', false);
$validator = new Authorization(Database::PERMISSION_READ);
$valid = $validator->isValid($bucket->getRead());
Console::log("@@@debug-mustaq");
Console::log(json_encode([
"isToken" => $isToken,
"bucket" => $bucket,
"resourceToken" => $resourceToken,
"bucketInternalId" => $resourceToken->getAttribute("bucketInternalId"),
"sequence" => $bucket->getSequence(),
"fileSecurity" => $fileSecurity,
"validator" => $validator,
"bucketGetRead" => $bucket->getRead(),
"valid" => $valid,
], JSON_PRETTY_PRINT));
Console::log("@@@debug-mustaq");
Console::log(json_encode([
"isToken" => $isToken,
"bucket" => $bucket,
"resourceToken" => $resourceToken,
"bucketInternalId" => $resourceToken->getAttribute("bucketInternalId"),
"sequence" => $bucket->getSequence(),
"fileSecurity" => $fileSecurity,
"validator" => $validator,
"bucketGetRead" => $bucket->getRead(),
"valid" => $valid,
], JSON_PRETTY_PRINT));
// if (!$fileSecurity && !$valid && !$isToken) {
// throw new Exception(Exception::USER_UNAUTHORIZED);
// }
+2
View File
@@ -586,8 +586,10 @@ function getDevice(string $root, string $connection = ''): Device
switch (strtolower(System::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL) ?? '')) {
case Storage::DEVICE_LOCAL:
default:
Console::log("@@@debug-mustaq Selected local storage");
return new Local($root);
case Storage::DEVICE_S3:
Console::log("@@@debug-mustaq Selected s3 storage");
$s3AccessKey = System::getEnv('_APP_STORAGE_S3_ACCESS_KEY', '');
$s3SecretKey = System::getEnv('_APP_STORAGE_S3_SECRET', '');
$s3Region = System::getEnv('_APP_STORAGE_S3_REGION', '');