mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 22:16:15 +00:00
73 lines
1.6 KiB
PHP
Executable File
73 lines
1.6 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\SiteTypes;
|
|
|
|
use App\DTOs\DynamicFieldDTO;
|
|
use App\DTOs\DynamicFieldsCollectionDTO;
|
|
use App\Enums\SiteFeature;
|
|
use App\Exceptions\SSHError;
|
|
use App\Models\Site;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class PHPMyAdmin extends PHPSite
|
|
{
|
|
public static function make(): self
|
|
{
|
|
return new self(new Site(['type' => \App\Enums\SiteType::PHPMYADMIN]));
|
|
}
|
|
|
|
public function supportedFeatures(): array
|
|
{
|
|
return [
|
|
SiteFeature::SSL,
|
|
];
|
|
}
|
|
|
|
public function fields(): DynamicFieldsCollectionDTO
|
|
{
|
|
return new DynamicFieldsCollectionDTO([
|
|
DynamicFieldDTO::make('php_version')
|
|
->component()
|
|
->label('PHP Version'),
|
|
]);
|
|
}
|
|
|
|
public function createRules(array $input): array
|
|
{
|
|
return [
|
|
'php_version' => [
|
|
'required',
|
|
Rule::in($this->site->server->installedPHPVersions()),
|
|
],
|
|
];
|
|
}
|
|
|
|
public function createFields(array $input): array
|
|
{
|
|
return [
|
|
'web_directory' => '',
|
|
'php_version' => $input['php_version'] ?? '',
|
|
];
|
|
}
|
|
|
|
public function data(array $input): array
|
|
{
|
|
return [
|
|
'version' => '5.2.2',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @throws SSHError
|
|
*/
|
|
public function install(): void
|
|
{
|
|
$this->isolate();
|
|
$this->site->webserver()->createVHost($this->site);
|
|
$this->progress(30);
|
|
app(\App\SSH\PHPMyAdmin\PHPMyAdmin::class)->install($this->site);
|
|
$this->progress(65);
|
|
$this->site->php()?->restart();
|
|
}
|
|
}
|