]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7218 @0:10
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 3 Dec 2024 13:47:10 +0000 (14:47 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 3 Dec 2024 13:47:10 +0000 (14:47 +0100)
app/Jobs/HostingUpdate.php
app/Models/FluidbookExternalInstallServer.php

index d7b3ade4eed053528dbb0abd460d178398ba6b97..74382cf07878cc5bae402fe417866f6e61a25def 100644 (file)
@@ -17,6 +17,8 @@ class HostingUpdate extends Base
         'ushosting' => ['host' => 'kingkong.cubedesigners.com', 'basepath' => '/home/fluidbook/data/hosting'],
     ];
 
+    const LATEST_PHP = '8.3';
+
     public function handle()
     {
         foreach (static::$_data as $name => $s) {
@@ -36,20 +38,28 @@ class HostingUpdate extends Base
 
         copy($r . 'updateall', $d . 'update');
 
+
+
         foreach ($servers as $server) {
             $basePath = trim($server->base_path, '/');
             if ($basePath != '') {
                 $basePath = '/' . $basePath;
             }
 
+            $phpversion=floatval($server->php);
+            $image = 'php:apache';
+            if ($phpversion > 1) {
+                $image = 'php:' . $phpversion . '-apache';
+            }
+
             /** @var FluidbookExternalInstallServer $server */
             $server->updateHtaccess();
             $s = $d . 'server-' . $server->id;
             Files::copy($r . 'server', $s);
             Files::recursiveReplaceStringInDir($s, [
                 '$sid' => $server->id,
-                '$image' => (true || $server->php) ? 'php:apache' : 'httpd',
-                '$dockerpath' => (true || $server->php) ? '/var/www/html' : '/usr/local/apache2/htdocs',
+                '$image' => $image,
+                '$dockerpath' => ($image !== 'httpd') ? '/var/www/html' : '/usr/local/apache2/htdocs',
                 '$domains' => implode(',', Text::explodeNewLines($server->subdomains)),
                 '$hosting' => $name,
                 '$path' => $data['basepath'] . $basePath,
index 7187d58a61e45ada448ec009ac36d35335bb32db..e0ebf987e8d666db560cfa020b5897b8f04ff227 100644 (file)
@@ -8,6 +8,7 @@ use App\Jobs\HostingUpdate;
 use App\Models\Traits\Owner;
 use App\Models\Traits\Permissions;
 use Cubist\Backpack\Magic\Fields\Checkbox;
+use Cubist\Backpack\Magic\Fields\SelectFromArray;
 use Cubist\Backpack\Magic\Fields\Table;
 use Cubist\Backpack\Magic\Fields\Textarea;
 use Cubist\Backpack\Magic\Models\ExternalServer;
@@ -64,7 +65,7 @@ class FluidbookExternalInstallServer extends ExternalServer
         $this->addOwnerField(['column' => true]);
         $this->getField('base_url')->setAttribute('when', ['protocol' => $nothostingProtocols]);
         $this->addField('subdomains', Textarea::class, __('Sous-domaines'), ['when' => ['protocol' => $hostingProtocols]]);
-        $this->addField('php', Checkbox::class, __('Activer le support de PHP'), ['default' => false, 'when' => ['protocol' => $hostingProtocols]]);
+        $this->addField('php', SelectFromArray::class, __('Activer le support de PHP'), ['default' => false, 'options' => [0 => __('Non'), 1 => __('Dernière version'), '8.3' => '8.3', '8.2' => '8.2', '8.1' => '8.1'], 'when' => ['protocol' => $hostingProtocols]]);
         $this->addField('redirections', Table::class, __('Redirections'), ['entity_singular' => __('redirection'), 'columns' => ['from' => __('De'), 'to' => __('Vers')], 'when' => ['protocol' => $hostingProtocols]]);
         $this->addField('allows_root', Checkbox::class, __('Autoriser le chargement à la racine (sur le chemin de base)'), ['default' => false]);
     }