1 | <?php |
||
25 | class Install extends Command |
||
26 | { |
||
27 | const COLOR_GOOD = 'green'; |
||
28 | const COLOR_BAD = 'red'; |
||
29 | const COLOR_INFO = 'blue'; |
||
30 | const EMPTY_VALUE = 'empty value'; |
||
31 | |||
32 | /** |
||
33 | * The console command name. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $name = 'tinyissue:install'; |
||
38 | |||
39 | /** |
||
40 | * The console command description. |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $description = 'Install Tinyissue.'; |
||
45 | |||
46 | /** |
||
47 | * Required PHP modules. |
||
48 | * |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $modules = [ |
||
52 | 'pdo' => 0, |
||
53 | 'mcrypt' => 0, |
||
54 | 'openssl' => 0, |
||
55 | 'curl' => 0, |
||
56 | 'json' => 0, |
||
57 | 'mbstring' => 0, |
||
58 | 'xml' => 0, |
||
59 | ]; |
||
60 | |||
61 | /** |
||
62 | * Minimum PHP version. |
||
63 | * |
||
64 | * @var string |
||
65 | */ |
||
66 | protected $phpVersion = '5.5.0'; |
||
67 | |||
68 | /** |
||
69 | * Supported drivers. |
||
70 | * |
||
71 | * @var array |
||
72 | */ |
||
73 | protected $dbDrivers = [ |
||
74 | 'pdo_sqlite' => 0, |
||
75 | 'pdo_mysql' => 0, |
||
76 | 'pdo_pgsql' => 0, |
||
77 | 'pdo_sqlsrv' => 0, |
||
78 | ]; |
||
79 | |||
80 | /** |
||
81 | * Current user entered data & default values. |
||
82 | * |
||
83 | * @var array |
||
84 | */ |
||
85 | protected $data = [ |
||
86 | 'key' => '', |
||
87 | 'timezone' => 'Pacific/Auckland', |
||
88 | 'dbHost' => 'localhost', |
||
89 | 'dbName' => 'tinyissue', |
||
90 | 'dbUser' => 'root', |
||
91 | 'dbPass' => self::EMPTY_VALUE, |
||
92 | 'dbDriver' => 'mysql', |
||
93 | 'dbPrefix' => '', |
||
94 | 'sysEmail' => '', |
||
95 | 'sysName' => '', |
||
96 | 'adminEmail' => '', |
||
97 | 'adminFirstName' => '', |
||
98 | 'adminLastName' => '', |
||
99 | 'adminPass' => '', |
||
100 | ]; |
||
101 | |||
102 | /** |
||
103 | * The status of the environment check. |
||
104 | * |
||
105 | * @var bool |
||
106 | */ |
||
107 | protected $envStatus = true; |
||
108 | |||
109 | /** |
||
110 | * Environment requirements for display status table. |
||
111 | * |
||
112 | * @var array |
||
113 | */ |
||
114 | protected $envRequirements = []; |
||
115 | |||
116 | /** |
||
117 | * @var Filesystem |
||
118 | */ |
||
119 | protected $filesystem; |
||
120 | |||
121 | /** |
||
122 | * Execute the console command. |
||
123 | * |
||
124 | * @return bool |
||
125 | */ |
||
126 | public function fire() |
||
141 | |||
142 | /** |
||
143 | * Check the current environment and display the result in table. |
||
144 | * |
||
145 | * @return bool |
||
146 | */ |
||
147 | protected function checkEnvironment() |
||
185 | |||
186 | /** |
||
187 | * Check the availability of list of php extensions. |
||
188 | * |
||
189 | * @param array $modules |
||
190 | * @param string $labelFormat |
||
191 | * @param bool $required |
||
192 | * @param string $failedLabel |
||
193 | * |
||
194 | * @return $this |
||
195 | */ |
||
196 | protected function checkPhpExtension(array &$modules, $labelFormat, $required = true, $failedLabel = 'No') |
||
207 | |||
208 | /** |
||
209 | * Render environment requirement row. |
||
210 | * |
||
211 | * @param string $label |
||
212 | * @param bool $status |
||
213 | * @param bool $required |
||
214 | * @param string $failedLabel |
||
215 | * |
||
216 | * @return $this |
||
217 | */ |
||
218 | protected function envRequirementsRow($label, $status = false, $required = false, $failedLabel = 'No') |
||
229 | |||
230 | /** |
||
231 | * Format cell text color. |
||
232 | * |
||
233 | * @param string[] $cells |
||
234 | * @param string $color |
||
235 | * |
||
236 | * @return array |
||
237 | */ |
||
238 | protected function formatTableCells(array $cells, $color) |
||
244 | |||
245 | /** |
||
246 | * Returns list of valid db drivers. |
||
247 | * |
||
248 | * @return array |
||
249 | */ |
||
250 | protected function getValidDbDrivers() |
||
256 | |||
257 | /** |
||
258 | * Check if upload directory is accessible to the public. |
||
259 | * |
||
260 | * @return string |
||
261 | */ |
||
262 | protected function isUploadDirectoryPublic() |
||
284 | |||
285 | /** |
||
286 | * Start a stage loop. |
||
287 | * |
||
288 | * @param string $method The method name to execute in a loop |
||
289 | * |
||
290 | * @return void |
||
291 | */ |
||
292 | protected function loop($method) |
||
306 | |||
307 | /** |
||
308 | * Stage one: |
||
309 | * - Collect data for the configuration file |
||
310 | * - Create .env file |
||
311 | * - Install the database. |
||
312 | * |
||
313 | * @return void |
||
314 | * |
||
315 | * @throws \Exception |
||
316 | */ |
||
317 | protected function stageOne() |
||
377 | |||
378 | /** |
||
379 | * Prints out a section title. |
||
380 | * |
||
381 | * @param string $title |
||
382 | * |
||
383 | * @return void |
||
384 | */ |
||
385 | protected function section($title) |
||
391 | |||
392 | /** |
||
393 | * Ask user questions. |
||
394 | * |
||
395 | * @param array $questions |
||
396 | * |
||
397 | * @return $this |
||
398 | */ |
||
399 | protected function askQuestions(array $questions) |
||
417 | |||
418 | /** |
||
419 | * Returns an object for application file system. |
||
420 | * |
||
421 | * @return Filesystem |
||
422 | */ |
||
423 | protected function getFilesystem() |
||
431 | |||
432 | /** |
||
433 | * Stage two: |
||
434 | * - Collect details for admin user |
||
435 | * - Create the admin user. |
||
436 | * |
||
437 | * @return void |
||
438 | */ |
||
439 | protected function stageTwo() |
||
462 | |||
463 | /** |
||
464 | * Returns the actual value of user input. |
||
465 | * |
||
466 | * @param $name |
||
467 | * |
||
468 | * @return string |
||
469 | */ |
||
470 | protected function getInputValue($name) |
||
474 | } |
||
475 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.