forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlarumSetup.php
More file actions
61 lines (54 loc) · 1.87 KB
/
FlarumSetup.php
File metadata and controls
61 lines (54 loc) · 1.87 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
<?php
declare(strict_types=1);
namespace Hestia\WebApp\Installers\Flarum;
use Hestia\System\Util;
use Hestia\WebApp\BaseSetup;
use Hestia\WebApp\InstallationTarget\InstallationTarget;
class FlarumSetup extends BaseSetup
{
protected array $info = [
'name' => 'Flarum',
'group' => 'forum',
'version' => 'latest',
'thumbnail' => 'fl-thumb.png',
];
protected array $config = [
'form' => [
'forum_title' => ['type' => 'text', 'value' => 'Flarum Forum'],
'admin_username' => ['value' => 'fladmin'],
'admin_email' => 'text',
'admin_password' => 'password',
],
'database' => true,
'resources' => [
'composer' => ['src' => 'flarum/flarum'],
],
'server' => [
'nginx' => [
'template' => 'flarum-composer',
],
'php' => [
'supported' => ['8.2', '8.3'],
],
],
];
protected function setupApplication(InstallationTarget $target, array $options): void
{
$this->appcontext->createFile(
$target->getDocRoot('.htaccess'),
file_get_contents(__DIR__ . '/.htaccess'),
);
$this->appcontext->sendPostRequest($target->getUrl(), [
'forumTitle' => $options['forum_title'],
'mysqlHost' => $target->database->host,
'mysqlDatabase' => $target->database->name,
'mysqlUsername' => $target->database->user,
'mysqlPassword' => $target->database->password,
'tablePrefix' => 'fl' . Util::generateString(5, false),
'adminUsername' => $options['admin_username'],
'adminEmail' => $options['admin_email'],
'adminPassword' => $options['admin_password'],
'adminPasswordConfirmation' => $options['admin_password'],
]);
}
}