Files
vito/app/SiteTypes/PHPBlank.php
Saeed Vaziry 131b828807 Plugins base (#613)
* wip

* wip

* cleanup

* notification channels

* phpstan

* services

* remove server types

* refactoring

* refactoring
2025-06-14 14:35:18 +02:00

65 lines
1.3 KiB
PHP
Executable File

<?php
namespace App\SiteTypes;
use App\Exceptions\SSHError;
use App\Models\Site;
use Illuminate\Validation\Rule;
class PHPBlank extends PHPSite
{
public static function id(): string
{
return 'php-blank';
}
public static function make(): self
{
return new self(new Site(['type' => self::id()]));
}
public function createRules(array $input): array
{
return [
'web_directory' => [
'nullable',
'string',
'max:255',
],
'php_version' => [
'required',
Rule::in($this->site->server->installedPHPVersions()),
],
];
}
public function createFields(array $input): array
{
return [
'web_directory' => $input['web_directory'] ?? '',
'php_version' => $input['php_version'] ?? '',
];
}
public function data(array $input): array
{
return [];
}
/**
* @throws SSHError
*/
public function install(): void
{
$this->isolate();
$this->site->webserver()->createVHost($this->site);
$this->progress(65);
$this->site->php()?->restart();
}
public function baseCommands(): array
{
return [];
}
}