Skip to content

Commit 11f2dd8

Browse files
committed
Merge branch 'master3' of git.epam.com:magn-vid into master3
2 parents 09c5525 + 6422389 commit 11f2dd8

File tree

5 files changed

+15
-65
lines changed

5 files changed

+15
-65
lines changed

app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ public function __construct(
7575
*/
7676
public function execute()
7777
{
78+
$baseTmpMediaPath = $this->mediaConfig->getBaseTmpMediaPath();
7879
try {
7980
$remoteFileUrl = $this->getRequest()->getParam('remote_image');
80-
$originalFileName = $this->parseOriginalFileName($remoteFileUrl);
81-
$localFileName = $this->localFileName($originalFileName);
82-
$localTmpFileName = $this->generateTmpFileName($localFileName);
83-
$localFileMediaPath = $this->appendFileSystemPath($localTmpFileName);
81+
$originalFileName = basename($remoteFileUrl);
82+
$localFileName = Uploader::getCorrectFileName($originalFileName);
83+
$localTmpFileName = Uploader::getDispretionPath($localFileName) . DIRECTORY_SEPARATOR . $localFileName;
84+
$localFileMediaPath = $baseTmpMediaPath . ($localTmpFileName);
8485
$localUniqueFileMediaPath = $this->appendNewFileName($localFileMediaPath);
8586
$this->retrieveRemoteImage($remoteFileUrl, $localUniqueFileMediaPath);
8687
$localFileFullPath = $this->appendAbsoluteFileSystemPath($localUniqueFileMediaPath);
@@ -104,7 +105,7 @@ public function execute()
104105
protected function appendResultSaveRemoteImage($fileName)
105106
{
106107
$fileInfo = pathinfo($fileName);
107-
$tmpFileName = $this->generateTmpFileName($fileInfo['basename']);
108+
$tmpFileName = Uploader::getDispretionPath($fileInfo['basename']) . DIRECTORY_SEPARATOR . $fileInfo['basename'];
108109
$result['name'] = $fileInfo['basename'];
109110
$result['type'] = $this->imageAdapter->getMimeType();
110111
$result['error'] = 0;
@@ -114,16 +115,6 @@ protected function appendResultSaveRemoteImage($fileName)
114115
return $result;
115116
}
116117

117-
/**
118-
* @param string $fileName
119-
* @return string
120-
*/
121-
protected function localFileName($fileName)
122-
{
123-
$fileName = Uploader::getCorrectFileName($fileName);
124-
return $fileName;
125-
}
126-
127118
/**
128119
* @param string $fileUrl
129120
* @param string $localFilePath
@@ -155,43 +146,6 @@ protected function appendNewFileName($localFilePath)
155146
return $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileName;
156147
}
157148

158-
/**
159-
* @param string $fileUrl
160-
* @return string
161-
*/
162-
protected function parseOriginalFileName($fileUrl)
163-
{
164-
return basename($fileUrl);
165-
}
166-
167-
/**
168-
* @param string $fileName
169-
* @return string
170-
*/
171-
protected function generateTmpFileName($fileName)
172-
{
173-
return Uploader::getDispretionPath($fileName) . DIRECTORY_SEPARATOR . $fileName;
174-
}
175-
176-
/**
177-
* @param string $fileName
178-
* @return string
179-
*/
180-
protected function generateFileNameWithPath($fileName)
181-
{
182-
return Uploader::getDispretionPath($fileName) . DIRECTORY_SEPARATOR . $fileName;
183-
}
184-
185-
/**
186-
* @param string $localTmpFile
187-
* @return string
188-
*/
189-
protected function appendFileSystemPath($localTmpFile)
190-
{
191-
$pathToSave = $this->mediaConfig->getBaseTmpMediaPath();
192-
return $pathToSave . $localTmpFile;
193-
}
194-
195149
/**
196150
* @param string $localTmpFile
197151
* @return string

app/code/Magento/ProductVideo/Setup/UpgradeData.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
5353
$attributeSetId,
5454
'Image Management'
5555
);
56-
if (isset($attributeGroup['attribute_group_name']) && $attributeGroup['attribute_group_name'] == 'Image Management') {
56+
if (isset($attributeGroup['attribute_group_name'])
57+
&& $attributeGroup['attribute_group_name'] == 'Image Management'
58+
) {
5759
// update General Group
5860
$categorySetup->updateAttributeGroup(
5961
$entityTypeId,

app/code/Magento/ProductVideo/view/adminhtml/web/js/new-video-dialog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ define([
467467
name: 'product[media_gallery][images][' + newImageId + '][save_data_from]'
468468
}).val(key);
469469

470-
oldNewFilePosition = parseInt(tmpOldImage.position);
470+
oldNewFilePosition = parseInt(tmpOldImage.position, 10);
471471
imageData.position = oldNewFilePosition;
472472

473473
$(this._imageWidgetSelector).trigger('setPosition', {

app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ define([
142142
dataUrl,
143143
tmpVideoData,
144144
tmpInputData,
145-
i,
146-
iPlace;
145+
i;
147146

148147
if (isJSON) {
149148
inputData = $.parseJSON(inputData);
@@ -172,14 +171,14 @@ define([
172171
tmpVideoData.id = dataUrl.id;
173172
tmpVideoData.provider = dataUrl.type;
174173
}
175-
iPlace = i + 1;
174+
176175
if (tmpVideoData.isBase) {
177176
videoData.unshift(tmpVideoData);
178-
continue;
177+
} else {
178+
videoData.push(tmpVideoData);
179179
}
180-
181-
videoData.push(tmpVideoData);
182180
}
181+
183182
return videoData;
184183
},
185184

lib/internal/Magento/Framework/Config/View.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ class View extends \Magento\Framework\Config\AbstractXml
2727
*/
2828
protected $xpath;
2929

30-
/**
31-
* @var Reader
32-
*/
33-
private $xsdReader;
34-
3530
/**
3631
* @param array $configFiles
3732
* @param UrnResolver $urnResolver

0 commit comments

Comments
 (0)