mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Refactor
This commit is contained in:
parent
0df1396d52
commit
f02707627f
2 changed files with 11 additions and 4 deletions
|
|
@ -1312,7 +1312,12 @@ App::post('/v1/functions/:functionId/deployments')
|
|||
throw new Exception(Exception::STORAGE_FILE_EMPTY, 'No file sent');
|
||||
}
|
||||
|
||||
$functionFileSize = isset($plan['functionSize']) ? $plan['functionSize'] * 1000 * 1000 : (System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT') ?: 30000000);
|
||||
$functionFileSize = (System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT') ?: 30000000);
|
||||
|
||||
if (isset($plan['functionSize'])) {
|
||||
$functionFileSize = $plan['functionSize'] * 1000 * 1000;
|
||||
}
|
||||
|
||||
$fileExt = new FileExt([FileExt::TYPE_GZIP]);
|
||||
$fileSizeValidator = new FileSize($functionFileSize);
|
||||
$upload = new Upload();
|
||||
|
|
|
|||
|
|
@ -405,9 +405,11 @@ class Builds extends Action
|
|||
|
||||
$directorySize = $localDevice->getDirectorySize($tmpDirectory);
|
||||
|
||||
$functionsSizeLimit = empty($plan['functionSize'])
|
||||
? (int) System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT', 30000000)
|
||||
: (int) $plan['functionSize'] * 1000 * 1000;
|
||||
$functionsSizeLimit = (int) (System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT') ?: 30000000);
|
||||
|
||||
if (!empty($plan['functionSize'])) {
|
||||
$functionsSizeLimit = (int) $plan['functionSize'] * 1000 * 1000;
|
||||
}
|
||||
|
||||
if ($directorySize > $functionsSizeLimit) {
|
||||
throw new \Exception('Repository directory size should be less than ' . number_format($functionsSizeLimit / 1048576, 2) . ' MBs.');
|
||||
|
|
|
|||
Loading…
Reference in a new issue