| @@ 195-215 (lines=21) @@ | ||
| 192 | * @param string $file A path to a file relative to the application's root |
|
| 193 | * @return void |
|
| 194 | */ |
|
| 195 | public static function setSecuritySaltInFile($dir, $io, $newKey, $file) |
|
| 196 | { |
|
| 197 | $config = $dir . '/config/' . $file; |
|
| 198 | $content = file_get_contents($config); |
|
| 199 | ||
| 200 | $content = str_replace('__SALT__', $newKey, $content, $count); |
|
| 201 | ||
| 202 | if ($count == 0) { |
|
| 203 | $io->write('No Security.salt placeholder to replace.'); |
|
| 204 | ||
| 205 | return; |
|
| 206 | } |
|
| 207 | ||
| 208 | $result = file_put_contents($config, $content); |
|
| 209 | if ($result) { |
|
| 210 | $io->write('Updated Security.salt value in config/' . $file); |
|
| 211 | ||
| 212 | return; |
|
| 213 | } |
|
| 214 | $io->write('Unable to update Security.salt value.'); |
|
| 215 | } |
|
| 216 | ||
| 217 | /** |
|
| 218 | * Set the APP_NAME value in a given file |
|
| @@ 226-245 (lines=20) @@ | ||
| 223 | * @param string $file A path to a file relative to the application's root |
|
| 224 | * @return void |
|
| 225 | */ |
|
| 226 | public static function setAppNameInFile($dir, $io, $appName, $file) |
|
| 227 | { |
|
| 228 | $config = $dir . '/config/' . $file; |
|
| 229 | $content = file_get_contents($config); |
|
| 230 | $content = str_replace('__APP_NAME__', $appName, $content, $count); |
|
| 231 | ||
| 232 | if ($count == 0) { |
|
| 233 | $io->write('No __APP_NAME__ placeholder to replace.'); |
|
| 234 | ||
| 235 | return; |
|
| 236 | } |
|
| 237 | ||
| 238 | $result = file_put_contents($config, $content); |
|
| 239 | if ($result) { |
|
| 240 | $io->write('Updated __APP_NAME__ value in config/' . $file); |
|
| 241 | ||
| 242 | return; |
|
| 243 | } |
|
| 244 | $io->write('Unable to update __APP_NAME__ value.'); |
|
| 245 | } |
|
| 246 | } |
|
| 247 | ||