Przeglądaj źródła

Allow Quick Install Apps to change template used by default setting (#2344)

* Enable Create DB on debfault

* Add support for changing template in Quick Install 

Allow  apps to change template domains. Currently users need to manually edit the template before installing Worpdress (Nginx + PHP-FPM) so the are able to use rewrite rules)
Jaap Marcus 4 lat temu
rodzic
commit
f13f15f330

+ 4 - 0
web/src/app/System/HestiaApp.php

@@ -149,6 +149,10 @@ class HestiaApp {
         unlink($v_password);
         return $status;
     }
+    
+    public function changeWebTemplate(string $domain, string $template){
+        $status = $this->runUser('v-change-web-domain-tpl', [$domain, $template]);
+    } 
 
     public function getWebDomainIp(string $domain)
     {

+ 1 - 1
web/src/app/WebApp/AppWizard.php

@@ -13,7 +13,7 @@ class AppWizard {
     private $errors;
 
     private $database_config = [
-        'database_create' => ['type'=>'boolean', 'value'=>false],
+        'database_create' => ['type'=>'boolean', 'value'=>true],
         'database_name' => ['type'=>'text', 'placeholder' => 'auto'],
         'database_user' => ['type'=>'text', 'placeholder' => 'auto'],
         'database_password' => ['type'=>'password', 'placeholder' => 'auto'],

+ 18 - 1
web/src/app/WebApp/Installers/BaseSetup.php

@@ -70,7 +70,24 @@ abstract class BaseSetup implements InstallerInterface {
         }
         return true;
     }
-
+    public function setup( array $options=null)
+    {
+        if ( $_SESSION['WEB_SYSTEM'] == "nginx" )
+        {
+            if( isset($this -> config['server']['nginx']['template']) ){
+                $this -> appcontext -> changeWebTemplate($this -> domain, $this -> config['server']['nginx']['template']);
+            }else{
+                $this -> appcontext -> changeWebTemplate($this -> domain, 'default');
+            }
+        }else{
+            if( isset($this -> config['server']['apache2']['template']) ){
+                $this -> appcontext -> changeWebTemplate($this -> domain, $this -> config['server']['apache2']['template']);
+            }else{
+                $this -> appcontext -> changeWebTemplate($this -> domain, 'default');
+            }
+        }        
+    }
+    
     public function install(array $options=null)
     {
         $this->appcontext->runUser('v-delete-fs-file', [$this->getDocRoot('robots.txt')]);

+ 5 - 0
web/src/app/WebApp/Installers/Drupal/DrupalSetup.php

@@ -26,6 +26,11 @@ class DrupalSetup extends BaseSetup {
         'resources' => [
            'composer' => [ 'src' => 'drupal/recommended-project', 'dst' => '/' ],
         ],
+        'server' => [
+            'nginx' => [
+                'template' => 'drupal-composer'
+            ],
+        ],
     ];
 
     public function install(array $options=null) : bool

+ 5 - 0
web/src/app/WebApp/Installers/Grav/GravSetup.php

@@ -28,6 +28,11 @@ class GravSetup extends BaseSetup {
 		'resources' => [
 			'composer' => [ 'src' => 'getgrav/grav', 'dst' => '/']
 		],
+		'server' => [
+			'nginx' => [
+				'template' => 'grav',
+			],
+		],
 	];
 	
 	public function install(array $options = null)

+ 5 - 0
web/src/app/WebApp/Installers/Laravel/LaravelSetup.php

@@ -23,6 +23,11 @@ class LaravelSetup extends BaseSetup {
         'resources' => [
             'composer' => [ 'src' => 'laravel/laravel', 'dst' => '/'],
         ],
+        'server' => [
+            'nginx' => [
+                'template' => 'laravel',
+            ],
+        ],
     ];
 
     public function install(array $options=null) : bool

+ 5 - 0
web/src/app/WebApp/Installers/Nextcloud/NextcloudSetup.php

@@ -25,6 +25,11 @@ class NextcloudSetup extends BaseSetup
         'resources' => [
             'archive'  => [ 'src' => 'https://download.nextcloud.com/server/releases/nextcloud-22.2.0.tar.bz2' ]
         ],
+        'server' => [
+            'nginx' => [
+                'template' => 'owncloud',
+            ],
+        ],
     ];
 
     public function install(array $options = null): bool

+ 5 - 0
web/src/app/WebApp/Installers/Opencart/OpencartSetup.php

@@ -27,6 +27,11 @@ class OpencartSetup extends BaseSetup
         'resources' => [
             'archive'  => [ 'src' => 'https://github.com/opencart/opencart/releases/download/3.0.3.8/opencart-3.0.3.8.zip' ],
         ],
+        'server' => [
+            'nginx' => [
+                'template' => 'opencart',
+            ],
+        ],
     ];
 
     public function install(array $options = null): bool

+ 5 - 0
web/src/app/WebApp/Installers/Prestashop/PrestashopSetup.php

@@ -28,6 +28,11 @@ class PrestashopSetup extends BaseSetup
         'resources' => [
             'archive'  => [ 'src' => 'https://github.com/PrestaShop/PrestaShop/releases/download/1.7.7.8/prestashop_1.7.7.8.zip' ],
         ],
+        'server' => [
+            'nginx' => [
+                'template' => 'prestashop',
+            ],
+        ],
 
     ];
 

+ 8 - 2
web/src/app/WebApp/Installers/Wordpress/WordpressSetup.php

@@ -31,13 +31,18 @@ class WordpressSetup extends BaseSetup {
         'resources' => [
             'archive'  => [ 'src' => 'https://wordpress.org/latest.tar.gz' ],
         ],
+        'server' => [
+            'nginx' => [
+                'template' => 'wordpress',
+            ],
+        ],
         
     ];
     
     public function install(array $options = null)
     {
         parent::install($options);
-
+        parent::setup($options);
         $this->appcontext->runUser('v-open-fs-file',[$this->getDocRoot("wp-config-sample.php")], $result);
 
         $distconfig = preg_replace( [
@@ -67,7 +72,8 @@ class WordpressSetup extends BaseSetup {
             . "&admin_password=" . rawurlencode($options['wordpress_account_password'])
             . "&admin_password2=". rawurlencode($options['wordpress_account_password'])
             . "&admin_email="    . rawurlencode($options['wordpress_account_email'])), $output, $return_var);
-
+        
+    
         return ($return_var === 0);
     }
 }