Skip to content

Commit 01f69ac

Browse files
authored
Fix Quick installer bug Prestashop + Update versions (hestiacp#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
1 parent 1689c2e commit 01f69ac

File tree

5 files changed

+124
-118
lines changed

5 files changed

+124
-118
lines changed

web/src/app/WebApp/Installers/MediaWiki/MediaWikiSetup.php

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,71 +3,71 @@
33
namespace Hestia\WebApp\Installers\MediaWiki;
44

55
use Hestia\System\Util;
6-
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
6+
use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
77

8-
class MediaWikiSetup extends BaseSetup {
8+
class MediaWikiSetup extends BaseSetup
9+
{
10+
protected $appInfo = [
11+
'name' => 'MediaWiki',
12+
'group' => 'cms',
13+
'enabled' => true,
14+
'version' => '1.36.2',
15+
'thumbnail' => 'MediaWiki-2020-logo.svg' //Max size is 300px by 300px
16+
];
917

10-
protected $appInfo = [
11-
'name' => 'MediaWiki',
12-
'group' => 'cms',
13-
'enabled' => true,
14-
'version' => '1.36.1',
15-
'thumbnail' => 'MediaWiki-2020-logo.svg' //Max size is 300px by 300px
16-
];
17-
18-
protected $appname = 'mediawiki';
19-
protected $extractsubdir = "/tmp-mediawiki";
18+
protected $appname = 'mediawiki';
19+
protected $extractsubdir = "/tmp-mediawiki";
2020

21-
22-
protected $config = [
23-
'form' => [
24-
'admin_username' => ['type' => 'text', 'value' => 'admin'],
25-
'admin_password' => 'password',
26-
'language' => ['type' => 'text', 'value' => 'en'],
27-
],
28-
'database' => true,
29-
'resources' => [
30-
'archive' => [ 'src' => 'https://releases.wikimedia.org/mediawiki/1.36/mediawiki-1.36.1.zip' ],
31-
],
32-
];
33-
34-
public function install(array $options = null)
35-
{
36-
parent::install($options);
3721

38-
//check if ssl is enabled
22+
protected $config = [
23+
'form' => [
24+
'admin_username' => ['type' => 'text', 'value' => 'admin'],
25+
'admin_password' => 'password',
26+
'language' => ['type' => 'text', 'value' => 'en'],
27+
],
28+
'database' => true,
29+
'resources' => [
30+
'archive' => [ 'src' => 'https://releases.wikimedia.org/mediawiki/1.36/mediawiki-1.36.2.zip' ],
31+
],
32+
];
33+
34+
public function install(array $options = null)
35+
{
36+
parent::install($options);
37+
38+
//check if ssl is enabled
3939
$this->appcontext->run('v-list-web-domain', [$this->appcontext->user(), $this->domain, 'json'], $status);
40-
41-
if($status->code !== 0) {
40+
41+
if ($status->code !== 0) {
4242
throw new \Exception("Cannot list domain");
4343
}
44-
45-
$sslEnabled = ($status->json[$this->domain]['SSL'] == 'no' ? 0 : 1);
46-
47-
$webDomain = ($sslEnabled ? "https://" : "http://") . $this->domain . "/";
4844

49-
$this->appcontext->runUser('v-copy-fs-directory',[
50-
$this->getDocRoot($this->extractsubdir . "/mediawiki-1.36.1/."),
51-
$this->getDocRoot()], $result);
45+
$sslEnabled = ($status->json[$this->domain]['SSL'] == 'no' ? 0 : 1);
46+
47+
$webDomain = ($sslEnabled ? "https://" : "http://") . $this->domain . "/";
48+
49+
$this->appcontext->runUser('v-copy-fs-directory', [
50+
$this->getDocRoot($this->extractsubdir . "/mediawiki-1.36.1/."),
51+
$this->getDocRoot()], $result);
52+
53+
$this->appcontext->runUser('v-run-cli-cmd', ['/usr/bin/php',
54+
$this->getDocRoot('maintenance/install.php'),
55+
'--dbserver=localhost',
56+
'--dbname=' . $this->appcontext->user() . '_' . $options['database_name'],
57+
'--installdbuser=' . $this->appcontext->user() . '_' . $options['database_user'],
58+
'--installdbpass=' . $options['database_password'],
59+
'--dbuser=' . $this->appcontext->user() . '_' . $options['database_user'],
60+
'--dbpass=' . $options['database_password'],
61+
'--server=' . $webAddresss,
62+
'--scriptpath=', // must NOT be /
63+
'--lang=' . $options['language'],
64+
'--pass=' . $options['admin_password'],
65+
"MediaWiki", // A Space here would trigger the next argument and preemptively set the admin username
66+
$options['admin_username'],
67+
], $status);
68+
69+
$this->cleanup();
5270

53-
$this->appcontext->runUser('v-run-cli-cmd', ['/usr/bin/php',
54-
$this->getDocRoot('maintenance/install.php'),
55-
'--dbserver=localhost',
56-
'--dbname=' . $this->appcontext->user() . '_' . $options['database_name'],
57-
'--installdbuser=' . $this->appcontext->user() . '_' . $options['database_user'],
58-
'--installdbpass=' . $options['database_password'],
59-
'--dbuser=' . $this->appcontext->user() . '_' . $options['database_user'],
60-
'--dbpass=' . $options['database_password'],
61-
'--server=' . $webAddresss,
62-
'--scriptpath=', // must NOT be /
63-
'--lang=' . $options['language'],
64-
'--pass=' . $options['admin_password'],
65-
"MediaWiki", // A Space here would trigger the next argument and preemptively set the admin username
66-
$options['admin_username'],
67-
], $status);
68-
69-
$this->cleanup();
70-
71-
return ($status->code === 0);
72-
}
73-
}
71+
return ($status->code === 0);
72+
}
73+
}

web/src/app/WebApp/Installers/Nextcloud/NextcloudSetup.php

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,40 @@
22

33
namespace Hestia\WebApp\Installers\Nextcloud;
44

5-
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
5+
use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
66

7-
class NextcloudSetup extends BaseSetup {
8-
9-
protected $appInfo = [
7+
class NextcloudSetup extends BaseSetup
8+
{
9+
protected $appInfo = [
1010
'name' => 'Nextcloud',
1111
'group' => 'cloud',
1212
'enabled' => true,
13-
'version' => '21.0.0',
13+
'version' => '22.2.0',
1414
'thumbnail' => 'nextcloud-thumb.png'
1515
];
16-
16+
1717
protected $appname = 'nextcloud';
18-
18+
1919
protected $config = [
2020
'form' => [
2121
'username' => ['value'=>'admin'],
2222
'password' => 'password'
2323
],
2424
'database' => true,
2525
'resources' => [
26-
'archive' => [ 'src' => 'https://download.nextcloud.com/server/releases/nextcloud-21.0.0.tar.bz2' ]
26+
'archive' => [ 'src' => 'https://download.nextcloud.com/server/releases/nextcloud-22.2.0.tar.bz2' ]
2727
],
2828
];
29-
30-
public function install(array $options = null) : bool
29+
30+
public function install(array $options = null): bool
3131
{
3232
parent::install($options);
33-
34-
$this->appcontext->runUser('v-copy-fs-file',[$this->getDocRoot(".htaccess.txt"), $this->getDocRoot(".htaccess")]);
35-
36-
// install nextcloud
33+
34+
$this->appcontext->runUser('v-copy-fs-file', [$this->getDocRoot(".htaccess.txt"), $this->getDocRoot(".htaccess")]);
35+
36+
// install nextcloud
3737
$this->appcontext->runUser('v-run-cli-cmd', ['/usr/bin/php',
38-
$this->getDocRoot('occ'),
38+
$this->getDocRoot('occ'),
3939
'maintenance:install',
4040
'--database mysql',
4141
'--database-name '.$this->appcontext->user() . '_' .$options['database_name'],
@@ -44,13 +44,16 @@ public function install(array $options = null) : bool
4444
'--admin-user '.$options['username'],
4545
'--admin-pass '.$options['password']
4646
], $status);
47-
48-
$this->appcontext->runUser('v-run-cli-cmd',
47+
48+
$this->appcontext->runUser(
49+
'v-run-cli-cmd',
4950
['/usr/bin/php',
50-
$this->getDocRoot('occ'),
51+
$this->getDocRoot('occ'),
5152
'config:system:set',
5253
'trusted_domains 2 --value='.$this->domain
53-
], $status2);
54+
],
55+
$status2
56+
);
5457
return ($status->code === 0 && $status2->code === 0);
5558
}
5659
}

web/src/app/WebApp/Installers/Opencart/OpencartSetup.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
namespace Hestia\WebApp\Installers\Opencart;
44

5-
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
5+
use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
66

7-
class OpencartSetup extends BaseSetup {
8-
9-
protected $appInfo = [
7+
class OpencartSetup extends BaseSetup
8+
{
9+
protected $appInfo = [
1010
'name' => 'Opencart',
1111
'group' => 'ecommerce',
1212
'enabled' => true,
13-
'version' => '3.0.3.3',
13+
'version' => '3.0.3.8',
1414
'thumbnail' => 'opencart-thumb.png'
1515
];
16-
16+
1717
protected $appname = 'opencart';
1818
protected $extractsubdir="/tmp-opencart";
1919

@@ -25,21 +25,21 @@ class OpencartSetup extends BaseSetup {
2525
],
2626
'database' => true,
2727
'resources' => [
28-
'archive' => [ 'src' => 'https://github.com/opencart/opencart/releases/download/3.0.3.3/opencart-3.0.3.3.zip' ],
28+
'archive' => [ 'src' => 'https://github.com/opencart/opencart/releases/download/3.0.3.8/opencart-3.0.3.8.zip' ],
2929
],
3030
];
31-
32-
public function install(array $options = null) : bool
31+
32+
public function install(array $options = null): bool
3333
{
3434
parent::install($options);
3535

36-
$this->appcontext->runUser('v-copy-fs-directory',[
36+
$this->appcontext->runUser('v-copy-fs-directory', [
3737
$this->getDocRoot($this->extractsubdir . "/upload/."),
3838
$this->getDocRoot()], $result);
3939

40-
$this->appcontext->runUser('v-copy-fs-file',[$this->getDocRoot("config-dist.php"), $this->getDocRoot("config.php")]);
41-
$this->appcontext->runUser('v-copy-fs-file',[$this->getDocRoot("admin/config-dist.php"), $this->getDocRoot("admin/config.php")]);
42-
$this->appcontext->runUser('v-copy-fs-file',[$this->getDocRoot(".htaccess.txt"), $this->getDocRoot(".htaccess")]);
40+
$this->appcontext->runUser('v-copy-fs-file', [$this->getDocRoot("config-dist.php"), $this->getDocRoot("config.php")]);
41+
$this->appcontext->runUser('v-copy-fs-file', [$this->getDocRoot("admin/config-dist.php"), $this->getDocRoot("admin/config.php")]);
42+
$this->appcontext->runUser('v-copy-fs-file', [$this->getDocRoot(".htaccess.txt"), $this->getDocRoot(".htaccess")]);
4343
$this->appcontext->runUser('v-run-cli-cmd', [
4444
"/usr/bin/php",
4545
$this->getDocRoot("/install/cli_install.php"),
@@ -59,8 +59,8 @@ public function install(array $options = null) : bool
5959
$this->appcontext->runUser('v-run-cli-cmd', [ "sed", "-i", "s/'storage\//'..\/storage\// ", $this->getDocRoot("admin/config.php") ], $status);
6060
$this->appcontext->runUser('v-run-cli-cmd', [ "sed", "-i", "s/\^system\/storage\//^\/storage\// ", $this->getDocRoot(".htaccess") ], $status);
6161

62-
$this->appcontext->runUser('v-change-fs-file-permission',[$this->getDocRoot("config.php"), '640']);
63-
$this->appcontext->runUser('v-change-fs-file-permission',[$this->getDocRoot("admin/config.php"), '640']);
62+
$this->appcontext->runUser('v-change-fs-file-permission', [$this->getDocRoot("config.php"), '640']);
63+
$this->appcontext->runUser('v-change-fs-file-permission', [$this->getDocRoot("admin/config.php"), '640']);
6464

6565
// remove install folder
6666
$this->appcontext->runUser('v-delete-fs-directory', [$this->getDocRoot("/install")]);

web/src/app/WebApp/Installers/Prestashop/PrestashopSetup.php

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
namespace Hestia\WebApp\Installers\Prestashop;
44

5-
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
5+
use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
66

7-
class PrestashopSetup extends BaseSetup {
8-
9-
protected $appInfo = [
7+
class PrestashopSetup extends BaseSetup
8+
{
9+
protected $appInfo = [
1010
'name' => 'Prestashop',
1111
'group' => 'ecommerce',
1212
'enabled' => true,
13-
'version' => '1.7.7.1',
13+
'version' => '1.7.7.8',
1414
'thumbnail' => 'prestashop-thumb.png'
1515
];
16-
16+
1717
protected $appname = 'prestashop';
1818
protected $extractsubdir="/tmp-prestashop";
1919

@@ -26,23 +26,27 @@ class PrestashopSetup extends BaseSetup {
2626
],
2727
'database' => true,
2828
'resources' => [
29-
'archive' => [ 'src' => 'https://github.com/PrestaShop/PrestaShop/releases/download/1.7.7.1/prestashop_1.7.7.1.zip' ],
29+
'archive' => [ 'src' => 'https://github.com/PrestaShop/PrestaShop/releases/download/1.7.7.8/prestashop_1.7.7.8.zip' ],
3030
],
3131

3232
];
3333

34-
public function install(array $options=null) : bool
34+
public function install(array $options=null): bool
3535
{
3636
parent::install($options);
3737
$this->appcontext->archiveExtract($this->getDocRoot($this->extractsubdir . '/prestashop.zip'), $this->getDocRoot());
38-
//check if ssl is enabled
39-
$this->appcontext->run('v-list-web-domain',[$this -> appcontext->user(),$this -> domain,'json'],$status);
40-
if($status->code !== 0) {
38+
//check if ssl is enabled
39+
$this->appcontext->run('v-list-web-domain', [$this -> appcontext->user(),$this -> domain,'json'], $status);
40+
if ($status->code !== 0) {
4141
throw new \Exception("Cannot list domain");
4242
}
43-
44-
if ($status -> json == 'no'){ $ssl_enabled = 0; }else{ $ssl_enabled = 1;}
45-
43+
44+
if ($status -> json[$this -> domain]['SSL'] == 'no') {
45+
$ssl_enabled = 0;
46+
} else {
47+
$ssl_enabled = 1;
48+
}
49+
4650
$this->appcontext->runUser('v-run-cli-cmd', [
4751
"/usr/bin/php",
4852
$this->getDocRoot("/install/index_cli.php"),
@@ -54,12 +58,11 @@ public function install(array $options=null) : bool
5458
"--password=" . $options['prestashop_account_password'],
5559
"--email=" . $options['prestashop_account_email'],
5660
"--domain=" . $this->domain,
57-
"--ssl=" . $ssl_enabled,], $status);
58-
61+
"--ssl=" . $ssl_enabled,], $status);
62+
5963
// remove install folder
6064
$this->appcontext->runUser('v-delete-fs-directory', [$this->getDocRoot("/install")]);
6165
$this->cleanup();
62-
6366
return ($status->code === 0);
6467
}
6568
}

web/src/app/WebApp/Installers/Symfony/SymfonySetup.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
namespace Hestia\WebApp\Installers\Symfony;
44

5-
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
5+
use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
66

7-
class SymfonySetup extends BaseSetup {
8-
9-
protected $appInfo = [
7+
class SymfonySetup extends BaseSetup
8+
{
9+
protected $appInfo = [
1010
'name' => 'Symfony',
1111
'group' => 'framework',
1212
'enabled' => true,
13-
'version' => '5.2',
13+
'version' => 'latest',
1414
'thumbnail' => 'symfony-thumb.png'
1515
];
16-
16+
1717
protected $appname = 'symfony';
1818

1919
protected $config = [
@@ -25,7 +25,7 @@ class SymfonySetup extends BaseSetup {
2525
],
2626
];
2727

28-
public function install(array $options=null) : bool
28+
public function install(array $options=null): bool
2929
{
3030
parent::install($options);
3131
$result = null;
@@ -40,7 +40,7 @@ public function install(array $options=null) : bool
4040
$this->appcontext->runComposer(["require", "-d " . $this->getDocRoot(), "symfony/apache-pack"], $result);
4141

4242
$tmp_configpath = $this->saveTempFile($htaccess_rewrite);
43-
$this->appcontext->runUser('v-move-fs-file',[$tmp_configpath, $this->getDocRoot(".htaccess")], $result);
43+
$this->appcontext->runUser('v-move-fs-file', [$tmp_configpath, $this->getDocRoot(".htaccess")], $result);
4444

4545
return ($result->code === 0);
4646
}

0 commit comments

Comments
 (0)