|
1
|
|
|
<?php namespace Comodojo\Installer\Scripts; |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Comodojo Installer |
|
5
|
|
|
* |
|
6
|
|
|
* @package Comodojo Framework |
|
7
|
|
|
* @author Marco Giovinazzi <[email protected]> |
|
8
|
|
|
* @license GPL-3.0+ |
|
9
|
|
|
* |
|
10
|
|
|
* LICENSE: |
|
11
|
|
|
* |
|
12
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
13
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
14
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
15
|
|
|
* License, or (at your option) any later version. |
|
16
|
|
|
* |
|
17
|
|
|
* This program is distributed in the hope that it will be useful, |
|
18
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20
|
|
|
* GNU Affero General Public License for more details. |
|
21
|
|
|
* |
|
22
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
23
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
class InteractiveConfiguration { |
|
27
|
|
|
|
|
28
|
|
|
public static function postCreateProjectCmd(PackageEvent $event) { |
|
29
|
|
|
|
|
30
|
|
|
$io = $event->getIO(); |
|
31
|
|
|
|
|
32
|
|
|
$params = array(); |
|
33
|
|
|
|
|
34
|
|
|
$io->write("<info>Starting comodojo base configuration. |
|
35
|
|
|
Please answer the following questions as accurately and honestly as possible...</info>"); |
|
36
|
|
|
|
|
37
|
|
|
$params['COMODOJO_DATABASE_HOST'] = $io->ask("Database host?", "localhost"); |
|
38
|
|
|
|
|
39
|
|
|
$params['COMODOJO_DATABASE_PORT'] = $io->askAndValidate("Database port?", function($value) { |
|
40
|
|
|
return is_int($value); |
|
41
|
|
|
}, 3, 3306); |
|
42
|
|
|
|
|
43
|
|
|
$params['COMODOJO_DATABASE_NAME'] = $io->ask("Database name?", "comodojo"); |
|
44
|
|
|
|
|
45
|
|
|
$params['COMODOJO_DATABASE_USER'] = $io->ask("Database user?", "comodojo"); |
|
46
|
|
|
|
|
47
|
|
|
$params['COMODOJO_DATABASE_PASS'] = $io->ask("Database password?", ""); |
|
48
|
|
|
|
|
49
|
|
|
$params['COMODOJO_DATABASE_PREFIX'] = $io->ask("Common prefix for database tables?", "cmdj_"); |
|
50
|
|
|
|
|
51
|
|
|
$dumper = new StaticConfiguartionDumper($params); |
|
52
|
|
|
|
|
53
|
|
|
$dumper->dump(); |
|
54
|
|
|
|
|
55
|
|
|
$io->write("<info>Configuartion completed. Remember to exec 'php comodojo.php install' to install framework. Have fun.</info>"); |
|
56
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
} |
|
60
|
|
|
|