From d11c5cd19df55d6d4c917d3b75b392eb06619abe Mon Sep 17 00:00:00 2001 From: Tajveez <59474504+tajveez-73@users.noreply.github.com> Date: Wed, 9 Jun 2021 17:30:34 +0500 Subject: [PATCH] Update GenerateSitemap.php Code improvement. --- Cron/GenerateSitemap.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Cron/GenerateSitemap.php b/Cron/GenerateSitemap.php index 99ddb64..51217cb 100644 --- a/Cron/GenerateSitemap.php +++ b/Cron/GenerateSitemap.php @@ -17,7 +17,6 @@ use Vendic\VueStorefrontSitemap\Model\ProductCollection; use Vendic\VueStorefrontSitemap\Model\SitemapFactory; use Magento\Framework\Filesystem\Driver\File; -use Magento\Framework\Filesystem\Io\File as Io; class GenerateSitemap { @@ -51,10 +50,6 @@ class GenerateSitemap * @var File */ protected $fileDriver; - /** - * @var Io - */ - protected $io; public function __construct( CategoryCollection $categoryCollection, @@ -62,17 +57,14 @@ public function __construct( ProductCollection $productCollection, DirectoryList $directoryList, SitemapFactory $sitemapFactory, - File $fileDriver, - Io $io + File $fileDriver ) { $this->directoryList = $directoryList; $this->sitemapFactory = $sitemapFactory; $this->productCollection = $productCollection; $this->configuration = $configuration; $this->categoryCollection = $categoryCollection; - $this->fileDriver = $fileDriver; - $this->io = $io; - + $this->fileDriver = $fileDriver; } public function execute() : void @@ -82,7 +74,7 @@ public function execute() : void $path = $this->getPubPath(); // Create directory at Path if doesn't exists - if (!$this->fileDriver->isExists($path)) $this->io->mkdir($path, 0775); + if (!$this->fileDriver->isDirectory($path)) $this->fileDriver->createDirectory($path, 0775); // Sitemap configuration $this->sitemap = $this->sitemapFactory->create($domain);