Skip to content

Commit 9d8649f

Browse files
committed
Use Setup class instead app.json
1 parent fc4f3de commit 9d8649f

File tree

16 files changed

+154
-66
lines changed

16 files changed

+154
-66
lines changed

web/add/webapp/index.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@
3030
exit;
3131
}
3232

33-
$appInstallers = glob(__DIR__.'/../../src/app/WebApp/Installers/*/app.json');
34-
$v_web_apps = array();
35-
foreach($appInstallers as $app){
36-
$json = json_decode(file_get_contents($app));
37-
$array[$json -> name] = $json;
38-
$v_web_apps = array_merge($v_web_apps, $array);
39-
}
40-
4133
// Check GET request
4234
if (!empty($_GET['app'])) {
4335
$app = basename($_GET['app']);
@@ -90,6 +82,19 @@
9082
if(!empty($installer)) {
9183
render_page($user, $TAB, 'setup_webapp');
9284
} else {
85+
$appInstallers = glob(__DIR__.'/../../src/app/WebApp/Installers/*/*.php');
86+
$v_web_apps = array();
87+
foreach($appInstallers as $app){
88+
$hestia = new \Hestia\System\HestiaApp();
89+
if( preg_match('/Installers\/([a-zA-Z0-0].*)\/([a-zA-Z0-0].*).php/', $app, $matches)){
90+
if ($matches[1] != "Resources"){
91+
$app_installer_class = '\Hestia\WebApp\Installers\\'.$matches[1].'\\' . $matches[1] . 'Setup';
92+
$app_installer = new $app_installer_class($v_domain, $hestia);
93+
$v_web_apps[] = $app_installer -> info();
94+
95+
}
96+
}
97+
}
9398
render_page($user, $TAB, 'list_webapps');
9499
}
95100

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace Hestia\WebApp\Installers\Drupal;
4+
5+
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
6+
7+
class DrupalSetup extends BaseSetup {
8+
9+
protected $appname = 'drupal';
10+
11+
protected $appInfo = [
12+
'name' => 'Drupal',
13+
'group' => 'cms',
14+
'enabled' => false,
15+
'version' => 'latest',
16+
'thumbnail' => 'drupal-thumb.png'
17+
];
18+
19+
protected $config = [
20+
'form' => [
21+
],
22+
'database' => true,
23+
'resources' => [
24+
25+
],
26+
];
27+
28+
public function info(){
29+
return $this -> appInfo;
30+
}
31+
32+
public function install(array $options=null) : bool
33+
{
34+
exit( "Installer missing" );
35+
}
36+
}

web/src/app/WebApp/Installers/Drupal/app.json

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace Hestia\WebApp\Installers\Joomla;
4+
5+
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
6+
7+
class JoomlaSetup extends BaseSetup {
8+
9+
protected $appname = 'joomla';
10+
11+
protected $appInfo = [
12+
'name' => 'Joomla',
13+
'group' => 'cms',
14+
'enabled' => false,
15+
'version' => 'latest',
16+
'thumbnail' => 'joomla-thumb.png'
17+
];
18+
19+
protected $config = [
20+
'form' => [
21+
],
22+
'database' => true,
23+
'resources' => [
24+
25+
],
26+
];
27+
28+
public function info(){
29+
return $this -> appInfo;
30+
}
31+
32+
public function install(array $options=null) : bool
33+
{
34+
exit( "Installer missing" );
35+
}
36+
}

web/src/app/WebApp/Installers/Joomla/app.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

web/src/app/WebApp/Installers/Laravel/LaravelSetup.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
class LaravelSetup extends BaseSetup {
88

99
protected $appname = 'laravel';
10-
10+
11+
protected $appInfo = [
12+
'name' => 'Laravel',
13+
'group' => 'framework',
14+
'enabled' => true,
15+
'version' => '7.x',
16+
'thumbnail' => 'laravel-thumb.png'
17+
];
18+
1119
protected $config = [
1220
'form' => [
1321
],
@@ -16,6 +24,10 @@ class LaravelSetup extends BaseSetup {
1624
'composer' => [ 'src' => 'laravel/laravel', 'dst' => '/' ],
1725
],
1826
];
27+
28+
public function info(){
29+
return $this -> appInfo;
30+
}
1931

2032
public function install(array $options=null) : bool
2133
{

web/src/app/WebApp/Installers/Laravel/app.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
class OpencartSetup extends BaseSetup {
88

9+
protected $appInfo = [
10+
'name' => 'Opencart',
11+
'group' => 'ecommerce',
12+
'enabled' => true,
13+
'version' => '3.0.3.3',
14+
'thumbnail' => 'opencart-thumb.png'
15+
];
16+
917
protected $appname = 'opencart';
1018
protected $extractsubdir="/tmp-opencart";
1119

@@ -20,7 +28,11 @@ class OpencartSetup extends BaseSetup {
2028
'archive' => [ 'src' => 'https://github.com/opencart/opencart/releases/download/3.0.3.3/opencart-3.0.3.3.zip' ],
2129
],
2230
];
23-
31+
32+
public function info(){
33+
return $this -> appInfo;
34+
}
35+
2436
public function install(array $options = null) : bool
2537
{
2638
parent::install($options);

web/src/app/WebApp/Installers/Opencart/app.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
class PrestashopSetup extends BaseSetup {
88

9+
protected $appInfo = [
10+
'name' => 'Prestashop',
11+
'group' => 'ecommerce',
12+
'enabled' => true,
13+
'version' => '1.7.7.1',
14+
'thumbnail' => 'prestashop-thumb.png'
15+
];
16+
917
protected $appname = 'prestashop';
1018
protected $extractsubdir="/tmp-prestashop";
1119

@@ -22,6 +30,10 @@ class PrestashopSetup extends BaseSetup {
2230
],
2331

2432
];
33+
34+
public function info(){
35+
return $this -> appInfo;
36+
}
2537

2638
public function install(array $options=null) : bool
2739
{

0 commit comments

Comments
 (0)