8000 Sync 1.5.x into main by stnguyen90 · Pull Request #8509 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Sync 1.5.x into main #8509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "app/console"]
path = app/console
url = https://github.com/appwrite/console
branch = 4.3.27
branch = 4.3.30
31 changes: 31 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# Version 1.5.10

## What's Changed

### Notable changes

* Bump console to version 4.3.30 in [#8520](https://github.com/appwrite/appwrite/pull/8520)

### Fixes

* Fix migration stuck at "Starting Data Migration [...]" in [#8519](https://github.com/appwrite/appwrite/pull/8519)

# Version 1.5.9

## What's Changed

### Notable changes

* Add Darija (Moroccan Arabic) translation file in [7501](https://github.com/appwrite/appwrite/pull/7501)
* Bump console to version 4.3.29 in [8504](https://github.com/appwrite/appwrite/pull/8504)

### Fixes

* Fix domain check in [8472](https://github.com/appwrite/appwrite/pull/8472)
* Fix "API must be called in the coroutine" in [8495](https://github.com/appwrite/appwrite/pull/8495)
* Bump executor version from 0.5.5 to 0.5.7 in [8502](https://github.com/appwrite/appwrite/pull/8502)

### Miscellaneous
* Add profiler for debugging in [8397](https://github.com/appwrite/appwrite/pull/8397)
* Document APIs that don't support redirects in [8233](https://github.com/appwrite/appwrite/pull/8233)

# Version 1.5.8

## What's Changed
Expand Down
6 changes: 3 additions & 3 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="install" \
appwrite/appwrite:1.5.8
appwrite/appwrite:1.5.10
```

### Windows
Expand All @@ -79,7 +79,7 @@ docker run -it --rm ^
--volume //var/run/docker.sock:/var/run/docker.sock ^
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
--entrypoint="install" ^
appwrite/appwrite:1.5.8
appwrite/appwrite:1.5.10
```

#### PowerShell
Expand All @@ -89,7 +89,7 @@ docker run -it --rm `
--volume /var/run/docker.sock:/var/run/docker.sock `
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
--entrypoint="install" `
appwrite/appwrite:1.5.8
appwrite/appwrite:1.5.10
```

运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="install" \
appwrite/appwrite:1.5.8
appwrite/appwrite:1.5.10
```

### Windows
Expand All @@ -87,7 +87,7 @@ docker run -it --rm ^
--volume //var/run/docker.sock:/var/run/docker.sock ^
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
--entrypoint="install" ^
appwrite/appwrite:1.5.8
appwrite/appwrite:1.5.10
```

#### PowerShell
Expand All @@ -97,7 +97,7 @@ docker run -it --rm `
--volume /var/run/docker.sock:/var/run/docker.sock `
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
--entrypoint="install" `
appwrite/appwrite:1.5.8
appwrite/appwrite:1.5.10
```

Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation.
Expand Down
2 changes: 1 addition & 1 deletion app/console
4 changes: 2 additions & 2 deletions app/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours
const APP_USER_ACCCESS = 24 * 60 * 60; // 24 hours
const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours
const APP_CACHE_BUSTER = 4327;
const APP_VERSION_STABLE = '1.5.8';
const APP_CACHE_BUSTER = 4330;
const APP_VERSION_STABLE = '1.5.10';
const APP_DATABASE_ATTRIBUTE_EMAIL = 'email';
const APP_DATABASE_ATTRIBUTE_ENUM = 'enum';
const APP_DATABASE_ATTRIBUTE_IP = 'ip';
Expand Down
2 changes: 1 addition & 1 deletion app/views/install/compose.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ $image = $this->getParam('image', '');
<<: *x-logging
restart: unless-stopped
stop_signal: SIGINT
image: openruntimes/executor:0.5.5
image: openruntimes/executor:0.5.7
networks:
- appwrite
- runtimes
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ services:
hostname: exc1
<<: *x-logging
stop_signal: SIGINT
image: openruntimes/executor:0.5.5
image: openruntimes/executor:0.5.7
restart: unless-stopped
networks:
- appwrite
Expand Down
46 changes: 23 additions & 23 deletions src/Appwrite/Migration/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ abstract class Migration
'1.5.6' => 'V20',
'1.5.7' => 'V20',
'1.5.8' => 'V20',
'1.5.9' => 'V20',
'1.5.10' => 'V20',
];

/**
Expand Down Expand Up @@ -171,29 +173,27 @@ public function forEachDocument(callable $callback): void

Console::log('Migrating Collection ' . $collection['$id'] . ':');

\Co\run(function (array $collection, callable $callback) {
foreach ($this->documentsIterator($collection['$id']) as $document) {
go(function (Document $document, callable $callback) {
if (empty($document->getId()) || empty($document->getCollection())) {
return;
}

$old = $document->getArrayCopy();
$new = call_user_func($callback, $document);

if (is_null($new) || $new->getArrayCopy() == $old) {
return;
}

try {
$this->projectDB->updateDocument($document->getCollection(), $document->getId(), $document);
} catch (\Throwable $th) {
Console::error('Failed to update document: ' . $th->getMessage());
return;
}
}, $document, $callback);
}
}, $collection, $callback);
foreach ($this->documentsIterator($collection['$id']) as $document) {
go(function (Document $document, callable $callback) {
if (empty($document->getId()) || empty($document->getCollection())) {
return;
}

$old = $document->getArrayCopy();
$new = call_user_func($callback, $document);

if (is_null($new) || $new->getArrayCopy() == $old) {
return;
}

try {
$this->projectDB->updateDocument($document->getCollection(), $document->getId(), $document);
} catch (\Throwable $th) {
Console::error('Failed to update document: ' . $th->getMessage());
return;
}
}, $document, $callback);
}
}
}

Expand Down
38 changes: 18 additions & 20 deletions src/Appwrite/Migration/Version/V19.php
Original file line number Diff line number Diff line change
Expand Up @@ -816,29 +816,27 @@ public function forEachDocument(callable $callback): void

Console::log('Migrating Collection ' . $collection['$id'] . ':');

\Co\run(function (array $collection, callable $callback) {
foreach ($this->documentsIterator($collection['$id']) as $document) {
go(function (Document $document, callable $callback) {
if (empty($document->getId()) || empty($document->getCollection())) {
return;
}
foreach ($this->documentsIterator($collection['$id']) as $document) {
go(function (Document $document, callable $callback) {
if (empty($document->getId()) || empty($document->getCollection())) {
return;
}

$old = $document->getArrayCopy();
$new = call_user_func($callback, $document);
$old = $document->getArrayCopy();
$new = call_user_func($callback, $document);

if (is_null($new) || $new->getArrayCopy() == $old) {
return;
}
if (is_null($new) || $new->getArrayCopy() == $old) {
return;
}

try {
$this->projectDB->updateDocument($document->getCollection(), $document->getId(), $document);
} catch (\Throwable $th) {
Console::error('Failed to update document: ' . $th->getMessage());
return;
}
}, $document, $callback);
}
}, $collection, $callback);
try {
$this->projectDB->updateDocument($document->getCollection(), $document->getId(), $document);
} catch (\Throwable $th) {
Console::error('Failed to update document: ' . $th->getMessage());
return;
}
}, $document, $callback);
}
}
}
}
24 changes: 13 additions & 11 deletions src/Appwrite/Platform/Tasks/Migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@ public function __construct()
->inject('dbForConsole')
->inject('getProjectDB')
->inject('register')
->callback(fn ($version, $dbForConsole, $getProjectDB, Registry $register) => $this->action($version, $dbForConsole, $getProjectDB, $register));

->callback(function ($version, $dbForConsole, $getProjectDB, Registry $register) {
\Co\run(function () use ($version, $dbForConsole, $getProjectDB, $register) {
$this->action($version, $dbForConsole, $getProjectDB, $register);
});
});
}

private function clearProjectsCache(Document $project)
{
try {
$iterator = null;
do {
$iterator = null;
$pattern = "default-cache-_{$project->getInternalId()}:*";
$keys = $this->redis->scan($iterator, $pattern, 1000);
if ($keys !== false) {
Expand All @@ -50,16 +53,15 @@ private function clearProjectsCache(Document $project)
}
}
} while ($iterator > 0);

} catch (\Throwable $th) {
Console::error('Failed to clear project ("'.$project->getId().'") cache with error: '.$th->getMessage());
Console::error('Failed to clear project ("' . $project->getId() . '") cache with error: ' . $th->getMessage());
}
}

public function action(string $version, Database $dbForConsole, callable $getProjectDB, Registry $register)
{
Authorization::disable();
if (! array_key_exists($version, Migration::$versions)) {
if (!array_key_exists($version, Migration::$versions)) {
Console::error("Version {$version} not found.");
Console::exit(1);

Expand All @@ -77,7 +79,7 @@ public function action(string $version, Database $dbForConsole, callable $getPro

$app = new App('UTC');

Console::success('Starting Data Migration to version '.$version);
Console::success('Starting Data Migration to version ' . $version);

$console = $app->getResource('console');

Expand All @@ -97,11 +99,11 @@ public function action(string $version, Database $dbForConsole, callable $getPro
$totalProjects = $dbForConsole->count('projects') + 1;
}

$class = 'Appwrite\\Migration\\Version\\'.Migration::$versions[$version];
$class = 'Appwrite\\Migration\\Version\\' . Migration::$versions[$version];
/** @var Migration $migration */
$migration = new $class();

while (! empty($projects)) {
while (!empty($projects)) {
foreach ($projects as $project) {
/**
* Skip user projects with id 'console'
Expand All @@ -122,7 +124,7 @@ public function action(string $version, Database $dbForConsole, callable $getPro
->setPDO($register->get('db', true))
->execute();
} catch (\Throwable $th) {
Console::error('Failed to update project ("'.$project->getId().'") version with error: '.$th->getMessage());
Console::error('Failed to update project ("' . $project->getId() . '") version with error: ' . $th->getMessage());
throw $th;
}

Expand All @@ -135,7 +137,7 @@ public function action(string $version, Database $dbForConsole, callable $getPro
$offset = $offset + $limit;
$count = $count + $sum;

Console::log('Migrated '.$count.'/'.$totalProjects.' projects...');
Console::log('Migrated ' . $count . '/' . $totalProjects . ' projects...');
}

Console::success('Data Migration Completed');
Expand Down
Loading
0