mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
chore: format
This commit is contained in:
@@ -175,23 +175,23 @@ abstract class Migration
|
||||
Console::log('Migrating Collection ' . $collection['$id'] . ':');
|
||||
|
||||
foreach ($this->documentsIterator($collection['$id']) as $document) {
|
||||
if (empty($document->getId()) || empty($document->getCollection())) {
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
try {
|
||||
$this->projectDB->updateDocument($document->getCollection(), $document->getId(), $document);
|
||||
} catch (\Throwable $th) {
|
||||
Console::error('Failed to update document: ' . $th->getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace Appwrite\Platform\Tasks;
|
||||
use Appwrite\Migration\Migration;
|
||||
use Redis;
|
||||
use Utopia\App;
|
||||
use Utopia\Cache\Cache;
|
||||
use Utopia\CLI\Console;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\Document;
|
||||
@@ -38,8 +37,8 @@ class Migrate extends Action
|
||||
->inject('authorization')
|
||||
->inject('console')
|
||||
->callback(function ($version, $dbForConsole, $getProjectDB, Registry $register, Authorization $authorization, Document $console) {
|
||||
\Co\run(function () use ($version, $dbForConsole, $getProjectDB, $register, Authorization $authorization, Document $console) {
|
||||
$this->action($version, $dbForConsole, $getProjectDB, $register, Authorization $authorization, Document $console);
|
||||
\Co\run(function () use ($version, $dbForConsole, $getProjectDB, $register, $authorization, $console) {
|
||||
$this->action($version, $dbForConsole, $getProjectDB, $register, $authorization, $console);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -47,7 +46,16 @@ class Migrate extends Action
|
||||
private function clearProjectsCache(Document $project)
|
||||
{
|
||||
try {
|
||||
$cache->purge("cache-_{$project->getInternalId()}:*");
|
||||
$iterator = null;
|
||||
do {
|
||||
$pattern = "default-cache-_{$project->getInternalId()}:*";
|
||||
$keys = $this->redis->scan($iterator, $pattern, 1000);
|
||||
if ($keys !== false) {
|
||||
foreach ($keys as $key) {
|
||||
$this->redis->del($key);
|
||||
}
|
||||
}
|
||||
} while ($iterator > 0);
|
||||
} catch (\Throwable $th) {
|
||||
Console::error('Failed to clear project ("' . $project->getId() . '") cache with error: ' . $th->getMessage());
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ use Appwrite\Utopia\Fetch\BodyMultipart;
|
||||
use Appwrite\Utopia\Response\Filter;
|
||||
use Exception;
|
||||
use JsonException;
|
||||
use Swoole\Http\Response as SwooleHTTPResponse;
|
||||
// Keep last
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Swoole\Response as SwooleResponse;
|
||||
|
||||
// Keep last
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
namespace Appwrite\Utopia\Response;
|
||||
|
||||
use Appwrite\Utopia\Fetch\BodyMultipart;
|
||||
use Appwrite\Utopia\Response\Filter;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
use Appwrite\Utopia\Response\Model\Account;
|
||||
use Appwrite\Utopia\Response\Model\AlgoArgon2;
|
||||
use Appwrite\Utopia\Response\Model\AlgoBcrypt;
|
||||
@@ -109,11 +106,8 @@ use Appwrite\Utopia\Response\Model\Variable;
|
||||
use Appwrite\Utopia\Response\Model\VcsContent;
|
||||
use Appwrite\Utopia\Response\Model\Webhook;
|
||||
use Exception;
|
||||
use JsonException;
|
||||
use Swoole\Http\Response as SwooleHTTPResponse;
|
||||
|
||||
// Keep last
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Swoole\Response as SwooleResponse;
|
||||
|
||||
class Models
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user