forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGravSetup.php
More file actions
76 lines (68 loc) · 1.56 KB
/
GravSetup.php
File metadata and controls
76 lines (68 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace Hestia\WebApp\Installers\Grav;
use Hestia\System\Util;
use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
class GravSetup extends BaseSetup {
protected $appInfo = [
"name" => "Grav",
"group" => "cms",
"enabled" => true,
"version" => "latest",
"thumbnail" => "grav-symbol.svg",
];
protected $appname = "grav";
protected $config = [
"form" => [
"admin" => ["type" => "boolean", "value" => false, "label" => "Create admin account"],
"username" => ["text" => "admin"],
"password" => "password",
"email" => "text",
],
"database" => false,
"resources" => [
"composer" => ["src" => "getgrav/grav", "dst" => "/"],
],
"server" => [
"nginx" => [
"template" => "grav",
],
"php" => [
"supported" => ["7.4", "8.0", "8.1"],
],
],
];
public function install(array $options = null) {
parent::install($options);
parent::setup($options);
if ($options["admin"] == true) {
chdir($this->getDocRoot());
$this->appcontext->runUser(
"v-run-cli-cmd",
[
"/usr/bin/php" . $options["php_version"],
$this->getDocRoot("/bin/gpm"),
"install admin",
],
$status,
);
$this->appcontext->runUser(
"v-run-cli-cmd",
[
"/usr/bin/php" . $options["php_version"],
$this->getDocRoot("/bin/plugin"),
"login new-user",
"-u " . $options["username"],
"-p " . $options["password"],
"-e " . $options["email"],
"-P a",
"-N " . $options["username"],
"-l en",
],
$status,
);
return $status->code === 0;
} else {
return true;
}
}
}