|
1
|
|
|
<?php |
|
2
|
|
|
namespace PressCLI\WPCLI; |
|
3
|
|
|
|
|
4
|
|
|
use PressCLI\WPCLI\CLI; |
|
5
|
|
|
use PressCLI\Option\Configuration; |
|
6
|
|
|
|
|
7
|
|
|
trait Core |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* Downloads WordPress core. |
|
11
|
|
|
*/ |
|
12
|
|
|
public static function coreDownload() |
|
13
|
|
|
{ |
|
14
|
|
|
CLI::execCommand('core', ['download']); |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Creates the wp-config.php |
|
19
|
|
|
*/ |
|
20
|
|
|
public static function coreConfig() |
|
21
|
|
|
{ |
|
22
|
|
|
$config = Configuration::get(); |
|
23
|
|
|
$dbConfig = $config['database']; |
|
24
|
|
|
$options = [ |
|
25
|
|
|
'skip-check' => '', |
|
26
|
|
|
'dbuser' => $dbConfig['user'], |
|
27
|
|
|
'dbpass' => $dbConfig['password'], |
|
28
|
|
|
'dbprefix' => $dbConfig['prefix'], |
|
29
|
|
|
'dbname' => $dbConfig['name'], |
|
30
|
|
|
'dbhost' => $dbConfig['host'], |
|
31
|
|
|
]; |
|
32
|
|
|
|
|
33
|
|
|
CLI::execCommand('core', ['config'], $options); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Install WordPress. |
|
38
|
|
|
*/ |
|
39
|
|
|
public static function coreInstall() |
|
40
|
|
|
{ |
|
41
|
|
|
$config = Configuration::get(); |
|
42
|
|
|
$options = [ |
|
43
|
|
|
'url' => $config['site']['url'], |
|
44
|
|
|
'title' => $config['site']['title'], |
|
45
|
|
|
'admin_user' => $config['user']['name'], |
|
46
|
|
|
'admin_password' => $config['user']['password'], |
|
47
|
|
|
'admin_email' => $config['user']['email'], |
|
48
|
|
|
'skip-email' => '', |
|
49
|
|
|
]; |
|
50
|
|
|
|
|
51
|
|
|
CLI::execCommand('core', ['install'], $options); |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|