This commit is contained in:
Andras Bacsai
2023-05-25 22:33:47 +02:00
parent d97edbcac3
commit b7dffc8594
2 changed files with 23 additions and 18 deletions

View File

@@ -3,13 +3,23 @@
namespace App\Http\Livewire;
use App\Jobs\InstanceAutoUpdateJob;
use App\Models\Server;
use Livewire\Component;
class ForceUpgrade extends Component
{
public function upgrade()
{
$this->emit('updateInitiated');
dispatch(new InstanceAutoUpdateJob(force: true));
try {
$server_name = 'localhost';
if (config('app.env') === 'local') {
$server_name = 'testing-local-docker-container';
}
$server = Server::where('name', $server_name)->firstOrFail();
$this->emit('updateInitiated');
dispatch(new InstanceAutoUpdateJob(force: true, server: $server));
} catch (\Exception $e) {
return general_error_handler($e, $this);
}
}
}