Skip to content

Commit

Permalink
* Add functionality write a log warning instead throwing an exception…
Browse files Browse the repository at this point in the history
… if the configured media + images file dirctory are not available
  • Loading branch information
wagnert committed May 15, 2020
1 parent 8f7215f commit bfb80a6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Version 18.0.2

## Bugfixes

* None

## Features

* Add functionality write a log warning instead throwing an exception if the configured media + images file dirctory are not available

# Version 18.0.1

## Bugfixes
Expand Down
8 changes: 6 additions & 2 deletions etc/configuration/operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@
"prefix": "category-create"
},
"params": {
"copy-images": false
"copy-images": false,
"media-directory" : "pub/media/catalog/category",
"images-file-directory" : "var/importexport/media/catalog/category"
},
"observers": [
{
Expand Down Expand Up @@ -233,7 +235,9 @@
"prefix": "category-create"
},
"params": {
"copy-images": false
"copy-images": false,
"media-directory" : "pub/media/catalog/category",
"images-file-directory" : "var/importexport/media/catalog/category"
},
"observers": [
{
Expand Down
20 changes: 10 additions & 10 deletions src/Subjects/BunchSubject.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,20 @@ public function setUp($serial)

// initialize media directory => can be absolute or relative
if ($this->getConfiguration()->hasParam(ConfigurationKeys::MEDIA_DIRECTORY)) {
$this->setMediaDir(
$this->resolvePath(
$this->getConfiguration()->getParam(ConfigurationKeys::MEDIA_DIRECTORY)
)
);
try {
$this->setMediaDir($this->resolvePath($this->getConfiguration()->getParam(ConfigurationKeys::MEDIA_DIRECTORY)));
} catch (\InvalidArgumentException $iae) {
$this->getSystemLogger()->warning($iae);
}
}

// initialize images directory => can be absolute or relative
if ($this->getConfiguration()->hasParam(ConfigurationKeys::IMAGES_FILE_DIRECTORY)) {
$this->setImagesFileDir(
$this->resolvePath(
$this->getConfiguration()->getParam(ConfigurationKeys::IMAGES_FILE_DIRECTORY)
)
);
try {
$this->setImagesFileDir($this->resolvePath($this->getConfiguration()->getParam(ConfigurationKeys::IMAGES_FILE_DIRECTORY)));
} catch (\InvalidArgumentException $iae) {
$this->getSystemLogger()->warning($iae);
}
}

// prepare the callbacks
Expand Down

0 comments on commit bfb80a6

Please sign in to comment.