protected function execute(InputInterface $input, OutputInterface $output) { if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) { $helper = $this->getHelper('question'); $question = new ConfirmationQuestion("\n <error>!!!!!!!!!! WARNING !!!!!!!!!!</error>\n\n Restoring files can cause <fg=red>IRREVERSIBLE</> damage.\n All existing files in the <fg=yellow>destination directory</> will be <fg=red>REPLACED</>.\n\n Storage: <fg=blue>{$input->getArgument('storage')}</>\n Backup file: <fg=yellow>{$input->getArgument('backup_file_path')}</>\n Destination directory: <fg=green>{$input->getArgument('destination_directory')}</>\n\n Are you sure you want to proceed [y/n]? ", false, '/^(y|j)/i'); // Shows a message if the process is cancelled if (!$helper->ask($input, $output, $question)) { $output->writeln("\n Files restore process <fg=yellow>cancelled</>.\n"); return; } $output->writeln("\n Downloading and extracting backup to <fg=yellow>{$input->getArgument('destination_directory')}</>, please wait..."); } // Execute backup with input arguments. $result = Restore::files($input->getArgument('storage'), $input->getArgument('backup_file_path'), $input->getArgument('destination_directory'), $input->getArgument('compression'), $input->getOption('parts')); // Output the result of backup process. $output->writeln($result); }
protected function execute(InputInterface $input, OutputInterface $output) { if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) { $helper = $this->getHelper('question'); $question = new ConfirmationQuestion("\n <error>!!!!!!!!!! WARNING !!!!!!!!!!</error>\n\n Restoring a database can cause <fg=yellow>IRREVERSIBLE</> damage.\n You are about to <fg=red>DESTROY</> a complete database!\n\n Storage:</> <fg=blue>{$input->getArgument('storage')}</>\n Backup file:</> <fg=yellow>{$input->getArgument('backup_file_path')}</>\n Database profile:</> <fg=green>{$input->getArgument('database')}</>\n\n Do you really want to proceed [y/n]? ", false, '/^(y|j)/i'); // Shows a message if the process is cancelled if (!$helper->ask($input, $output, $question)) { $output->writeln("\n Database restore process <fg=yellow>cancelled</>.\n"); return; } $output->writeln("\n Restoring database backup using <fg=yellow>{$input->getArgument('database')}</> profile, please wait..."); } // Execute backup with input arguments. $result = Restore::database($input->getArgument('database'), $input->getArgument('storage'), $input->getArgument('backup_file_path'), $input->getArgument('compression'), $input->getOption('parts')); // Output the result of backup process. $output->writeln($result); }