vito/app/SSHCommands/ChangeNginxPHPVersionCommand.php
Saeed Vaziry 5c72f12490 init
2023-07-02 12:47:50 +02:00

48 lines
1.0 KiB
PHP
Executable File

<?php
namespace App\SSHCommands;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class ChangeNginxPHPVersionCommand extends Command
{
/**
* @var string
*/
protected $domain;
/**
* @var string
*/
protected $oldVersion;
/**
* @var string
*/
protected $newVersion;
/**
* CreateVHostCommand constructor.
*/
public function __construct(string $domain, string $oldVersion, string $newVersion)
{
$this->domain = $domain;
$this->oldVersion = $oldVersion;
$this->newVersion = $newVersion;
}
public function file(string $os): string
{
return File::get(base_path('system/commands/ubuntu/webserver/nginx/change-php-version.sh'));
}
public function content(string $os): string
{
$command = Str::replace('__domain__', $this->domain, $this->file($os));
$command = Str::replace('__old_version__', $this->oldVersion, $command);
return Str::replace('__new_version__', $this->newVersion, $command);
}
}