Skip to content

Commit 18c31fa

Browse files
author
Igor Miniailo
committed
Merge branch 'PR4' into product-video-PR4
2 parents 3aa4a2f + 6422389 commit 18c31fa

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
@@ -72,12 +72,13 @@ public function __construct(
7272
*/
7373
public function execute()
7474
{
75+
$baseTmpMediaPath = $this->mediaConfig->getBaseTmpMediaPath();
7576
try {
7677
$remoteFileUrl = $this->getRequest()->getParam('remote_image');
77-
$originalFileName = $this->parseOriginalFileName($remoteFileUrl);
78-
$localFileName = $this->localFileName($originalFileName);
79-
$localTmpFileName = $this->generateTmpFileName($localFileName);
80-
$localFileMediaPath = $this->appendFileSystemPath($localTmpFileName);
78+
$originalFileName = basename($remoteFileUrl);
79+
$localFileName = Uploader::getCorrectFileName($originalFileName);
80+
$localTmpFileName = Uploader::getDispretionPath($localFileName) . DIRECTORY_SEPARATOR . $localFileName;
81+
$localFileMediaPath = $baseTmpMediaPath . ($localTmpFileName);
8182
$localUniqueFileMediaPath = $this->appendNewFileName($localFileMediaPath);
8283
$this->retrieveRemoteImage($remoteFileUrl, $localUniqueFileMediaPath);
8384
$localFileFullPath = $this->appendAbsoluteFileSystemPath($localUniqueFileMediaPath);
@@ -101,7 +102,7 @@ public function execute()
101102
protected function appendResultSaveRemoteImage($fileName)
102103
{
103104
$fileInfo = pathinfo($fileName);
104-
$tmpFileName = $this->generateTmpFileName($fileInfo['basename']);
105+
$tmpFileName = Uploader::getDispretionPath($fileInfo['basename']) . DIRECTORY_SEPARATOR . $fileInfo['basename'];
105106
$result['name'] = $fileInfo['basename'];
106107
$result['type'] = $this->imageAdapter->getMimeType();
107108
$result['error'] = 0;
@@ -111,16 +112,6 @@ protected function appendResultSaveRemoteImage($fileName)
111112
return $result;
112113
}
113114

114-
/**
115-
* @param string $fileName
116-
* @return string
117-
*/
118-
protected function localFileName($fileName)
119-
{
120-
$fileName = Uploader::getCorrectFileName($fileName);
121-
return $fileName;
122-
}
123-
124115
/**
125116
* @param string $fileUrl
126117
* @param string $localFilePath
@@ -152,43 +143,6 @@ protected function appendNewFileName($localFilePath)
152143
return $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileName;
153144
}
154145

155-
/**
156-
* @param string $fileUrl
157-
* @return string
158-
*/
159-
protected function parseOriginalFileName($fileUrl)
160-
{
161-
return basename($fileUrl);
162-
}
163-
164-
/**
165-
* @param string $fileName
166-
* @return string
167-
*/
168-
protected function generateTmpFileName($fileName)
169-
{
170-
return Uploader::getDispretionPath($fileName) . DIRECTORY_SEPARATOR . $fileName;
171-
}
172-
173-
/**
174-
* @param string $fileName
175-
* @return string
176-
*/
177-
protected function generateFileNameWithPath($fileName)
178-
{
179-
return Uploader::getDispretionPath($fileName) . DIRECTORY_SEPARATOR . $fileName;
180-
}
181-
182-
/**
183-
* @param string $localTmpFile
184-
* @return string
185-
*/
186-
protected function appendFileSystemPath($localTmpFile)
187-
{
188-
$pathToSave = $this->mediaConfig->getBaseTmpMediaPath();
189-
return $pathToSave . $localTmpFile;
190-
}
191-
192146
/**
193147
* @param string $localTmpFile
194148
* @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)