|
21 | 21 | */ |
22 | 22 | class Sitemap extends \Magento\Sitemap\Model\Sitemap |
23 | 23 | { |
24 | | - private $state; |
25 | | - |
26 | | - public function __construct( |
27 | | - \Magento\Framework\Model\Context $context, |
28 | | - \Magento\Framework\Registry $registry, |
29 | | - \Magento\Framework\Escaper $escaper, |
30 | | - \Magento\Sitemap\Helper\Data $sitemapData, |
31 | | - \Magento\Framework\Filesystem $filesystem, |
32 | | - \Magento\Sitemap\Model\ResourceModel\Catalog\CategoryFactory $categoryFactory, |
33 | | - \Magento\Sitemap\Model\ResourceModel\Catalog\ProductFactory $productFactory, |
34 | | - \Magento\Sitemap\Model\ResourceModel\Cms\PageFactory $cmsFactory, |
35 | | - \Magento\Framework\Stdlib\DateTime\DateTime $modelDate, |
36 | | - \Magento\Store\Model\StoreManagerInterface $storeManager, |
37 | | - \Magento\Framework\App\RequestInterface $request, |
38 | | - \Magento\Framework\Stdlib\DateTime $dateTime, |
39 | | - \Magento\Framework\App\State $state, |
40 | | - \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, |
41 | | - \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, |
42 | | - array $data = [], |
43 | | - \Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot $documentRoot = null, |
44 | | - ItemProviderInterface $itemProvider = null, |
45 | | - SitemapConfigReaderInterface $configReader = null, |
46 | | - \Magento\Sitemap\Model\SitemapItemInterfaceFactory $sitemapItemFactory = null |
47 | | - ) { |
48 | | - parent::__construct($context, $registry, $escaper, $sitemapData, $filesystem, $categoryFactory, $productFactory, $cmsFactory, $modelDate, $storeManager, $request, $dateTime, $resource, $resourceCollection, $data, $documentRoot, $itemProvider, $configReader, $sitemapItemFactory); |
49 | | - $this->state = $state; |
50 | | - } |
51 | | - |
52 | 24 | /** |
53 | 25 | * Initialize sitemap items |
54 | 26 | * |
@@ -175,52 +147,4 @@ public function getSitemapPath(): string |
175 | 147 | } |
176 | 148 | return $path; |
177 | 149 | } |
178 | | - |
179 | | - public function generateXml() |
180 | | - { |
181 | | - $this->state->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND); |
182 | | - $this->_initSitemapItems(); |
183 | | - |
184 | | - /** @var $item SitemapItemInterface */ |
185 | | - foreach ($this->_sitemapItems as $item) { |
186 | | - $xml = $this->_getSitemapRow( |
187 | | - $item->getUrl(), |
188 | | - $item->getUpdatedAt(), |
189 | | - $item->getChangeFrequency(), |
190 | | - $item->getPriority(), |
191 | | - $item->getImages() |
192 | | - ); |
193 | | - |
194 | | - if ($this->_isSplitRequired($xml) && $this->_sitemapIncrement > 0) { |
195 | | - $this->_finalizeSitemap(); |
196 | | - } |
197 | | - |
198 | | - if (!$this->_fileSize) { |
199 | | - $this->_createSitemap(); |
200 | | - } |
201 | | - |
202 | | - $this->_writeSitemapRow($xml); |
203 | | - // Increase counters |
204 | | - $this->_lineCount++; |
205 | | - $this->_fileSize += strlen($xml); |
206 | | - } |
207 | | - |
208 | | - $this->_finalizeSitemap(); |
209 | | - |
210 | | - if ($this->_sitemapIncrement == 1) { |
211 | | - // In case when only one increment file was created use it as default sitemap |
212 | | - $path = rtrim($this->getSitemapPath(), '/') |
213 | | - . '/' |
214 | | - . $this->_getCurrentSitemapFilename($this->_sitemapIncrement); |
215 | | - $this->setSitemapPath($path); |
216 | | - } else { |
217 | | - // Otherwise create index file with list of generated sitemaps |
218 | | - $this->_createSitemapIndex(); |
219 | | - } |
220 | | - |
221 | | - $this->setSitemapTime($this->_dateModel->gmtDate('Y-m-d H:i:s')); |
222 | | - $this->save(); |
223 | | - |
224 | | - return $this; |
225 | | - } |
226 | 150 | } |
0 commit comments