@@ -2,7 +2,6 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace Apps\Controller\Console; |
4 | 4 | |
5 | -use Apps\ActiveRecord\App; |
|
6 | 5 | use Ffcms\Console\Console; |
7 | 6 | use Ffcms\Core\Exception\NativeException; |
8 | 7 | use Ffcms\Core\Helper\FileSystem\Directory; |
@@ -11,7 +10,6 @@ discard block |
||
11 | 10 | use Ffcms\Core\Helper\Type\Obj; |
12 | 11 | use Ffcms\Core\Helper\Type\Str; |
13 | 12 | use Apps\Controller\Console\Db as DbController; |
14 | -use Symfony\Component\VarDumper\Caster\ConstStub; |
|
15 | 13 | |
16 | 14 | class Main |
17 | 15 | { |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function actionHelp() |
30 | 30 | { |
31 | - $text = "You are using FFCMS console application." . PHP_EOL; |
|
32 | - $text .= "This application support next basic commands:" . PHP_EOL; |
|
33 | - $text .= "\t main/info - show info about CMS" . PHP_EOL; |
|
34 | - $text .= "\t main/install - install FFCMS from console line." . PHP_EOL; |
|
35 | - $text .= "\t main/update - update package to current minor version if available." . PHP_EOL; |
|
36 | - $text .= "\t main/chmod - update chmod for ffcms special folders. Can be used after project deployment." . PHP_EOL; |
|
37 | - $text .= "\t main/buildperms - build and update permissions map for applications." . PHP_EOL; |
|
38 | - $text .= "\t create/model workground/modelName - create model carcase default." . PHP_EOL; |
|
39 | - $text .= "\t create/ar activeRecordName - create active record table and model." . PHP_EOL; |
|
40 | - $text .= "\t create/controller workground/controllerName - create default controller carcase." . PHP_EOL; |
|
41 | - $text .= "\t create/widget workground/widgetName/widgetName - create default widget carcase." . PHP_EOL; |
|
42 | - $text .= "\t db/import activeRecordName - import to database single schema from ar model." . PHP_EOL; |
|
43 | - $text .= "\t db/importAll - import all active record tables to database." . PHP_EOL; |
|
44 | - $text .= "\t db/adduser - add new user into database." . PHP_EOL; |
|
31 | + $text = "You are using FFCMS console application.".PHP_EOL; |
|
32 | + $text .= "This application support next basic commands:".PHP_EOL; |
|
33 | + $text .= "\t main/info - show info about CMS".PHP_EOL; |
|
34 | + $text .= "\t main/install - install FFCMS from console line.".PHP_EOL; |
|
35 | + $text .= "\t main/update - update package to current minor version if available.".PHP_EOL; |
|
36 | + $text .= "\t main/chmod - update chmod for ffcms special folders. Can be used after project deployment.".PHP_EOL; |
|
37 | + $text .= "\t main/buildperms - build and update permissions map for applications.".PHP_EOL; |
|
38 | + $text .= "\t create/model workground/modelName - create model carcase default.".PHP_EOL; |
|
39 | + $text .= "\t create/ar activeRecordName - create active record table and model.".PHP_EOL; |
|
40 | + $text .= "\t create/controller workground/controllerName - create default controller carcase.".PHP_EOL; |
|
41 | + $text .= "\t create/widget workground/widgetName/widgetName - create default widget carcase.".PHP_EOL; |
|
42 | + $text .= "\t db/import activeRecordName - import to database single schema from ar model.".PHP_EOL; |
|
43 | + $text .= "\t db/importAll - import all active record tables to database.".PHP_EOL; |
|
44 | + $text .= "\t db/adduser - add new user into database.".PHP_EOL; |
|
45 | 45 | return $text; |
46 | 46 | } |
47 | 47 | |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function actionInfo() |
53 | 53 | { |
54 | - $text = "Information about FFCMS package and environment:" . PHP_EOL; |
|
55 | - $text .= "\t PHP version: " . phpversion() . PHP_EOL; |
|
56 | - $text .= "\t Dist path: " . root . PHP_EOL; |
|
57 | - $text .= "\t Used version: " . Console::$Properties->version['num'] . ' [build: ' . Console::$Properties->version['date'] . ']' . PHP_EOL; |
|
58 | - $text .= "Information about FFCMS cmf packages:" . PHP_EOL; |
|
54 | + $text = "Information about FFCMS package and environment:".PHP_EOL; |
|
55 | + $text .= "\t PHP version: ".phpversion().PHP_EOL; |
|
56 | + $text .= "\t Dist path: ".root.PHP_EOL; |
|
57 | + $text .= "\t Used version: ".Console::$Properties->version['num'].' [build: '.Console::$Properties->version['date'].']'.PHP_EOL; |
|
58 | + $text .= "Information about FFCMS cmf packages:".PHP_EOL; |
|
59 | 59 | |
60 | 60 | $composerInfo = File::read('/composer.lock'); |
61 | 61 | if (false !== $composerInfo) { |
62 | 62 | $jsonInfo = json_decode($composerInfo); |
63 | 63 | foreach ($jsonInfo->packages as $item) { |
64 | - $text .= "\t Package: " . $item->name . ' => ' . $item->version . PHP_EOL; |
|
64 | + $text .= "\t Package: ".$item->name.' => '.$item->version.PHP_EOL; |
|
65 | 65 | } |
66 | 66 | } else { |
67 | 67 | $text .= "\t Composer is never be used - no information available."; |
@@ -97,16 +97,16 @@ discard block |
||
97 | 97 | preg_match_all('/public function action(\w*?)\(/', $byte, $matches); // matches[0] contains all methods ;) |
98 | 98 | if (Obj::isArray($matches[1]) && count($matches[1]) > 0) { |
99 | 99 | foreach ($matches[1] as $perm) { |
100 | - $permissions[] = 'Admin/' . $className . '/' . $perm; |
|
100 | + $permissions[] = 'Admin/'.$className.'/'.$perm; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | 105 | // prepare save string |
106 | - $stringSave = "<?php \n\nreturn " . var_export($permissions, true) . ';'; |
|
106 | + $stringSave = "<?php \n\nreturn ".var_export($permissions, true).';'; |
|
107 | 107 | File::write('/Private/Config/Permissions.php', $stringSave); |
108 | 108 | |
109 | - return 'Permissions configuration is successful updated! Founded permissions: ' . count($permissions); |
|
109 | + return 'Permissions configuration is successful updated! Founded permissions: '.count($permissions); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | if (Directory::exist($obj)) { |
121 | 121 | Directory::recursiveChmod($obj, 0777); |
122 | 122 | } elseif (File::exist($obj)) { |
123 | - chmod(root . $obj, 0777); |
|
123 | + chmod(root.$obj, 0777); |
|
124 | 124 | } else { |
125 | - $errors .= Console::$Output->write('Filesystem object is not founded: ' . $obj); |
|
125 | + $errors .= Console::$Output->write('Filesystem object is not founded: '.$obj); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | echo Console::$Output->writeHeader('License start'); |
144 | - echo File::read('/LICENSE') . PHP_EOL; |
|
144 | + echo File::read('/LICENSE').PHP_EOL; |
|
145 | 145 | echo Console::$Output->writeHeader('License end'); |
146 | 146 | |
147 | 147 | $config = Console::$Properties->get('database'); |
@@ -160,38 +160,38 @@ discard block |
||
160 | 160 | |
161 | 161 | // database config from input |
162 | 162 | echo Console::$Output->writeHeader('Database connection configuration'); |
163 | - echo 'Driver(default:' . $config['driver'] . '):'; |
|
163 | + echo 'Driver(default:'.$config['driver'].'):'; |
|
164 | 164 | $dbDriver = Console::$Input->read(); |
165 | 165 | if (Arr::in($dbDriver, ['mysql', 'pgsql', 'sqlite'])) { |
166 | 166 | $newConfig['driver'] = $dbDriver; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // for sqlite its would be a path |
170 | - echo 'Host(default:' . $config['host'] . '):'; |
|
170 | + echo 'Host(default:'.$config['host'].'):'; |
|
171 | 171 | $dbHost = Console::$Input->read(); |
172 | 172 | if (!Str::likeEmpty($dbHost)) { |
173 | 173 | $newConfig['host'] = $dbHost; |
174 | 174 | } |
175 | 175 | |
176 | - echo 'Database name(default:' . $config['database'] . '):'; |
|
176 | + echo 'Database name(default:'.$config['database'].'):'; |
|
177 | 177 | $dbName = Console::$Input->read(); |
178 | 178 | if (!Str::likeEmpty($dbName)) { |
179 | 179 | $newConfig['database'] = $dbName; |
180 | 180 | } |
181 | 181 | |
182 | - echo 'User(default:' . $config['username'] . '):'; |
|
182 | + echo 'User(default:'.$config['username'].'):'; |
|
183 | 183 | $dbUser = Console::$Input->read(); |
184 | 184 | if (!Str::likeEmpty($dbUser)) { |
185 | 185 | $newConfig['username'] = $dbUser; |
186 | 186 | } |
187 | 187 | |
188 | - echo 'Password(default:' . $config['password'] . '):'; |
|
188 | + echo 'Password(default:'.$config['password'].'):'; |
|
189 | 189 | $dbPwd = Console::$Input->read(); |
190 | 190 | if (!Str::likeEmpty($dbPwd)) { |
191 | 191 | $newConfig['password'] = $dbPwd; |
192 | 192 | } |
193 | 193 | |
194 | - echo 'Table prefix(default:' . $config['prefix'] . '):'; |
|
194 | + echo 'Table prefix(default:'.$config['prefix'].'):'; |
|
195 | 195 | $dbPrefix = Console::$Input->read(); |
196 | 196 | if (!Str::likeEmpty($dbPrefix)) { |
197 | 197 | $newConfig['prefix'] = $dbPrefix; |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | try { |
205 | 205 | Console::$Database->connection('install')->getDatabaseName(); |
206 | 206 | } catch (\Exception $e) { |
207 | - return 'Testing database connection is failed! Run installer again and pass tested connection data! Log: ' . $e->getMessage(); |
|
207 | + return 'Testing database connection is failed! Run installer again and pass tested connection data! Log: '.$e->getMessage(); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | // autoload isn't work here |
211 | - include(root . '/Apps/Controller/Console/Db.php'); |
|
211 | + include(root.'/Apps/Controller/Console/Db.php'); |
|
212 | 212 | |
213 | 213 | // import db data |
214 | 214 | $dbController = new DbController(); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | // set website send from email from input |
218 | 218 | $emailConfig = Console::$Properties->get('adminEmail'); |
219 | - echo 'Website sendFrom email(default: ' . $emailConfig . '):'; |
|
219 | + echo 'Website sendFrom email(default: '.$emailConfig.'):'; |
|
220 | 220 | $email = Console::$Input->read(); |
221 | 221 | if (!Str::isEmail($email)) { |
222 | 222 | $email = $emailConfig; |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | $allCfg['adminEmail'] = $email; |
238 | 238 | $allCfg['baseDomain'] = $baseDomain; |
239 | 239 | echo Console::$Output->write('Generate password salt for BLOWFISH crypt'); |
240 | - $allCfg['passwordSalt'] = '$2a$07$' . Str::randomLatinNumeric(mt_rand(21, 30)) . '$'; |
|
240 | + $allCfg['passwordSalt'] = '$2a$07$'.Str::randomLatinNumeric(mt_rand(21, 30)).'$'; |
|
241 | 241 | echo Console::$Output->write('Generate security cookies for debug panel'); |
242 | - $allCfg['debug']['cookie']['key'] = 'fdebug_' . Str::randomLatinNumeric(mt_rand(8, 32)); |
|
242 | + $allCfg['debug']['cookie']['key'] = 'fdebug_'.Str::randomLatinNumeric(mt_rand(8, 32)); |
|
243 | 243 | $allCfg['debug']['cookie']['value'] = Str::randomLatinNumeric(mt_rand(32, 128)); |
244 | 244 | |
245 | 245 | // write config data |