File tree Expand file tree Collapse file tree 3 files changed +29
-3
lines changed
app/code/Magento/MediaGallery/Model Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 13
13
14
14
/**
15
15
* Media Gallery Asset
16
- * @SuppressWarnings(PHPMD.ExcessiveParameterList
16
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
17
17
*/
18
18
class Asset implements AssetInterface
19
19
{
Original file line number Diff line number Diff line change 10
10
use Magento \Cms \Model \Wysiwyg \Images \Storage ;
11
11
use Magento \Framework \Exception \CouldNotSaveException ;
12
12
use Magento \MediaGalleryApi \Api \CreateDirectoriesByPathsInterface ;
13
+ use Magento \MediaGalleryApi \Api \IsPathBlacklistedInterface ;
13
14
use Psr \Log \LoggerInterface ;
14
15
15
16
/**
@@ -27,16 +28,24 @@ class CreateByPaths implements CreateDirectoriesByPathsInterface
27
28
*/
28
29
private $ storage ;
29
30
31
+ /**
32
+ * @var IsPathBlacklistedInterface
33
+ */
34
+ private $ isPathBlacklisted ;
35
+
30
36
/**
31
37
* @param LoggerInterface $logger
32
38
* @param Storage $storage
39
+ * @param IsPathBlacklistedInterface $isPathBlacklisted
33
40
*/
34
41
public function __construct (
35
42
LoggerInterface $ logger ,
36
- Storage $ storage
43
+ Storage $ storage ,
44
+ IsPathBlacklistedInterface $ isPathBlacklisted
37
45
) {
38
46
$ this ->logger = $ logger ;
39
47
$ this ->storage = $ storage ;
48
+ $ this ->isPathBlacklisted = $ isPathBlacklisted ;
40
49
}
41
50
42
51
/**
@@ -46,6 +55,10 @@ public function execute(array $paths): void
46
55
{
47
56
$ failedPaths = [];
48
57
foreach ($ paths as $ path ) {
58
+ if ($ this ->isPathBlacklisted ->execute ($ path )) {
59
+ $ failedPaths [] = $ path ;
60
+ continue ;
61
+ }
49
62
try {
50
63
//phpcs:ignore Magento2.Functions.DiscouragedFunction
51
64
$ name = basename ($ path );
Original file line number Diff line number Diff line change 10
10
use Magento \Cms \Model \Wysiwyg \Images \Storage ;
11
11
use Magento \Framework \Exception \CouldNotDeleteException ;
12
12
use Magento \MediaGalleryApi \Api \DeleteDirectoriesByPathsInterface ;
13
+ use Magento \MediaGalleryApi \Api \IsPathBlacklistedInterface ;
13
14
use Psr \Log \LoggerInterface ;
14
15
15
16
/**
@@ -27,16 +28,24 @@ class DeleteByPaths implements DeleteDirectoriesByPathsInterface
27
28
*/
28
29
private $ storage ;
29
30
31
+ /**
32
+ * @var IsPathBlacklistedInterface
33
+ */
34
+ private $ isPathBlacklisted ;
35
+
30
36
/**
31
37
* @param LoggerInterface $logger
32
38
* @param Storage $storage
39
+ * @param IsPathBlacklistedInterface $isPathBlacklisted
33
40
*/
34
41
public function __construct (
35
42
LoggerInterface $ logger ,
36
- Storage $ storage
43
+ Storage $ storage ,
44
+ IsPathBlacklistedInterface $ isPathBlacklisted
37
45
) {
38
46
$ this ->logger = $ logger ;
39
47
$ this ->storage = $ storage ;
48
+ $ this ->isPathBlacklisted = $ isPathBlacklisted ;
40
49
}
41
50
42
51
/**
@@ -46,6 +55,10 @@ public function execute(array $paths): void
46
55
{
47
56
$ failedPaths = [];
48
57
foreach ($ paths as $ path ) {
58
+ if ($ this ->isPathBlacklisted ->execute ($ path )) {
59
+ $ failedPaths [] = $ path ;
60
+ continue ;
61
+ }
49
62
try {
50
63
$ this ->storage ->deleteDirectory ($ this ->storage ->getCmsWysiwygImages ()->getStorageRoot () . $ path );
51
64
} catch (\Exception $ exception ) {
You can’t perform that action at this time.
0 commit comments