Merge branch '1.8.x' into chore-upgrade-cache

This commit is contained in:
premtsd-code 2026-02-03 05:58:33 +00:00 committed by GitHub
commit b4e98bd950
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 26 additions and 24 deletions

View file

@ -44,6 +44,7 @@ Config::setParam('runtimes', (new Runtimes('v5'))->getAll(supported: false));
// require controllers after overwriting runtimes // require controllers after overwriting runtimes
require_once __DIR__ . '/controllers/general.php'; require_once __DIR__ . '/controllers/general.php';
global $register;
CLI::setResource('register', fn () => $register); CLI::setResource('register', fn () => $register);
CLI::setResource('cache', function ($pools) { CLI::setResource('cache', function ($pools) {

View file

@ -10,7 +10,7 @@ class Exception extends AppwriteException
protected string $error = ''; protected string $error = '';
protected string $errorDescription = ''; protected string $errorDescription = '';
public function __construct(string $response = '', int $code = 0, \Throwable $previous = null) public function __construct(string $response = '', int $code = 0, ?\Throwable $previous = null)
{ {
$this->response = $response; $this->response = $response;
$this->message = $response; $this->message = $response;

View file

@ -392,9 +392,9 @@ class Exception extends \Exception
public function __construct( public function __construct(
string $type = Exception::GENERAL_UNKNOWN, string $type = Exception::GENERAL_UNKNOWN,
string $message = null, ?string $message = null,
int|string $code = null, int|string|null $code = null,
\Throwable $previous = null, ?\Throwable $previous = null,
?string $view = null, ?string $view = null,
array $params = [] array $params = []
) { ) {

View file

@ -297,7 +297,7 @@ class Realtime extends MessagingAdapter
* @return array * @return array
* @throws \Exception * @throws \Exception
*/ */
public static function fromPayload(string $event, Document $payload, Document $project = null, Document $database = null, Document $collection = null, Document $bucket = null): array public static function fromPayload(string $event, Document $payload, ?Document $project = null, ?Document $database = null, ?Document $collection = null, ?Document $bucket = null): array
{ {
$channels = []; $channels = [];
$roles = []; $roles = [];

View file

@ -211,7 +211,7 @@ abstract class Migration
* @return void * @return void
* @throws \Throwable * @throws \Throwable
*/ */
protected function createCollection(string $id, string $name = null): void protected function createCollection(string $id, ?string $name = null): void
{ {
$name ??= $id; $name ??= $id;
@ -262,7 +262,7 @@ abstract class Migration
Database $database, Database $database,
string $collectionId, string $collectionId,
array $attributeIds, array $attributeIds,
string $from = null ?string $from = null
): void { ): void {
$from ??= $collectionId; $from ??= $collectionId;
@ -327,7 +327,7 @@ abstract class Migration
Database $database, Database $database,
string $collectionId, string $collectionId,
string $attributeId, string $attributeId,
string $from = null ?string $from = null
): void { ): void {
$from ??= $collectionId; $from ??= $collectionId;
@ -385,7 +385,7 @@ abstract class Migration
* @throws Duplicate * @throws Duplicate
* @throws Limit * @throws Limit
*/ */
public function createIndexFromCollection(Database $database, string $collectionId, string $indexId, string $from = null): void public function createIndexFromCollection(Database $database, string $collectionId, string $indexId, ?string $from = null): void
{ {
$from ??= $collectionId; $from ??= $collectionId;

View file

@ -44,7 +44,7 @@ class Action extends UtopiaAction
* *
* @return void * @return void
*/ */
protected function foreachDocument(Database $database, string $collection, array $queries = [], callable $callback = null, int $limit = 1000, bool $concurrent = false): void protected function foreachDocument(Database $database, string $collection, array $queries = [], ?callable $callback = null, int $limit = 1000, bool $concurrent = false): void
{ {
$results = []; $results = [];
$sum = $limit; $sum = $limit;

View file

@ -144,7 +144,7 @@ class Base extends Action
return $deployment; return $deployment;
} }
public function redeployVcsSite(Request $request, Document $site, Document $project, Document $installation, Database $dbForProject, Database $dbForPlatform, Build $queueForBuilds, Document $template, GitHub $github, bool $activate, Authorization $authorization, string $referenceType = 'branch', string $reference = '', array $platform): Document public function redeployVcsSite(Request $request, Document $site, Document $project, Document $installation, Database $dbForProject, Database $dbForPlatform, Build $queueForBuilds, Document $template, GitHub $github, bool $activate, Authorization $authorization, array $platform, string $referenceType = 'branch', string $reference = ''): Document
{ {
$deploymentId = ID::unique(); $deploymentId = ID::unique();
$providerInstallationId = $installation->getAttribute('providerInstallationId', ''); $providerInstallationId = $installation->getAttribute('providerInstallationId', '');

View file

@ -488,7 +488,7 @@ abstract class Action extends UtopiaAction
return $attribute; return $attribute;
} }
protected function updateAttribute(string $databaseId, string $collectionId, string $key, Database $dbForProject, Event $queueForEvents, Authorization $authorization, string $type, int $size = null, string $filter = null, string|bool|int|float|array $default = null, bool $required = null, int|float|null $min = null, int|float|null $max = null, array $elements = null, array $options = [], string $newKey = null): Document protected function updateAttribute(string $databaseId, string $collectionId, string $key, Database $dbForProject, Event $queueForEvents, Authorization $authorization, string $type, ?int $size = null, ?string $filter = null, string|bool|int|float|array|null $default = null, ?bool $required = null, int|float|null $min = null, int|float|null $max = null, ?array $elements = null, array $options = [], ?string $newKey = null): Document
{ {
$db = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); $db = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId));

View file

@ -578,7 +578,7 @@ class Databases extends Action
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
protected function deleteByGroup(string $collectionId, array $queries, Database $database, callable $callback = null): void protected function deleteByGroup(string $collectionId, array $queries, Database $database, ?callable $callback = null): void
{ {
$start = \microtime(true); $start = \microtime(true);

View file

@ -23,6 +23,7 @@ use Utopia\Database\Exception\Conflict;
use Utopia\Database\Exception\Restricted; use Utopia\Database\Exception\Restricted;
use Utopia\Database\Exception\Structure; use Utopia\Database\Exception\Structure;
use Utopia\Database\Query; use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\DSN\DSN; use Utopia\DSN\DSN;
use Utopia\Logger\Log; use Utopia\Logger\Log;
use Utopia\Platform\Action; use Utopia\Platform\Action;
@ -335,7 +336,7 @@ class Deletes extends Action
* @throws Authorization * @throws Authorization
* @throws Exception * @throws Exception
*/ */
private function deleteCacheByResource(Document $project, callable $getProjectDB, string $resource, string $resourceType = null): void private function deleteCacheByResource(Document $project, callable $getProjectDB, string $resource, ?string $resourceType = null): void
{ {
$projectId = $project->getId(); $projectId = $project->getId();
$dbForProject = $getProjectDB($project); $dbForProject = $getProjectDB($project);
@ -1316,7 +1317,7 @@ class Deletes extends Action
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
protected function listByGroup(string $collection, array $queries, Database $database, callable $callback = null): void protected function listByGroup(string $collection, array $queries, Database $database, ?callable $callback = null): void
{ {
$count = 0; $count = 0;
$limit = 1000; $limit = 1000;

View file

@ -272,8 +272,8 @@ class Functions extends Action
string $path, string $path,
string $method, string $method,
Document $user, Document $user,
string $jwt = null, ?string $jwt = null,
string $event = null, ?string $event = null,
): void { ): void {
$executionId = ID::unique(); $executionId = ID::unique();
$headers['x-appwrite-execution-id'] = $executionId ?? ''; $headers['x-appwrite-execution-id'] = $executionId ?? '';
@ -357,12 +357,12 @@ class Functions extends Action
string $method, string $method,
array $headers, array $headers,
array $platform, array $platform,
string $data = null, ?string $data = null,
?Document $user = null, ?Document $user = null,
string $jwt = null, ?string $jwt = null,
string $event = null, ?string $event = null,
string $eventData = null, ?string $eventData = null,
string $executionId = null, ?string $executionId = null,
): void { ): void {
$user ??= new Document(); $user ??= new Document();
$functionId = $function->getId(); $functionId = $function->getId();

View file

@ -131,7 +131,7 @@ class User extends Document
return false; return false;
} }
public function tokenVerify(int $type = null, string $secret, Proof $proofForToken): false|Document public function tokenVerify(?int $type, string $secret, Proof $proofForToken): false|Document
{ {
$tokens = $this->getAttribute('tokens', []); $tokens = $this->getAttribute('tokens', []);
foreach ($tokens as $token) { foreach ($tokens as $token) {

View file

@ -10,7 +10,7 @@ class BodyMultipart
private array $parts = []; private array $parts = [];
private string $boundary = ""; private string $boundary = "";
public function __construct(string $boundary = null) public function __construct(?string $boundary = null)
{ {
if (is_null($boundary)) { if (is_null($boundary)) {
$this->boundary = self::generateBoundary(); $this->boundary = self::generateBoundary();