Skip to content

Commit 95e7fd2

Browse files
ENGCOM-3844: Sitemap filename can't exceed 32 characters #13937 #20044
- Merge Pull Request #20044 from irajneeshgupta/magento2:irajneeshgupta-patch-13937 - Merged commits: 1. 55cf2dc 2. 035e8d7 3. 417ffa2 4. e9f4981
2 parents 1beceb4 + e9f4981 commit 95e7fd2

File tree

2 files changed

+26
-16
lines changed
  • app/code/Magento/Sitemap

2 files changed

+26
-16
lines changed

app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap/Save.php

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,31 @@
55
*/
66
namespace Magento\Sitemap\Controller\Adminhtml\Sitemap;
77

8-
use Magento\Backend\App\Action;
8+
use Magento\Backend\App\Action\Context;
9+
use Magento\Framework\App\Action\HttpPostActionInterface;
910
use Magento\Framework\App\Filesystem\DirectoryList;
1011
use Magento\Framework\Controller;
12+
use Magento\Framework\Validator\StringLength;
13+
use Magento\MediaStorage\Model\File\Validator\AvailablePath;
14+
use Magento\Sitemap\Model\SitemapFactory;
1115

12-
class Save extends \Magento\Sitemap\Controller\Adminhtml\Sitemap
16+
/**
17+
* Save sitemap controller.
18+
*/
19+
class Save extends \Magento\Sitemap\Controller\Adminhtml\Sitemap implements HttpPostActionInterface
1320
{
1421
/**
1522
* Maximum length of sitemap filename
1623
*/
1724
const MAX_FILENAME_LENGTH = 32;
1825

1926
/**
20-
* @var \Magento\Framework\Validator\StringLength
27+
* @var StringLength
2128
*/
2229
private $stringValidator;
2330

2431
/**
25-
* @var \Magento\MediaStorage\Model\File\Validator\AvailablePath
32+
* @var AvailablePath
2633
*/
2734
private $pathValidator;
2835

@@ -37,33 +44,33 @@ class Save extends \Magento\Sitemap\Controller\Adminhtml\Sitemap
3744
private $filesystem;
3845

3946
/**
40-
* @var \Magento\Sitemap\Model\SitemapFactory
47+
* @var SitemapFactory
4148
*/
4249
private $sitemapFactory;
4350

4451
/**
4552
* Save constructor.
46-
* @param Action\Context $context
47-
* @param \Magento\Framework\Validator\StringLength $stringValidator
48-
* @param \Magento\MediaStorage\Model\File\Validator\AvailablePath $pathValidator
53+
* @param Context $context
54+
* @param StringLength $stringValidator
55+
* @param AvailablePath $pathValidator
4956
* @param \Magento\Sitemap\Helper\Data $sitemapHelper
5057
* @param \Magento\Framework\Filesystem $filesystem
51-
* @param \Magento\Sitemap\Model\SitemapFactory $sitemapFactory
58+
* @param SitemapFactory $sitemapFactory
5259
*/
5360
public function __construct(
54-
\Magento\Backend\App\Action\Context $context,
55-
\Magento\Framework\Validator\StringLength $stringValidator = null,
56-
\Magento\MediaStorage\Model\File\Validator\AvailablePath $pathValidator = null,
61+
Context $context,
62+
StringLength $stringValidator = null,
63+
AvailablePath $pathValidator = null,
5764
\Magento\Sitemap\Helper\Data $sitemapHelper = null,
5865
\Magento\Framework\Filesystem $filesystem = null,
59-
\Magento\Sitemap\Model\SitemapFactory $sitemapFactory = null
66+
SitemapFactory $sitemapFactory = null
6067
) {
6168
parent::__construct($context);
62-
$this->stringValidator = $stringValidator ?: $this->_objectManager->get(\Magento\Framework\Validator\StringLength::class);
63-
$this->pathValidator = $pathValidator ?: $this->_objectManager->get(\Magento\MediaStorage\Model\File\Validator\AvailablePath::class);
69+
$this->stringValidator = $stringValidator ?: $this->_objectManager->get(StringLength::class);
70+
$this->pathValidator = $pathValidator ?: $this->_objectManager->get(AvailablePath::class);
6471
$this->sitemapHelper = $sitemapHelper ?: $this->_objectManager->get(\Magento\Sitemap\Helper\Data::class);
6572
$this->filesystem = $filesystem ?: $this->_objectManager->get(\Magento\Framework\Filesystem::class);
66-
$this->sitemapFactory = $sitemapFactory ?: $this->_objectManager->get(\Magento\Sitemap\Model\SitemapFactory::class);
73+
$this->sitemapFactory = $sitemapFactory ?: $this->_objectManager->get(SitemapFactory::class);
6774
}
6875

6976
/**

app/code/Magento/Sitemap/Test/Unit/Controller/Adminhtml/Sitemap/SaveTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Magento\Framework\Controller\ResultFactory;
1010
use Magento\Sitemap\Controller\Adminhtml\Sitemap\Save;
1111

12+
/**
13+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
14+
*/
1215
class SaveTest extends \PHPUnit\Framework\TestCase
1316
{
1417
/**

0 commit comments

Comments
 (0)