1 | <?php namespace Anomaly\Streams\Platform\Installer\Console; |
||
41 | class Install extends Command |
||
42 | { |
||
43 | |||
44 | use DispatchesJobs; |
||
45 | |||
46 | /** |
||
47 | * The console command name. |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $name = 'install'; |
||
52 | |||
53 | /** |
||
54 | * The console command description. |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $description = 'Install the Streams Platform.'; |
||
59 | |||
60 | /** |
||
61 | * Execute the console command. |
||
62 | * |
||
63 | * @param Dispatcher $events |
||
64 | * @param AddonManager $manager |
||
65 | */ |
||
66 | public function fire(Dispatcher $events, AddonManager $manager) |
||
67 | { |
||
68 | $data = new Collection(); |
||
69 | |||
70 | if (!$this->option('ready')) { |
||
71 | |||
72 | $this->dispatch(new ConfirmLicense($this)); |
||
73 | $this->dispatch(new SetStreamsData($data)); |
||
74 | $this->dispatch(new SetDatabaseData($data, $this)); |
||
75 | $this->dispatch(new SetApplicationData($data, $this)); |
||
76 | $this->dispatch(new SetAdminData($data, $this)); |
||
77 | $this->dispatch(new SetOtherData($data, $this)); |
||
78 | |||
79 | $this->dispatch(new WriteEnvironmentFile($data->all())); |
||
80 | } |
||
81 | |||
82 | $this->dispatch(new ReloadEnvironmentFile()); |
||
83 | $this->dispatch(new LoadEnvironmentOverrides()); |
||
84 | $this->dispatch(new InitializeApplication()); |
||
85 | |||
86 | $this->dispatch(new ConfigureDatabase()); |
||
87 | $this->dispatch(new SetDatabasePrefix()); |
||
88 | |||
89 | $installers = new InstallerCollection(); |
||
90 | |||
91 | $this->dispatch(new LoadCoreInstallers($installers)); |
||
92 | $this->dispatch(new LoadApplicationInstallers($installers)); |
||
93 | $this->dispatch(new LoadModuleInstallers($installers)); |
||
94 | $this->dispatch(new LoadExtensionInstallers($installers)); |
||
95 | |||
96 | $installers->add( |
||
97 | new Installer( |
||
98 | 'streams::installer.reloading_application', |
||
99 | function () use ($manager, $events) { |
||
100 | |||
101 | $this->call('env:set', ['line' => 'INSTALLED=true']); |
||
102 | |||
103 | $this->dispatch(new ReloadEnvironmentFile()); |
||
104 | $this->dispatch(new AutoloadEntryModels()); // Don't forget! |
||
105 | |||
106 | $manager->register(); // Register all of our addons. |
||
107 | } |
||
108 | ) |
||
109 | ); |
||
110 | |||
111 | $this->dispatch(new LoadBaseMigrations($installers)); |
||
112 | $this->dispatch(new LoadBaseSeeders($installers)); |
||
113 | |||
114 | $this->dispatch(new LoadModuleSeeders($installers)); |
||
115 | $this->dispatch(new LoadExtensionSeeders($installers)); |
||
116 | |||
117 | $this->dispatch(new RunInstallers($installers, $this)); |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * Get the console command options. |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | protected function getOptions() |
||
131 | } |
||
132 |