mirror of
https://github.com/coollabsio/coolify.git
synced 2026-08-24 02:24:11 -05:00
Extract database start command execution into a shared service and job, preserving activity tracking and status events while supporting resolved secret credentials.
20 lines
589 B
PHP
20 lines
589 B
PHP
<?php
|
|
|
|
namespace App\Traits;
|
|
|
|
use App\Services\DatabaseStartCommandExecutor;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Spatie\Activitylog\Models\Activity;
|
|
|
|
trait ExecutesDatabaseStartCommands
|
|
{
|
|
private function executeDatabaseStartCommands(array $commands, Model $database, ?Activity $activity = null): Activity
|
|
{
|
|
if ($activity) {
|
|
return app(DatabaseStartCommandExecutor::class)->execute($commands, $database, $activity);
|
|
}
|
|
|
|
return remote_process($commands, $database->destination->server, callEventOnFinish: 'DatabaseStatusChanged');
|
|
}
|
|
}
|