Skip to content

Commit

Permalink
Merge pull request #63 from eugene-manuilov/feature/question-updates
Browse files Browse the repository at this point in the history
Updated questions to clearly identify default values
  • Loading branch information
tlovett1 authored Jun 2, 2020
2 parents 9740c80 + 6323c5e commit 9a9af6b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/classes/Command/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
}

if ( empty( $input->getOption( 'include_files' ) ) ) {
$files_question = new ConfirmationQuestion( 'Include files in snapshot? (yes|no) ', true );
$files_question = new ConfirmationQuestion( 'Include files in snapshot? (Y/n) ', true );

$include_files = $helper->ask( $input, $output, $files_question );
} else {
$include_files = true;
}

if ( empty( $input->getOption( 'include_db' ) ) ) {
$db_question = new ConfirmationQuestion( 'Include database in snapshot? (yes|no) ', true );
$db_question = new ConfirmationQuestion( 'Include database in snapshot? (Y/n) ', true );

$include_db = $helper->ask( $input, $output, $db_question );
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/classes/Command/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ protected function execute( InputInterface $input, OutputInterface $output ) {

if ( ! empty( $remote_meta['contains_files'] ) && ! empty( $remote_meta['contains_db'] ) ) {
if ( empty( $input->getOption( 'include_files' ) ) ) {
$files_question = new ConfirmationQuestion( 'Include files in snapshot? (yes|no) ', true );
$files_question = new ConfirmationQuestion( 'Do you want to download snapshot files? (Y/n) ', true );

$include_files = $helper->ask( $input, $output, $files_question );
} else {
$include_files = true;
}

if ( empty( $input->getOption( 'include_db' ) ) ) {
$db_question = new ConfirmationQuestion( 'Include database in snapshot? (yes|no) ', true );
$db_question = new ConfirmationQuestion( 'Do you want to download the snapshot database? (Y/n) ', true );

$include_db = $helper->ask( $input, $output, $db_question );
} else {
Expand All @@ -94,7 +94,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
$local_meta = Meta::getLocal( $id, $repository->getName() );

if ( ! empty( $local_meta ) && $local_meta['contains_files'] === $include_files && $local_meta['contains_db'] === $include_db ) {
$overwrite_snapshot = $helper->ask( $input, $output, new ConfirmationQuestion( 'This snapshot exists locally. Do you want to overwrite it? (yes|no) ', true ) );
$overwrite_snapshot = $helper->ask( $input, $output, new ConfirmationQuestion( 'This snapshot exists locally. Do you want to overwrite it? (Y/n) ', true ) );

if ( empty( $overwrite_snapshot ) ) {
Log::instance()->write( 'No action needed.', 0, 'success' );
Expand Down
16 changes: 8 additions & 8 deletions src/classes/Command/Pull.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
}

if ( ! empty( $remote_meta ) && ! empty( $local_meta ) ) {
$overwrite_local = $helper->ask( $input, $output, new ConfirmationQuestion( 'This snapshot exists locally. Do you want to overwrite it with the remote copy? (no|yes) ', false ) );
$overwrite_local = $helper->ask( $input, $output, new ConfirmationQuestion( 'This snapshot exists locally. Do you want to overwrite it with the remote copy? (y/N) ', false ) );
}

if ( empty( $local_meta ) && ! empty( $remote_meta ) ) {
Expand Down Expand Up @@ -147,7 +147,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
if ( $meta['contains_files'] && $meta['contains_db'] ) {
if ( $meta['contains_files'] ) {
if ( empty( $input->getOption( 'include_files' ) ) ) {
$pull_files = $helper->ask( $input, $output, new ConfirmationQuestion( 'Do you want to pull files? (yes|no) ', true ) );
$pull_files = $helper->ask( $input, $output, new ConfirmationQuestion( 'Do you want to pull files? (Y/n) ', true ) );
} else {
$pull_files = true;
}
Expand All @@ -157,7 +157,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) {

if ( $meta['contains_db'] ) {
if ( empty( $input->getOption( 'include_db' ) ) ) {
$pull_db = $helper->ask( $input, $output, new ConfirmationQuestion( 'Do you want to pull the database? (yes|no) ', true ) );
$pull_db = $helper->ask( $input, $output, new ConfirmationQuestion( 'Do you want to pull the database? (Y/n) ', true ) );
} else {
$pull_db = true;
}
Expand Down Expand Up @@ -189,7 +189,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
Log::instance()->write( 'This is not a WordPress install. WordPress needs to be present in order to pull a snapshot.', 0, 'error' );

if ( empty( $input->getOption( 'confirm_wp_download' ) ) ) {
$download_wp = $helper->ask( $input, $output, new ConfirmationQuestion( 'Do you want to download WordPress? (yes|no) ', false ) );
$download_wp = $helper->ask( $input, $output, new ConfirmationQuestion( 'Do you want to download WordPress? (y/N) ', false ) );

if ( ! $download_wp ) {
return 1;
Expand Down Expand Up @@ -233,7 +233,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
Log::instance()->write( 'No wp-config.php file present. wp-config.php needs to be setup in order to pull a snapshot.', 0, 'error' );

if ( empty( $input->getOption( 'confirm_config_create' ) ) ) {
$create_config = $helper->ask( $input, $output, new ConfirmationQuestion( 'Do you want to create a wp-config.php file? (yes|no) ', false ) );
$create_config = $helper->ask( $input, $output, new ConfirmationQuestion( 'Do you want to create a wp-config.php file? (y/N) ', false ) );

if ( ! $create_config ) {
return 1;
Expand Down Expand Up @@ -333,7 +333,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) {

if ( empty( $confirm ) ) {

$confirm = $helper->ask( $input, $output, new ConfirmationQuestion( 'Are you sure you want to do this? This is a potentially destructive operation. You should run a back up first. (yes|no) ', false ) );
$confirm = $helper->ask( $input, $output, new ConfirmationQuestion( 'Are you sure you want to do this? This is a potentially destructive operation. You should run a back up first. (y/N) ', false ) );

if ( ! $confirm ) {
return 1;
Expand Down Expand Up @@ -436,7 +436,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
$change_wp_version = true;

if ( empty( $confirm_wp_version_change ) ) {
$change_wp_version = $helper->ask( $input, $output, new ConfirmationQuestion( 'This snapshot is running WordPress version ' . $snapshot->meta['wp_version'] . ', and you are running ' . $wp_version . '. Do you want to change your WordPress version to ' . $snapshot->meta['wp_version'] . '? (yes|no) ', true ) );
$change_wp_version = $helper->ask( $input, $output, new ConfirmationQuestion( 'This snapshot is running WordPress version ' . $snapshot->meta['wp_version'] . ', and you are running ' . $wp_version . '. Do you want to change your WordPress version to ' . $snapshot->meta['wp_version'] . '? (Y/n) ', true ) );
}

if ( ! empty( $change_wp_version ) ) {
Expand Down Expand Up @@ -708,7 +708,7 @@ function( $answer ) {
$update_ms_constants = $input->getOption( 'confirm_ms_constant_update' );

if ( ! $update_ms_constants ) {
$update_ms_constants = $helper->ask( $input, $output, new ConfirmationQuestion( 'Constants need to be updated in your wp-config.php file. Want WP Snapshots to do this automatically? (yes|no) ', true ) );
$update_ms_constants = $helper->ask( $input, $output, new ConfirmationQuestion( 'Constants need to be updated in your wp-config.php file. Want WP Snapshots to do this automatically? (Y/n) ', true ) );
}

if ( ! $update_ms_constants ) {
Expand Down
4 changes: 2 additions & 2 deletions src/classes/Command/Push.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
}

if ( empty( $input->getOption( 'include_files' ) ) ) {
$files_question = new ConfirmationQuestion( 'Include files in snapshot? (yes|no) ', true );
$files_question = new ConfirmationQuestion( 'Include files in snapshot? (Y/n) ', true );

$include_files = $helper->ask( $input, $output, $files_question );
} else {
$include_files = true;
}

if ( empty( $input->getOption( 'include_db' ) ) ) {
$db_question = new ConfirmationQuestion( 'Include database in snapshot? (yes|no) ', true );
$db_question = new ConfirmationQuestion( 'Include database in snapshot? (Y/n) ', true );

$include_db = $helper->ask( $input, $output, $db_question );
} else {
Expand Down

0 comments on commit 9a9af6b

Please sign in to comment.