Skip to content

Commit e62509d

Browse files
added grav, mediawiki and dokuwiki quick installs
1 parent 955f0fd commit e62509d

File tree

6 files changed

+839
-0
lines changed

6 files changed

+839
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
3+
namespace Hestia\WebApp\Installers\DokuWiki;
4+
5+
use Hestia\System\Util;
6+
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
7+
8+
class DokuWikiSetup extends BaseSetup {
9+
10+
protected $appInfo = [
11+
'name' => 'DokuWiki',
12+
'group' => 'wiki',
13+
'enabled' => true,
14+
'version' => 'stable_2020-07-29',
15+
'thumbnail' => 'dokuwiki-logo.svg'
16+
];
17+
18+
protected $appname = 'dokuwiki';
19+
protected $extractsubdir = "/tmp-dokuwiki";
20+
21+
protected $config = [
22+
'form' => [
23+
'wiki_name' => 'text',
24+
'superuser' => 'text',
25+
'real_name' => 'text',
26+
'email' => 'text',
27+
'password' => 'password',
28+
'initial_ACL_policy' => [
29+
'type' => 'select',
30+
'options' => [
31+
'0: Open Wiki (read, write, upload for everyone)', // 0
32+
'1: Public Wiki (read for everyone, write and upload for registered users)', // 1
33+
'2: Closed Wiki (read, write, upload for registered users only)' // 3
34+
],
35+
],
36+
'content_license' => [
37+
'type' => 'select',
38+
'options' => [
39+
'cc-zero: CC0 1.0 Universal',
40+
'publicdomain: Public Domain',
41+
'cc-by: CC Attribution 4.0 International',
42+
'cc-by-sa: CC Attribution-Share Alike 4.0 International',
43+
'gnufdl: GNU Free Documentation License 1.3',
44+
'cc-by-nc: CC Attribution-Noncommercial 4.0 International',
45+
'cc-by-nc-sa: CC Attribution-Noncommercial-Share Alike 4.0 International',
46+
'0: Do not show any license information',
47+
]
48+
],
49+
],
50+
'resources' => [
51+
'archive' => [ 'src' => 'https://github.com/splitbrain/dokuwiki/archive/refs/tags/release_stable_2020-07-29.zip' ],
52+
],
53+
];
54+
55+
public function install(array $options = null)
56+
{
57+
parent::install($options);
58+
59+
$webDomain = "https://" . $this->domain . "/";
60+
61+
$this->appcontext->runUser('v-copy-fs-directory',[
62+
$this->getDocRoot($this->extractsubdir . "/dokuwiki-release_stable_2020-07-29/."),
63+
$this->getDocRoot()], $result);
64+
65+
$installUrl = $webDomain . "install.php";
66+
67+
$cmd = "curl --request POST "
68+
. "--url $installUrl "
69+
. "--header 'Content-Type: application/x-www-form-urlencoded' "
70+
. "--data l=en "
71+
. "--data 'd[title]=" . $options['wiki_name'] . "' "
72+
. "--data 'd[acl]=on' "
73+
. "--data 'd[superuser]=" . $options['superuser'] . "' "
74+
. "--data 'd[fullname]=" . $options['real_name'] . "' "
75+
. "--data 'd[email]=" . $options['email'] . "' "
76+
. "--data 'd[password]=" . $options['password'] . "' "
77+
. "--data 'd[confirm]=" . $options['password'] . "' "
78+
. "--data 'd[policy]=" . substr($options['initial_ACL_policy'], 0, 1) . "' "
79+
. "--data 'd[license]=" . explode(":", $options['content_license'])[0] . "' "
80+
. "--data submit=";
81+
82+
exec($cmd, $msg, $code);
83+
84+
// remove temp folder
85+
$this->cleanup();
86+
87+
return ($code === 0);
88+
}
89+
}

0 commit comments

Comments
 (0)