Skip to content

Commit

Permalink
fix: folder creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Danilo Argentiero committed May 9, 2019
1 parent f481661 commit 3847872
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions Model/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,12 @@ public function importFromArray(array $payload, $archivePath = null): int
continue;
}

if (!$this->file->mkdir(dirname($destFile)) ||
!$this->file->cp($sourceFile, $destFile)) {
if (!$this->file->fileExists(dirname($destFile), false)) {
if (!$this->file->mkdir(dirname($destFile))) {
throw new \Exception('Unable to create folder: ' . dirname($destFile));
}
}
if (!$this->file->cp($sourceFile, $destFile)) {
throw new \Exception('Unable to save image: ' . $mediaFile);
}
$count++;
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MSP_CmsImportExport" setup_version="1.1.0">
<module name="MSP_CmsImportExport" setup_version="1.1.1">
<sequence>
<module name="Magento_Cms"/>
<module name="MSP_Common"/>
Expand Down

0 comments on commit 3847872

Please sign in to comment.