|
4 | 4 | *
|
5 | 5 | * @package OlegKoval_RegenerateUrlRewrites
|
6 | 6 | * @author Oleg Koval <[email protected]>
|
7 |
| - * @copyright 2018 Oleg Koval |
| 7 | + * @copyright 2017-2067 Oleg Koval |
8 | 8 | * @license OSL-3.0, AFL-3.0
|
9 | 9 | */
|
10 | 10 |
|
|
16 | 16 | use Symfony\Component\Console\Input\InputOption;
|
17 | 17 | use Symfony\Component\Console\Output\OutputInterface;
|
18 | 18 |
|
19 |
| -class RegenerateUrlRewrites extends RegenerateUrlRewritesCategoryAbstract |
| 19 | +class RegenerateUrlRewrites extends RegenerateUrlRewritesAbstract |
20 | 20 | {
|
21 | 21 | /**
|
22 | 22 | * @var null|Symfony\Component\Console\Input\InputInterface
|
@@ -102,12 +102,6 @@ protected function configure()
|
102 | 102 | InputArgument::OPTIONAL,
|
103 | 103 | 'Specific product ID, e.g.: 107 (Pro version only)'
|
104 | 104 | ),
|
105 |
| - new InputOption( |
106 |
| - self::INPUT_KEY_CHECK_USE_CATEGORIES_FOR_PRODUCT_URL, |
107 |
| - null, |
108 |
| - InputOption::VALUE_NONE, |
109 |
| - 'Check if product use categories in URL' |
110 |
| - ), |
111 | 105 | new InputOption(
|
112 | 106 | self::INPUT_KEY_NO_REGEN_URL_KEY,
|
113 | 107 | null,
|
@@ -150,37 +144,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
|
150 | 144 |
|
151 | 145 | foreach ($this->_commandOptions['storesList'] as $storeId => $storeCode) {
|
152 | 146 | $this->_output->writeln('');
|
153 |
| - $this->_output->writeln("[Store ID: {$storeId}, Store View code: {$storeCode}]:"); |
| 147 | + $this->_output->writeln("[Type: {$this->_commandOptions['entityType']}, Store ID: {$storeId}, Store View code: {$storeCode}]:"); |
154 | 148 | $this->_storeManager->setCurrentStore($storeId);
|
155 | 149 |
|
156 | 150 | if ($this->_commandOptions['entityType'] == self::INPUT_KEY_REGENERATE_ENTITY_TYPE_PRODUCT) {
|
157 |
| - if (count($this->_commandOptions['productsFilter']) > 0) { |
158 |
| - $this->regenerateProductsRangeUrlRewrites( |
159 |
| - $this->_commandOptions['productsFilter'], |
160 |
| - $storeId |
161 |
| - ); |
162 |
| - } elseif (!empty($this->_commandOptions['productId'])) { |
163 |
| - $this->regenerateSpecificProductUrlRewrites( |
164 |
| - $this->_commandOptions['productId'], |
165 |
| - $storeId |
166 |
| - ); |
167 |
| - } else { |
168 |
| - $this->regenerateAllProductsUrlRewrites($storeId); |
169 |
| - } |
| 151 | + $this->regenerateProductRewrites->regenerateOptions = $this->_commandOptions; |
| 152 | + $this->regenerateProductRewrites->regenerate($storeId); |
170 | 153 | } elseif ($this->_commandOptions['entityType'] == self::INPUT_KEY_REGENERATE_ENTITY_TYPE_CATEGORY) {
|
171 |
| - if (count($this->_commandOptions['categoriesFilter']) > 0) { |
172 |
| - $this->regenerateCategoriesRangeUrlRewrites( |
173 |
| - $this->_commandOptions['categoriesFilter'], |
174 |
| - $storeId |
175 |
| - ); |
176 |
| - } elseif (!empty($this->_commandOptions['categoryId'])) { |
177 |
| - $this->regenerateSpecificCategoryUrlRewrites( |
178 |
| - $this->_commandOptions['categoryId'], |
179 |
| - $storeId |
180 |
| - ); |
181 |
| - } else { |
182 |
| - $this->regenerateAllCategoriesUrlRewrites($storeId); |
183 |
| - } |
| 154 | + $this->regenerateCategoryRewrites->regenerateOptions = $this->_commandOptions; |
| 155 | + $this->regenerateCategoryRewrites->regenerate($storeId); |
184 | 156 | }
|
185 | 157 | }
|
186 | 158 |
|
@@ -240,12 +212,6 @@ public function getCommandOptions()
|
240 | 212 | $this->_commandOptions['runCacheFlush'] = false;
|
241 | 213 | }
|
242 | 214 |
|
243 |
| - if ( |
244 |
| - isset($options[self::INPUT_KEY_CHECK_USE_CATEGORIES_FOR_PRODUCT_URL]) |
245 |
| - && $options[self::INPUT_KEY_CHECK_USE_CATEGORIES_FOR_PRODUCT_URL] === true) { |
246 |
| - $this->_commandOptions['checkUseCategoryInProductUrl'] = true; |
247 |
| - } |
248 |
| - |
249 | 215 | if (isset($options[self::INPUT_KEY_PRODUCTS_RANGE])) {
|
250 | 216 | $this->_commandOptions['productsFilter'] = $this->_generateIdsRangeArray(
|
251 | 217 | $options[self::INPUT_KEY_PRODUCTS_RANGE],
|
|
0 commit comments