1
0
Fork 0
mirror of synced 2024-09-28 15:31:43 +12:00
This commit is contained in:
Jake Barnby 2024-09-04 21:06:59 +12:00
parent 72d6fb3901
commit e90b1d219e
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
11 changed files with 16 additions and 16 deletions

View file

@ -314,7 +314,7 @@ class Exception extends \Exception
$this->code = $code ?? $this->errors[$type]['code']; $this->code = $code ?? $this->errors[$type]['code'];
// Mark string errors like HY001 from PDO as 500 errors // Mark string errors like HY001 from PDO as 500 errors
if(\is_string($this->code)) { if (\is_string($this->code)) {
if (\is_numeric($this->code)) { if (\is_numeric($this->code)) {
$this->code = (int) $this->code; $this->code = (int) $this->code;
} else { } else {

View file

@ -44,7 +44,7 @@ class Headers extends Validator
return false; return false;
} }
if(\count($value) > $this->maxKeys) { if (\count($value) > $this->maxKeys) {
return false; return false;
} }
@ -57,7 +57,7 @@ class Headers extends Validator
} }
$size += $length + \strlen($val); $size += $length + \strlen($val);
if($size >= $this->maxSize) { if ($size >= $this->maxSize) {
return false; return false;
} }

View file

@ -208,7 +208,7 @@ class Builds extends Action
} }
try { try {
if($isNewBuild && !$isVcsEnabled) { if ($isNewBuild && !$isVcsEnabled) {
// Non-vcs+Template // Non-vcs+Template
$templateRepositoryName = $template->getAttribute('repositoryName', ''); $templateRepositoryName = $template->getAttribute('repositoryName', '');
@ -279,7 +279,7 @@ class Builds extends Action
$cloneVersion = $branchName; $cloneVersion = $branchName;
$cloneType = GitHub::CLONE_TYPE_BRANCH; $cloneType = GitHub::CLONE_TYPE_BRANCH;
if(!empty($commitHash)) { if (!empty($commitHash)) {
$cloneVersion = $commitHash; $cloneVersion = $commitHash;
$cloneType = GitHub::CLONE_TYPE_COMMIT; $cloneType = GitHub::CLONE_TYPE_COMMIT;
} }
@ -543,7 +543,7 @@ class Builds extends Action
deploymentId: $deployment->getId(), deploymentId: $deployment->getId(),
projectId: $project->getId(), projectId: $project->getId(),
callback: function ($logs) use (&$response, &$err, &$build, $dbForProject, $allEvents, $project, &$isCanceled) { callback: function ($logs) use (&$response, &$err, &$build, $dbForProject, $allEvents, $project, &$isCanceled) {
if($isCanceled) { if ($isCanceled) {
return; return;
} }

View file

@ -669,7 +669,7 @@ class Messaging extends Action
private function getLocalDevice($project): Local private function getLocalDevice($project): Local
{ {
if($this->localDevice === null) { if ($this->localDevice === null) {
$this->localDevice = new Local(APP_STORAGE_UPLOADS . '/app-' . $project->getId()); $this->localDevice = new Local(APP_STORAGE_UPLOADS . '/app-' . $project->getId());
} }

View file

@ -287,7 +287,7 @@ class Swagger2 extends Format
} }
$validatorClass = (!empty($validator)) ? \get_class($validator) : ''; $validatorClass = (!empty($validator)) ? \get_class($validator) : '';
if($validatorClass === 'Utopia\Validator\AnyOf') { if ($validatorClass === 'Utopia\Validator\AnyOf') {
$validator = $param['validator']->getValidators()[0]; $validator = $param['validator']->getValidators()[0];
$validatorClass = \get_class($validator); $validatorClass = \get_class($validator);
} }

View file

@ -33,13 +33,13 @@ class V16 extends Filter
protected function parseDeployment(array $content) protected function parseDeployment(array $content)
{ {
if(isset($content['buildLogs'])) { if (isset($content['buildLogs'])) {
$content['buildStderr'] = ''; $content['buildStderr'] = '';
$content['buildStdout'] = $content['buildLogs']; $content['buildStdout'] = $content['buildLogs'];
unset($content['buildLogs']); unset($content['buildLogs']);
} }
if(isset($content['buildSize'])) { if (isset($content['buildSize'])) {
$content['size'] += + $content['buildSize'] ?? 0; $content['size'] += + $content['buildSize'] ?? 0;
unset($content['buildSize']); unset($content['buildSize']);
} }

View file

@ -25,8 +25,8 @@ class V18 extends Filter
protected function parseExecution(array $content) protected function parseExecution(array $content)
{ {
if(!empty($content['status']) && !empty($content['statusCode'])) { if (!empty($content['status']) && !empty($content['statusCode'])) {
if($content['status'] === 'completed' && $content['statusCode'] >= 400 && $content['statusCode'] < 500) { if ($content['status'] === 'completed' && $content['statusCode'] >= 400 && $content['statusCode'] < 500) {
$content['status'] = 'failed'; $content['status'] = 'failed';
} }
} }

View file

@ -217,7 +217,7 @@ class Executor
'restartPolicy' => 'always' // Once utopia/orchestration has it, use DockerAPI::ALWAYS (0.13+) 'restartPolicy' => 'always' // Once utopia/orchestration has it, use DockerAPI::ALWAYS (0.13+)
]; ];
if(!empty($body)) { if (!empty($body)) {
$params['body'] = $body; $params['body'] = $body;
} }

View file

@ -34,7 +34,7 @@ trait FunctionsBase
\sleep(1); \sleep(1);
} }
if($checkForSuccess) { if ($checkForSuccess) {
$this->assertEquals(200, $deployment['headers']['status-code']); $this->assertEquals(200, $deployment['headers']['status-code']);
$this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body'])); $this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body']));
} }

View file

@ -1072,7 +1072,7 @@ class FunctionsCustomServerTest extends Scope
$found = false; $found = false;
foreach ($response['body']['deployments'] as $deployment) { foreach ($response['body']['deployments'] as $deployment) {
if($deployment['$id'] === $deploymentId) { if ($deployment['$id'] === $deploymentId) {
$found = true; $found = true;
$this->assertEquals($deploymentSize, $deployment['size']); $this->assertEquals($deploymentSize, $deployment['size']);
break; break;

View file

@ -31,7 +31,7 @@ trait WebhooksBase
\sleep(1); \sleep(1);
} }
if($checkForSuccess) { if ($checkForSuccess) {
$this->assertEquals(200, $deployment['headers']['status-code']); $this->assertEquals(200, $deployment['headers']['status-code']);
$this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body'])); $this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body']));
} }