Skip to content

Commit fafb06d

Browse files
author
Roman Lytvynenko
committed
Merge branch 'MAGETWO-27458-sitemap-generation-via-cron' of https://github.com/dimaMackert/magento2 into MC-37306
� Conflicts: � app/code/Magento/Sitemap/Model/Observer.php
2 parents bdb1248 + c56eb37 commit fafb06d

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

app/code/Magento/Sitemap/Model/Observer.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Sitemap\Model;
79

8-
use Exception;
9-
use Magento\Sitemap\Model\EmailNotification as SitemapEmail;
10+
use Magento\Framework\App\Area;
1011
use Magento\Framework\App\Config\ScopeConfigInterface;
11-
use Magento\Sitemap\Model\ResourceModel\Sitemap\Collection;
12+
use Magento\Sitemap\Model\EmailNotification as SitemapEmail;
1213
use Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory;
1314
use Magento\Store\Model\App\Emulation;
1415
use Magento\Store\Model\ScopeInterface;
15-
use Magento\Framework\App\Area;
1616

1717
/**
1818
* Sitemap module observer
@@ -51,12 +51,12 @@ class Observer
5151
/**
5252
* Core store config
5353
*
54-
* @var ScopeConfigInterface
54+
* @var \Magento\Framework\App\Config\ScopeConfigInterface
5555
*/
5656
private $scopeConfig;
5757

5858
/**
59-
* @var CollectionFactory
59+
* @var \Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory
6060
*/
6161
private $collectionFactory;
6262

@@ -82,20 +82,18 @@ public function __construct(
8282
CollectionFactory $collectionFactory,
8383
SitemapEmail $emailNotification,
8484
Emulation $appEmulation
85-
8685
) {
8786
$this->scopeConfig = $scopeConfig;
8887
$this->collectionFactory = $collectionFactory;
8988
$this->emailNotification = $emailNotification;
9089
$this->appEmulation = $appEmulation;
91-
9290
}
9391

9492
/**
9593
* Generate sitemaps
9694
*
9795
* @return void
98-
* @throws Exception
96+
* @throws \Exception
9997
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
10098
*/
10199
public function scheduledGenerateSitemaps()
@@ -115,9 +113,9 @@ public function scheduledGenerateSitemaps()
115113
}
116114

117115
$collection = $this->collectionFactory->create();
118-
/* @var $collection Collection */
116+
/* @var $collection \Magento\Sitemap\Model\ResourceModel\Sitemap\Collection */
119117
foreach ($collection as $sitemap) {
120-
/* @var $sitemap Sitemap */
118+
/* @var $sitemap \Magento\Sitemap\Model\Sitemap */
121119
try {
122120
$this->appEmulation->startEnvironmentEmulation(
123121
$sitemap->getStoreId(),
@@ -126,7 +124,7 @@ public function scheduledGenerateSitemaps()
126124
);
127125
$sitemap->generateXml();
128126
$this->appEmulation->stopEnvironmentEmulation();
129-
} catch (Exception $e) {
127+
} catch (\Exception $e) {
130128
$errors[] = $e->getMessage();
131129
}
132130
}

0 commit comments

Comments
 (0)