From 439e42e1ab76b1915e983ddf77bc47364cdb57fd Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:49:37 -0400 Subject: [PATCH] review: addressing --- app/controllers/general.php | 8 ++------ app/init.php | 2 +- mariadb-config.cnf | 2 -- src/Appwrite/Auth/Validator/MockNumber.php | 3 ++- tests/e2e/Services/Databases/DatabasesBase.php | 9 +-------- 5 files changed, 6 insertions(+), 18 deletions(-) delete mode 100644 mariadb-config.cnf diff --git a/app/controllers/general.php b/app/controllers/general.php index 5b79709176..d37b4b6ef4 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -731,9 +731,8 @@ Http::error() Console::error('[Error] File: ' . $file); Console::error('[Error] Line: ' . $line); } - switch ($class) { - case 'Utopia\Servers\Exception': + case 'Utopia\Http\Exception': $error = new AppwriteException(AppwriteException::GENERAL_UNKNOWN, $message, $code, $error); switch ($code) { case 400: @@ -958,7 +957,7 @@ Http::get('/humans.txt') ->inject('geodb') ->inject('route') ->inject('authorization') - ->action(function (Request $request, Response $response, Database $dbForConsole, callable $getProjectDB, Event $queueForEvents, Usage $queueForUsage, Reader $geodb, ?Route $route, Authorization $authorization) { + ->action(function (Request $request, Response $response, Database $dbForConsole, callable $getProjectDB, Event $queueForEvents, Usage $queueForUsage, Reader $geodb, Route $route, Authorization $authorization) { $host = $request->getHostname() ?? ''; $mainDomain = System::getEnv('_APP_DOMAIN', ''); @@ -966,9 +965,6 @@ Http::get('/humans.txt') $template = new View(__DIR__ . '/../views/general/humans.phtml'); $response->text($template->render(false)); } else { - if (is_null($route)) { - $route = new Route($request->getMethod(), $request->getURI()); - } router($dbForConsole, $getProjectDB, $request, $response, $route, $queueForEvents, $queueForUsage, $geodb, $authorization); } }); diff --git a/app/init.php b/app/init.php index 2d458330f9..49cb7e8920 100644 --- a/app/init.php +++ b/app/init.php @@ -307,7 +307,7 @@ $registry->set( ]; $pools = []; - $poolSize = (int)System::getEnv('_APP_POOL_CLIENTS', 64); + $poolSize = (int)System::getEnv('_APP_POOL_SIZE', 64); foreach ($connections as $key => $connection) { $dsns = $connection['dsns'] ?? ''; diff --git a/mariadb-config.cnf b/mariadb-config.cnf deleted file mode 100644 index 601dccc285..0000000000 --- a/mariadb-config.cnf +++ /dev/null @@ -1,2 +0,0 @@ -[mysqld] -max_connections=1024 \ No newline at end of file diff --git a/src/Appwrite/Auth/Validator/MockNumber.php b/src/Appwrite/Auth/Validator/MockNumber.php index af976f77f8..b92bb3b6bf 100644 --- a/src/Appwrite/Auth/Validator/MockNumber.php +++ b/src/Appwrite/Auth/Validator/MockNumber.php @@ -3,6 +3,7 @@ namespace Appwrite\Auth\Validator; use Utopia\Http\Validator; +use Utopia\Http\Validator\Text; /** * MockNumber. @@ -45,7 +46,7 @@ class MockNumber extends Validator return false; } - $otp = new Validator\Text(6, 6, Validator\Text::NUMBERS); + $otp = new Text(6, 6, Validator\Text::NUMBERS); if (!$otp->isValid($value['otp'])) { $this->message = 'Invalid OTP. Please make sure the OTP is a 6 digit number'; return false; diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index d92e814bdc..61932fc92a 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -2868,14 +2868,7 @@ trait DatabasesBase $this->assertEquals('Invalid document structure: Attribute "floatRange" has invalid format. Value must be a valid range between 1 and 1', $badFloatRange['body']['message']); $this->assertEquals('Invalid document structure: Attribute "probability" has invalid format. Value must be a valid range between 0 and 1', $badProbability['body']['message']); $this->assertEquals('Invalid document structure: Attribute "upperBound" has invalid format. Value must be a valid range between -9,223,372,036,854,775,808 and 10', $tooHigh['body']['message']); - - $max = '9,223,372,036,854,775,807'; - - if (PHP_VERSION_ID < 80300) { - $max = '9,223,372,036,854,775,808'; - } - - $this->assertEquals('Invalid document structure: Attribute "lowerBound" has invalid format. Value must be a valid range between 5 and '.$max, $tooLow['body']['message']); + $this->assertEquals('Invalid document structure: Attribute "lowerBound" has invalid format. Value must be a valid range between 5 and '.\number_format(PHP_INT_MAX), $tooLow['body']['message']); } /**