forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrupalSetup.php
More file actions
68 lines (57 loc) · 2.22 KB
/
DrupalSetup.php
File metadata and controls
68 lines (57 loc) · 2.22 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
<?php
namespace Hestia\WebApp\Installers\Drupal;
use \Hestia\WebApp\Installers\BaseSetup as BaseSetup;
class DrupalSetup extends BaseSetup {
protected $appname = 'drupal';
protected $appInfo = [
'name' => 'Drupal',
'group' => 'cms',
'enabled' => 'yes',
'version' => 'latest',
'thumbnail' => 'drupal-thumb.png'
];
protected $config = [
'form' => [
'username' => ['type'=>'text', 'value'=>'admin'],
'password' => 'password',
'email' => 'text'
],
'database' => true,
'resources' => [
'composer' => [ 'src' => 'drupal/recommended-project', 'dst' => '/' ],
],
'server' => [
'nginx' => [
'template' => 'drupal-composer'
],
'php' => [
'supported' => [ '8.0','8.1' ],
]
],
];
public function install(array $options=null) : bool
{
parent::install($options);
parent::setup($options);
$this->appcontext->runComposer(["require", "-d " . $this->getDocRoot(), "drush/drush:^10"]);
$htaccess_rewrite = '
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ web/$1 [L]
</IfModule>';
$tmp_configpath = $this->saveTempFile($htaccess_rewrite);
$this->appcontext->runUser('v-move-fs-file',[$tmp_configpath, $this->getDocRoot(".htaccess")], $result);
$php_version = $this -> appcontext -> getSupportedPHP($this -> config['server']['php']['supported']);
$this -> appcontext -> runUser('v-run-cli-cmd', [
"/usr/bin/php$php_version",
$this -> getDocRoot('/vendor/drush/drush/drush'),
'site-install',
'standard',
'--db-url=mysql://'.$this->appcontext->user() . '_' . $options['database_user'].':' . $options['database_password'].'@localhost:3306/'.$this->appcontext->user() . '_' . $options['database_name'].'',
'--account-name='.$options['username'].' --account-pass='.$options['password'],
'--site-name=Drupal',
'--site-mail='.$options['email']
], $status);
return ($status->code === 0);
}
}