From 345bcf2f1907ccd4046a62ebf380084c6ccd8550 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 5 Dec 2023 14:15:35 +0100 Subject: [PATCH] wip #6555 @0.5 --- app/Models/FluidbookExternalInstallServer.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Models/FluidbookExternalInstallServer.php b/app/Models/FluidbookExternalInstallServer.php index c18fef4b7..a74f42cae 100644 --- a/app/Models/FluidbookExternalInstallServer.php +++ b/app/Models/FluidbookExternalInstallServer.php @@ -5,6 +5,7 @@ namespace App\Models; use App\Http\Controllers\Admin\Operations\ServerOperation; use Cubist\Backpack\Magic\Fields\Checkbox; use Cubist\Backpack\Magic\Fields\Table; +use Cubist\Backpack\Magic\Fields\Textarea; use Cubist\Backpack\Magic\Models\ExternalServer; use Cubist\Net\Transfer\Local; use Cubist\Util\Files\Files; @@ -23,6 +24,8 @@ class FluidbookExternalInstallServer extends ExternalServer protected static $_permissionBase = 'fluidbook-external-install-server'; + protected static $hostingProtocols = ['hosting', 'ushosting']; + protected $_operations = [ServerOperation::class]; private static $id; @@ -35,7 +38,12 @@ class FluidbookExternalInstallServer extends ExternalServer public function setFields() { + $nothostingProtocols = array_diff(array_keys($this->getProtocols(), static::$hostingProtocols)); + parent::setFields(); + $this->getField('base_url')->setAttribute('when', ['protocol' => $nothostingProtocols]); + $this->addField('subdomains', Textarea::class, __('Sous-domaines'), ['when' => ['protocol' => static::$hostingProtocols]]); + $this->addField('php', Checkbox::class, __('Activer le support de PHP'), ['default' => false, 'when' => ['protocol' => static::$hostingProtocols]]); $this->addField('redirections', Table::class, __('Redirections'), ['entity_singular' => __('redirection'), 'columns' => ['from' => __('De'), 'to' => __('Vers')], 'when' => ['protocol' => 'hosting']]); $this->addField('allows_root', Checkbox::class, __('Autoriser le chargement à la racine (sur le chemin de base)'), ['default' => false]); } @@ -106,7 +114,7 @@ class FluidbookExternalInstallServer extends ExternalServer ]; $result = static::find($id)->getTransferDriver()->checkConnexion($data); - if($result === true) { + if ($result === true) { $result_['success'] = true; } else { $result_['error'] = true; @@ -123,7 +131,8 @@ class FluidbookExternalInstallServer extends ExternalServer ->toArray(); } - public static function messages() { + public static function messages() + { return [ __("L'hôte est manquant"), __("L'hôte ou le mot de passe est invalide"), -- 2.39.5