mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
Merge pull request #10958 from appwrite/revert-backups-endpoints
Revert backups endpoints
This commit is contained in:
commit
8cd000c42d
3 changed files with 20 additions and 8 deletions
|
|
@ -628,7 +628,6 @@ App::init()
|
|||
$queueForFunctions->setPlatform($platform);
|
||||
$queueForBuilds->setPlatform($platform);
|
||||
$queueForMails->setPlatform($platform);
|
||||
$queueForMigrations->setPlatform($platform);
|
||||
|
||||
// Clone the queues, to prevent events triggered by the database listener
|
||||
// from overwriting the events that are supposed to be triggered in the shutdown hook.
|
||||
|
|
|
|||
|
|
@ -737,6 +737,7 @@ services:
|
|||
- _APP_MIGRATIONS_FIREBASE_CLIENT_ID
|
||||
- _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET
|
||||
- _APP_DATABASE_SHARED_TABLES
|
||||
- _APP_OPTIONS_FORCE_HTTPS
|
||||
|
||||
appwrite-task-maintenance:
|
||||
entrypoint: maintenance
|
||||
|
|
|
|||
|
|
@ -52,8 +52,6 @@ class Migrations extends Action
|
|||
|
||||
protected array $plan;
|
||||
|
||||
protected array $platform;
|
||||
|
||||
/**
|
||||
* @var array<string, int>
|
||||
*/
|
||||
|
|
@ -108,7 +106,6 @@ class Migrations extends Action
|
|||
$this->deviceForMigrations = $deviceForMigrations;
|
||||
$this->deviceForFiles = $deviceForFiles;
|
||||
$this->plan = $plan;
|
||||
$this->platform = $payload['platform'] ?? [];
|
||||
|
||||
if (empty($payload)) {
|
||||
throw new Exception('Missing payload');
|
||||
|
|
@ -144,10 +141,15 @@ class Migrations extends Action
|
|||
$credentials = $migration->getAttribute('credentials');
|
||||
$migrationOptions = $migration->getAttribute('options');
|
||||
$dataSource = Appwrite::SOURCE_API;
|
||||
$endpoint = $this->platform['endpoint'] ?: ($credentials['endpoint'] ?? 'http://appwrite.test/v1');
|
||||
$database = null;
|
||||
$queries = [];
|
||||
|
||||
if ($credentials['endpoint'] === 'http://localhost/v1') {
|
||||
$platform = Config::getParam('platform', []);
|
||||
$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https';
|
||||
$credentials['endpoint'] = $protocol . '://' . $platform['apiHostname'] . '/v1';
|
||||
}
|
||||
|
||||
if ($source === Appwrite::getName() && $destination === DestinationCSV::getName()) {
|
||||
$dataSource = Appwrite::SOURCE_DATABASE;
|
||||
$database = $this->dbForProject;
|
||||
|
|
@ -178,7 +180,7 @@ class Migrations extends Action
|
|||
),
|
||||
SourceAppwrite::getName() => new SourceAppwrite(
|
||||
$credentials['projectId'],
|
||||
$endpoint,
|
||||
$credentials['endpoint'],
|
||||
$credentials['apiKey'],
|
||||
$dataSource,
|
||||
$database,
|
||||
|
|
@ -206,10 +208,13 @@ class Migrations extends Action
|
|||
$destination = $migration->getAttribute('destination');
|
||||
$options = $migration->getAttribute('options', []);
|
||||
|
||||
$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https';
|
||||
$platform = Config::getParam('platform', []);
|
||||
|
||||
return match ($destination) {
|
||||
DestinationAppwrite::getName() => new DestinationAppwrite(
|
||||
$this->project->getId(),
|
||||
$this->platform['endpoint'],
|
||||
$protocol . '://' . $platform['apiHostname'] . '/v1',
|
||||
$apiKey,
|
||||
$this->dbForProject,
|
||||
Config::getParam('collections', [])['databases']['collections'],
|
||||
|
|
@ -306,6 +311,8 @@ class Migrations extends Action
|
|||
|
||||
$transfer = $source = $destination = null;
|
||||
|
||||
|
||||
|
||||
try {
|
||||
if (
|
||||
$migration->getAttribute('source') === SourceAppwrite::getName() &&
|
||||
|
|
@ -313,8 +320,13 @@ class Migrations extends Action
|
|||
) {
|
||||
$credentials = $migration->getAttribute('credentials', []);
|
||||
$credentials['projectId'] = $credentials['projectId'] ?? $project->getId();
|
||||
$credentials['endpoint'] = $credentials['endpoint'] ?? $this->platform['endpoint'];
|
||||
$credentials['apiKey'] = $credentials['apiKey'] ?? $tempAPIKey;
|
||||
|
||||
if (empty($credentials['endpoint'])) {
|
||||
$platform = Config::getParam('platform', []);
|
||||
$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https';
|
||||
$credentials['endpoint'] = $protocol . '://' . $platform['apiHostname'] . '/v1';
|
||||
}
|
||||
$migration->setAttribute('credentials', $credentials);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue