mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-23 07:33:58 -06:00
Simplified UrlShortenerConfigCustomizerPlugin thanks to SymfonyStyle
This commit is contained in:
parent
b17f96043a
commit
0a681f0efa
@ -42,9 +42,7 @@ class DatabaseConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$io->title('DATABASE');
|
||||
|
||||
if ($appConfig->hasDatabase() && $io->confirm(
|
||||
'<question>Do you want to keep imported database config? (Y/n)</question> '
|
||||
)) {
|
||||
if ($appConfig->hasDatabase() && $io->confirm('Do you want to keep imported database config?')) {
|
||||
// If the user selected to keep DB config and is configured to use sqlite, copy DB file
|
||||
if ($appConfig->getDatabase()['DRIVER'] === self::DATABASE_DRIVERS['SQLite']) {
|
||||
try {
|
||||
|
@ -24,29 +24,26 @@ class UrlShortenerConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$io->title('URL SHORTENER');
|
||||
|
||||
if ($appConfig->hasUrlShortener() && $io->confirm(
|
||||
'<question>Do you want to keep imported URL shortener config? (Y/n):</question> '
|
||||
)) {
|
||||
if ($appConfig->hasUrlShortener() && $io->confirm('Do you want to keep imported URL shortener config?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ask for URL shortener params
|
||||
$appConfig->setUrlShortener([
|
||||
'SCHEMA' => $io->choice(
|
||||
'<question>Select schema for generated short URLs (defaults to http):</question>',
|
||||
'Select schema for generated short URLs',
|
||||
['http', 'https'],
|
||||
0
|
||||
'http'
|
||||
),
|
||||
'HOSTNAME' => $this->ask($io, 'Hostname for generated URLs'),
|
||||
'CHARS' => $this->ask(
|
||||
$io,
|
||||
'HOSTNAME' => $io->ask('Hostname for generated URLs'),
|
||||
'CHARS' => $io->ask(
|
||||
'Character set for generated short codes (leave empty to autogenerate one)',
|
||||
null,
|
||||
true
|
||||
) ?: str_shuffle(UrlShortener::DEFAULT_CHARS),
|
||||
'VALIDATE_URL' => $io->confirm(
|
||||
'<question>Do you want to validate long urls by 200 HTTP status code on response (Y/n):</question>'
|
||||
),
|
||||
function ($value) {
|
||||
return $value;
|
||||
}
|
||||
) ?: \str_shuffle(UrlShortener::DEFAULT_CHARS),
|
||||
'VALIDATE_URL' => $io->confirm('Do you want to validate long urls by 200 HTTP status code on response'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user