Ver Fonte

Fix Quick installer bug Prestashop + Update versions (#2168)

* Update quick installer 

Prestashop 1.7.7.1 to 1.7.7.8
Mediawiki 1.36.1 to 1.36.2
Nextcloud 21.0 to 22.2
Opencart 3.0.3.3 to 3.0.3.8

* Fix bug when ssl is disabled
Jaap Marcus há 4 anos atrás
pai
commit
01f69ac61c

+ 59 - 59
web/src/app/WebApp/Installers/MediaWiki/MediaWikiSetup.php

@@ -3,71 +3,71 @@
 namespace Hestia\WebApp\Installers\MediaWiki;
 
 use Hestia\System\Util;
-use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
+use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
 
-class MediaWikiSetup extends BaseSetup {
+class MediaWikiSetup extends BaseSetup
+{
+    protected $appInfo = [
+        'name' => 'MediaWiki',
+        'group' => 'cms',
+        'enabled' => true,
+        'version' => '1.36.2',
+        'thumbnail' => 'MediaWiki-2020-logo.svg' //Max size is 300px by 300px
+    ];
 
-	protected $appInfo = [ 
-		'name' => 'MediaWiki',
-		'group' => 'cms',
-		'enabled' => true,
-		'version' => '1.36.1',
-		'thumbnail' => 'MediaWiki-2020-logo.svg' //Max size is 300px by 300px 
-	];
-	
-	protected $appname = 'mediawiki';
-	protected $extractsubdir = "/tmp-mediawiki";
+    protected $appname = 'mediawiki';
+    protected $extractsubdir = "/tmp-mediawiki";
 
-	
-	protected $config = [
-		'form' => [
-			'admin_username' => ['type' => 'text', 'value' => 'admin'],
-			'admin_password' => 'password',
-			'language' => ['type' => 'text', 'value' => 'en'],
-			],
-		'database' => true,
-		'resources' => [
-			'archive'  => [ 'src' => 'https://releases.wikimedia.org/mediawiki/1.36/mediawiki-1.36.1.zip' ],
-		], 
-	];
-	
-	public function install(array $options = null)
-	{
-		parent::install($options);
 
-        //check if ssl is enabled 
+    protected $config = [
+        'form' => [
+            'admin_username' => ['type' => 'text', 'value' => 'admin'],
+            'admin_password' => 'password',
+            'language' => ['type' => 'text', 'value' => 'en'],
+            ],
+        'database' => true,
+        'resources' => [
+            'archive'  => [ 'src' => 'https://releases.wikimedia.org/mediawiki/1.36/mediawiki-1.36.2.zip' ],
+        ],
+    ];
+
+    public function install(array $options = null)
+    {
+        parent::install($options);
+
+        //check if ssl is enabled
         $this->appcontext->run('v-list-web-domain', [$this->appcontext->user(), $this->domain, 'json'], $status);
-		
-        if($status->code !== 0) {
+
+        if ($status->code !== 0) {
             throw new \Exception("Cannot list domain");
         }
-        
-		$sslEnabled = ($status->json[$this->domain]['SSL'] == 'no' ? 0 : 1);
-		
-		$webDomain = ($sslEnabled ? "https://" : "http://") . $this->domain . "/";
 
-		$this->appcontext->runUser('v-copy-fs-directory',[
-			$this->getDocRoot($this->extractsubdir . "/mediawiki-1.36.1/."),
-			$this->getDocRoot()], $result);		
+        $sslEnabled = ($status->json[$this->domain]['SSL'] == 'no' ? 0 : 1);
+
+        $webDomain = ($sslEnabled ? "https://" : "http://") . $this->domain . "/";
+
+        $this->appcontext->runUser('v-copy-fs-directory', [
+            $this->getDocRoot($this->extractsubdir . "/mediawiki-1.36.1/."),
+            $this->getDocRoot()], $result);
+
+        $this->appcontext->runUser('v-run-cli-cmd', ['/usr/bin/php',
+            $this->getDocRoot('maintenance/install.php'),
+            '--dbserver=localhost',
+            '--dbname=' . $this->appcontext->user() . '_' . $options['database_name'],
+            '--installdbuser=' . $this->appcontext->user() . '_' . $options['database_user'],
+            '--installdbpass=' . $options['database_password'],
+            '--dbuser=' . $this->appcontext->user() . '_' . $options['database_user'],
+            '--dbpass=' . $options['database_password'],
+            '--server=' . $webAddresss,
+            '--scriptpath=', // must NOT be /
+            '--lang=' . $options['language'],
+            '--pass=' . $options['admin_password'],
+            "MediaWiki", // A Space here would trigger the next argument and preemptively set the admin username
+            $options['admin_username'],
+            ], $status);
+
+        $this->cleanup();
 
-		$this->appcontext->runUser('v-run-cli-cmd', ['/usr/bin/php',
-			$this->getDocRoot('maintenance/install.php'), 
-			'--dbserver=localhost',
-			'--dbname=' . $this->appcontext->user() . '_' . $options['database_name'],
-			'--installdbuser=' . $this->appcontext->user() . '_' . $options['database_user'],
-			'--installdbpass=' . $options['database_password'],
-			'--dbuser=' . $this->appcontext->user() . '_' . $options['database_user'],
-			'--dbpass=' . $options['database_password'],
-			'--server=' . $webAddresss,
-			'--scriptpath=', // must NOT be /
-			'--lang=' . $options['language'],
-			'--pass=' . $options['admin_password'],
-			"MediaWiki", // A Space here would trigger the next argument and preemptively set the admin username
-			$options['admin_username'],
-			], $status);
-			
-		$this->cleanup();
-		
-		return ($status->code === 0);
-	}
-}
+        return ($status->code === 0);
+    }
+}

+ 22 - 19
web/src/app/WebApp/Installers/Nextcloud/NextcloudSetup.php

@@ -2,20 +2,20 @@
 
 namespace Hestia\WebApp\Installers\Nextcloud;
 
-use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
+use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
 
-class NextcloudSetup extends BaseSetup {
-
-    protected $appInfo = [ 
+class NextcloudSetup extends BaseSetup
+{
+    protected $appInfo = [
         'name' => 'Nextcloud',
         'group' => 'cloud',
         'enabled' => true,
-        'version' => '21.0.0',
+        'version' => '22.2.0',
         'thumbnail' => 'nextcloud-thumb.png'
     ];
-    
+
     protected $appname = 'nextcloud';
-    
+
     protected $config = [
         'form' => [
             'username' => ['value'=>'admin'],
@@ -23,19 +23,19 @@ class NextcloudSetup extends BaseSetup {
             ],
         'database' => true,
         'resources' => [
-            'archive'  => [ 'src' => 'https://download.nextcloud.com/server/releases/nextcloud-21.0.0.tar.bz2' ]
+            'archive'  => [ 'src' => 'https://download.nextcloud.com/server/releases/nextcloud-22.2.0.tar.bz2' ]
         ],
     ];
-    
-    public function install(array $options = null) : bool
+
+    public function install(array $options = null): bool
     {
         parent::install($options);
-        
-        $this->appcontext->runUser('v-copy-fs-file',[$this->getDocRoot(".htaccess.txt"), $this->getDocRoot(".htaccess")]);
-        
-        // install nextcloud 
+
+        $this->appcontext->runUser('v-copy-fs-file', [$this->getDocRoot(".htaccess.txt"), $this->getDocRoot(".htaccess")]);
+
+        // install nextcloud
         $this->appcontext->runUser('v-run-cli-cmd', ['/usr/bin/php',
-            $this->getDocRoot('occ'), 
+            $this->getDocRoot('occ'),
             'maintenance:install',
             '--database mysql',
             '--database-name '.$this->appcontext->user() . '_' .$options['database_name'],
@@ -44,13 +44,16 @@ class NextcloudSetup extends BaseSetup {
             '--admin-user '.$options['username'],
             '--admin-pass '.$options['password']
             ], $status);
-            
-        $this->appcontext->runUser('v-run-cli-cmd',  
+
+        $this->appcontext->runUser(
+            'v-run-cli-cmd',
             ['/usr/bin/php',
-                $this->getDocRoot('occ'), 
+                $this->getDocRoot('occ'),
                 'config:system:set',
                 'trusted_domains 2 --value='.$this->domain
-            ], $status2);
+            ],
+            $status2
+        );
         return ($status->code === 0 && $status2->code === 0);
     }
 }

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

@@ -2,18 +2,18 @@
 
 namespace Hestia\WebApp\Installers\Opencart;
 
-use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
+use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
 
-class OpencartSetup extends BaseSetup {
-
-    protected $appInfo = [ 
+class OpencartSetup extends BaseSetup
+{
+    protected $appInfo = [
         'name' => 'Opencart',
         'group' => 'ecommerce',
         'enabled' => true,
-        'version' => '3.0.3.3',
+        'version' => '3.0.3.8',
         'thumbnail' => 'opencart-thumb.png'
     ];
-    
+
     protected $appname = 'opencart';
     protected $extractsubdir="/tmp-opencart";
 
@@ -25,21 +25,21 @@ class OpencartSetup extends BaseSetup {
             ],
         'database' => true,
         'resources' => [
-            'archive'  => [ 'src' => 'https://github.com/opencart/opencart/releases/download/3.0.3.3/opencart-3.0.3.3.zip' ],
+            'archive'  => [ 'src' => 'https://github.com/opencart/opencart/releases/download/3.0.3.8/opencart-3.0.3.8.zip' ],
         ],
     ];
-    
-    public function install(array $options = null) : bool
+
+    public function install(array $options = null): bool
     {
         parent::install($options);
 
-        $this->appcontext->runUser('v-copy-fs-directory',[
+        $this->appcontext->runUser('v-copy-fs-directory', [
             $this->getDocRoot($this->extractsubdir . "/upload/."),
             $this->getDocRoot()], $result);
 
-        $this->appcontext->runUser('v-copy-fs-file',[$this->getDocRoot("config-dist.php"), $this->getDocRoot("config.php")]);
-        $this->appcontext->runUser('v-copy-fs-file',[$this->getDocRoot("admin/config-dist.php"), $this->getDocRoot("admin/config.php")]);
-        $this->appcontext->runUser('v-copy-fs-file',[$this->getDocRoot(".htaccess.txt"), $this->getDocRoot(".htaccess")]);
+        $this->appcontext->runUser('v-copy-fs-file', [$this->getDocRoot("config-dist.php"), $this->getDocRoot("config.php")]);
+        $this->appcontext->runUser('v-copy-fs-file', [$this->getDocRoot("admin/config-dist.php"), $this->getDocRoot("admin/config.php")]);
+        $this->appcontext->runUser('v-copy-fs-file', [$this->getDocRoot(".htaccess.txt"), $this->getDocRoot(".htaccess")]);
         $this->appcontext->runUser('v-run-cli-cmd', [
             "/usr/bin/php",
             $this->getDocRoot("/install/cli_install.php"),
@@ -59,8 +59,8 @@ class OpencartSetup extends BaseSetup {
         $this->appcontext->runUser('v-run-cli-cmd', [ "sed", "-i", "s/'storage\//'..\/storage\// ", $this->getDocRoot("admin/config.php") ], $status);
         $this->appcontext->runUser('v-run-cli-cmd', [ "sed", "-i", "s/\^system\/storage\//^\/storage\// ", $this->getDocRoot(".htaccess") ], $status);
 
-        $this->appcontext->runUser('v-change-fs-file-permission',[$this->getDocRoot("config.php"), '640']);
-        $this->appcontext->runUser('v-change-fs-file-permission',[$this->getDocRoot("admin/config.php"), '640']);
+        $this->appcontext->runUser('v-change-fs-file-permission', [$this->getDocRoot("config.php"), '640']);
+        $this->appcontext->runUser('v-change-fs-file-permission', [$this->getDocRoot("admin/config.php"), '640']);
 
         // remove install folder
         $this->appcontext->runUser('v-delete-fs-directory', [$this->getDocRoot("/install")]);

+ 20 - 17
web/src/app/WebApp/Installers/Prestashop/PrestashopSetup.php

@@ -2,18 +2,18 @@
 
 namespace Hestia\WebApp\Installers\Prestashop;
 
-use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
+use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
 
-class PrestashopSetup extends BaseSetup {
-
-    protected $appInfo = [ 
+class PrestashopSetup extends BaseSetup
+{
+    protected $appInfo = [
         'name' => 'Prestashop',
         'group' => 'ecommerce',
         'enabled' => true,
-        'version' => '1.7.7.1',
+        'version' => '1.7.7.8',
         'thumbnail' => 'prestashop-thumb.png'
     ];
-    
+
     protected $appname = 'prestashop';
     protected $extractsubdir="/tmp-prestashop";
 
@@ -26,23 +26,27 @@ class PrestashopSetup extends BaseSetup {
             ],
         'database' => true,
         'resources' => [
-            'archive'  => [ 'src' => 'https://github.com/PrestaShop/PrestaShop/releases/download/1.7.7.1/prestashop_1.7.7.1.zip' ],
+            'archive'  => [ 'src' => 'https://github.com/PrestaShop/PrestaShop/releases/download/1.7.7.8/prestashop_1.7.7.8.zip' ],
         ],
 
     ];
 
-    public function install(array $options=null) : bool
+    public function install(array $options=null): bool
     {
         parent::install($options);
         $this->appcontext->archiveExtract($this->getDocRoot($this->extractsubdir . '/prestashop.zip'), $this->getDocRoot());
-        //check if ssl is enabled 
-        $this->appcontext->run('v-list-web-domain',[$this -> appcontext->user(),$this -> domain,'json'],$status);
-        if($status->code !== 0) {
+        //check if ssl is enabled
+        $this->appcontext->run('v-list-web-domain', [$this -> appcontext->user(),$this -> domain,'json'], $status);
+        if ($status->code !== 0) {
             throw new \Exception("Cannot list domain");
         }
-        
-        if ($status -> json == 'no'){ $ssl_enabled = 0; }else{ $ssl_enabled = 1;}
-        
+
+        if ($status -> json[$this -> domain]['SSL'] == 'no') {
+            $ssl_enabled = 0;
+        } else {
+            $ssl_enabled = 1;
+        }
+
         $this->appcontext->runUser('v-run-cli-cmd', [
             "/usr/bin/php",
             $this->getDocRoot("/install/index_cli.php"),
@@ -54,12 +58,11 @@ class PrestashopSetup extends BaseSetup {
             "--password="    . $options['prestashop_account_password'],
             "--email="       . $options['prestashop_account_email'],
             "--domain="      . $this->domain,
-            "--ssl="         . $ssl_enabled,],  $status);
-        
+            "--ssl="         . $ssl_enabled,], $status);
+
         // remove install folder
         $this->appcontext->runUser('v-delete-fs-directory', [$this->getDocRoot("/install")]);
         $this->cleanup();
-
         return ($status->code === 0);
     }
 }

+ 8 - 8
web/src/app/WebApp/Installers/Symfony/SymfonySetup.php

@@ -2,18 +2,18 @@
 
 namespace Hestia\WebApp\Installers\Symfony;
 
-use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
+use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
 
-class SymfonySetup extends BaseSetup {
-    
-    protected $appInfo = [ 
+class SymfonySetup extends BaseSetup
+{
+    protected $appInfo = [
         'name' => 'Symfony',
         'group' => 'framework',
         'enabled' => true,
-        'version' => '5.2',
+        'version' => 'latest',
         'thumbnail' => 'symfony-thumb.png'
     ];
-    
+
     protected $appname = 'symfony';
 
     protected $config = [
@@ -25,7 +25,7 @@ class SymfonySetup extends BaseSetup {
         ],
     ];
 
-    public function install(array $options=null) : bool
+    public function install(array $options=null): bool
     {
         parent::install($options);
         $result = null;
@@ -40,7 +40,7 @@ class SymfonySetup extends BaseSetup {
         $this->appcontext->runComposer(["require", "-d " . $this->getDocRoot(), "symfony/apache-pack"], $result);
 
         $tmp_configpath = $this->saveTempFile($htaccess_rewrite);
-        $this->appcontext->runUser('v-move-fs-file',[$tmp_configpath, $this->getDocRoot(".htaccess")], $result);
+        $this->appcontext->runUser('v-move-fs-file', [$tmp_configpath, $this->getDocRoot(".htaccess")], $result);
 
         return ($result->code === 0);
     }