Browse Source

Merge pull request #1727 from jaapmarcus/feature/drupal-quick-install

Add Drupal as Quick install option
Kristan Kenney 5 years ago
parent
commit
9821788d5c

+ 3 - 0
CHANGELOG.md

@@ -45,7 +45,10 @@ All notable changes to this project will be documented in this file.
 - Disabled changing backup folder via Web UI because it used symbolic link instead of mount causing issues with restore mail / user files.
 - Fixed XSS vulnerability in `v-add-sys-ip` and user history log (thanks **@numanturle**).
 - Fixed remote code execution vulnerability which could occur when deleting SSH keys (thanks **@numanturle**).
+- Fixed vulnerability in v-update-sys-hestia (thanks **@numanturle**)
 - Improve how Quick install of web apps are handled and allow users added apps to be maintained in list view. 
+- Add Drupal quick installer
+- Add Nextcloud quick installer
 
 ## [1.3.5] - Service Release
 ### Features

+ 11 - 0
install/upgrade/versions/1.4.0.sh

@@ -150,3 +150,14 @@ rm -rf $HESTIA/data/templates/web/nginx/php-fpm/drupal7.*tpl
 rm -rf $HESTIA/data/templates/web/nginx/php-fpm/drupal8.*tpl
 rm -rf $HESTIA/data/templates/web/nginx/php-fpm/codeigniter2.*tpl
 rm -rf $HESTIA/data/templates/web/nginx/php-fpm/codeigniter3.*tpl
+
+# Clean up old Hestia controled webapps
+if [ -d "$HESTIA/web/images/webapps/" ]; then 
+    echo "[ * ] Clean up old web apps code..."
+    rm -rf $HESTIA/web/images/webapps/
+    rm -rf $HESTIA/web/src/app/WebApp/Installers/LaravelSetup.php
+    rm -rf $HESTIA/web/src/app/WebApp/Installers/OpencartSetup.php
+    rm -rf $HESTIA/web/src/app/WebApp/Installers/PrestashopSetup.php
+    rm -rf $HESTIA/web/src/app/WebApp/Installers/SymfonySetup.php
+    rm -rf $HESTIA/web/src/app/WebApp/Installers/WordpressSetup.php
+fi

+ 19 - 3
web/src/app/WebApp/Installers/Drupal/DrupalSetup.php

@@ -11,22 +11,38 @@ class DrupalSetup extends BaseSetup {
     protected $appInfo = [ 
         'name' => 'Drupal',
         'group' => 'cms',
-        'enabled' => false,
+        'enabled' => 'yes',
         'version' => 'latest',
         'thumbnail' => 'drupal-thumb.png'
     ];
     
     protected $config = [
         'form' => [
+            'username' => ['type'=>'text', 'value'=>'admin'],
+            'password' => 'password',
+            'email' => 'text'
         ],
         'database' => true,
         'resources' => [
-           
+           'composer' => [ 'src' => 'drupal/recommended-project', 'dst' => '/' ],
         ],
     ];
 
     public function install(array $options=null) : bool
     {
-        exit( "Installer missing" );
+        parent::install($options);
+        $this->appcontext->runComposer(["require", "-d " . $this->getDocRoot(), "drush/drush:^10"], $result);
+        
+        $this -> appcontext -> runUser('v-run-cli-cmd', [
+            'php',
+            $this -> getDocRoot('/vendor/drush/drush/drush'), 
+            'site-install',
+            'standard',
+            '--db-url=mysql://'.$this->appcontext->user() . '_' . $options['database_user'].':' . $options['database_password'].'@localhost:3306/'.$this->appcontext->user() . '_' . $options['database_name'].'',
+            '--account-name='.$options['username'].' --account-pass='.$options['password'],
+            '--site-name=Drupal',
+            '--site-mail='.$options['email']
+            ], $status);
+        return ($status->code === 0);
     }
 }