Skip to content

Commit

Permalink
Cron fails if directory doesn't Exists
Browse files Browse the repository at this point in the history
my cron failed to create sitemap.xml file because the directory I specified doesn't exist.

Warning: XMLWriter::openUri(): Unable to resolve file path in /domains/admin.bedfactorydirect.co.uk/http/vendor/evert/sitemap-php/src/SitemapPHP/Sitemap.php on line 165

by the above code changes the directory will be created programmatically.
  • Loading branch information
tajveez-73 authored Jun 9, 2021
1 parent c332cae commit b078680
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Cron/GenerateSitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public function execute() : void
$domain = $this->configuration->getVueStorefrontUrl();
$path = $this->getPubPath();

// Create directory at Path if doesn't exists
if (!file_exists($path)) {
mkdir($path, 0777, true);
}

// Sitemap configuration
$this->sitemap = $this->sitemapFactory->create($domain);
$this->sitemap->setPath($path);
Expand Down

0 comments on commit b078680

Please sign in to comment.