1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Larrock\Core\Commands; |
4
|
|
|
|
5
|
|
|
use Illuminate\Console\Command; |
6
|
|
|
|
7
|
|
|
class LarrockInstallCommand extends Command |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* The name and signature of the console command. |
11
|
|
|
* |
12
|
|
|
* @var string |
13
|
|
|
*/ |
14
|
|
|
protected $signature = 'larrock:install {--fast= : fast install}'; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* The console command description. |
18
|
|
|
* |
19
|
|
|
* @var string |
20
|
|
|
*/ |
21
|
|
|
protected $description = 'Install LarrockCMS'; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Execute the console command. |
25
|
|
|
* |
26
|
|
|
* @return mixed |
27
|
|
|
*/ |
28
|
|
|
public function handle() |
29
|
|
|
{ |
30
|
|
|
$fast = $this->option('fast'); |
31
|
|
|
|
32
|
|
|
$this->line('=== Install LarrockCMS ==='); |
33
|
|
|
|
34
|
|
|
if (env('DB_DATABASE') === 'homestead' && ! $this->confirm('Данные для доступа к БД оставлены по-умолчанию, все верно?')) { |
35
|
|
|
$this->error('Установка завершена некорректно. Пожалуйста, установите правильные данные для |
36
|
|
|
доступа к БД и выполните команду php artisan larrock:install'); |
37
|
|
|
|
38
|
|
|
return false; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
if ($fast) { |
42
|
|
|
$this->call('larrock:updateEnv'); |
43
|
|
|
$this->call('larrock:renamePublicDirectory'); |
44
|
|
|
$this->call('larrock:updateVendorConfig'); |
45
|
|
|
$this->call('vendor:publish'); |
46
|
|
|
$this->call('migrate'); |
47
|
|
|
$this->call('larrock:addAdmin'); |
48
|
|
|
$this->call('larrock:assets'); |
49
|
|
|
} else { |
50
|
|
|
if ($this->confirm('Шаг 1/7. Обновить .env? (larrock:updateEnv)')) { |
51
|
|
|
$this->call('larrock:updateEnv'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
if ($this->confirm('Шаг 2/7. Сменить директорию "public" на "public_html"? (larrock:renamePublicDirectory)')) { |
55
|
|
|
$this->call('larrock:renamePublicDirectory'); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
if ($this->confirm('Шаг 3/7. Обновить конфиги зависимостей? (larrock:updateVendorConfig)')) { |
59
|
|
|
$this->call('larrock:updateVendorConfig'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
if ($this->confirm('Шаг 4/7. Опубликовать ресурсы (vendor:publish)?')) { |
63
|
|
|
$this->call('vendor:publish'); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
if ($this->confirm('Шаг 5/7. Выполнить миграции БД (migrate)?')) { |
67
|
|
|
$this->call('migrate'); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
if ($this->confirm('Шаг 6/7. Добавить пользователя администратора? (larrock:addAdmin)')) { |
71
|
|
|
$this->call('larrock:addAdmin'); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
if ($this->confirm('Шаг 7/7. Установить пакеты ресурсов для шаблонов? (larrock:assets)')) { |
75
|
|
|
$this->call('larrock:assets'); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
$this->info('=== Install LarrockCMS successfully ended ==='); |
80
|
|
|
$this->line('Проверка корректности установки LarrockCMS - php artisan larrock:check'); |
81
|
|
|
$this->line('Если вы хотите установить пакеты не входящие в ядро LarrockCMS, выполните команду php artisan larrock:manager'); |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|