| @@ 103-121 (lines=19) @@ | ||
| 100 | ||
| 101 | $crawlLogger = new CrawlLogger($output); |
|
| 102 | ||
| 103 | if ($input->getOption('output')) { |
|
| 104 | $outputFile = $input->getOption('output'); |
|
| 105 | ||
| 106 | if (file_exists($outputFile)) { |
|
| 107 | $helper = $this->getHelper('question'); |
|
| 108 | $question = new ConfirmationQuestion( |
|
| 109 | "The output file `{$outputFile}` already exists. Overwrite it? (y/n)", |
|
| 110 | false |
|
| 111 | ); |
|
| 112 | ||
| 113 | if (! $helper->ask($input, $output, $question)) { |
|
| 114 | $output->writeln('Aborting...'); |
|
| 115 | ||
| 116 | return 0; |
|
| 117 | } |
|
| 118 | } |
|
| 119 | ||
| 120 | $crawlLogger->setOutputFile($input->getOption('output')); |
|
| 121 | } |
|
| 122 | ||
| 123 | if ($input->getOption('csv')) { |
|
| 124 | $csvFile = $input->getOption('csv'); |
|
| @@ 123-141 (lines=19) @@ | ||
| 120 | $crawlLogger->setOutputFile($input->getOption('output')); |
|
| 121 | } |
|
| 122 | ||
| 123 | if ($input->getOption('csv')) { |
|
| 124 | $csvFile = $input->getOption('csv'); |
|
| 125 | ||
| 126 | if (file_exists($csvFile)) { |
|
| 127 | $helper = $this->getHelper('question'); |
|
| 128 | $question = new ConfirmationQuestion( |
|
| 129 | "The csv file `{$csvFile}` already exists. Overwrite it? (y/n)", |
|
| 130 | false |
|
| 131 | ); |
|
| 132 | ||
| 133 | if (! $helper->ask($input, $output, $question)) { |
|
| 134 | $output->writeln('Aborting...'); |
|
| 135 | ||
| 136 | return 0; |
|
| 137 | } |
|
| 138 | } |
|
| 139 | ||
| 140 | $crawlLogger->setCsvFile($input->getOption('csv')); |
|
| 141 | } |
|
| 142 | ||
| 143 | $clientOptions = [ |
|
| 144 | RequestOptions::TIMEOUT => $input->getOption('timeout'), |
|