mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
init
This commit is contained in:
43
app/Jobs/Site/ChangePHPVersion.php
Normal file
43
app/Jobs/Site/ChangePHPVersion.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Site;
|
||||
|
||||
use App\Events\Broadcast;
|
||||
use App\Jobs\Job;
|
||||
use App\Models\Site;
|
||||
|
||||
class ChangePHPVersion extends Job
|
||||
{
|
||||
protected Site $site;
|
||||
|
||||
protected string $version;
|
||||
|
||||
public function __construct(Site $site, $version)
|
||||
{
|
||||
$this->site = $site;
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$this->site->php_version = $this->version;
|
||||
$this->site->server->webserver()->handler()->changePHPVersion($this->site, $this->version);
|
||||
$this->site->save();
|
||||
event(
|
||||
new Broadcast('change-site-php-finished', [
|
||||
'id' => $this->site->id,
|
||||
'php_version' => $this->site->php_version,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public function failed(): void
|
||||
{
|
||||
event(
|
||||
new Broadcast('change-site-php-failed', [
|
||||
'message' => __('Failed to change PHP!'),
|
||||
'id' => $this->site->id,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user