From 9c5420fb378d2de46be4fdcd842e514e7206dfbc Mon Sep 17 00:00:00 2001 From: Pascal Brouwers Date: Fri, 1 Dec 2017 10:31:29 +0100 Subject: [PATCH 1/2] Issue 12506: Fixup typo getDispretionPath -> getDispersionPath --- app/code/Magento/Catalog/Model/Product/Gallery/Processor.php | 2 +- .../Catalog/Model/Product/Option/Type/File/ValidatorFile.php | 2 +- app/code/Magento/Customer/Model/FileProcessor.php | 2 +- .../Controller/Adminhtml/Product/Gallery/RetrieveImage.php | 4 ++-- lib/internal/Magento/Framework/File/Uploader.php | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php b/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php index 31e322f4e38f2..ac2a01f9c5a84 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php @@ -149,7 +149,7 @@ public function addImage( } $fileName = \Magento\MediaStorage\Model\File\Uploader::getCorrectFileName($pathinfo['basename']); - $dispretionPath = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName); + $dispretionPath = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName); $fileName = $dispretionPath . '/' . $fileName; $fileName = $this->getNotDuplicatedFilename($fileName, $dispretionPath); diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php index af6c4dba784f0..b54c66d75a058 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php @@ -150,7 +150,7 @@ public function validate($processingParams, $option) $extension = pathinfo(strtolower($fileInfo['name']), PATHINFO_EXTENSION); $fileName = \Magento\MediaStorage\Model\File\Uploader::getCorrectFileName($fileInfo['name']); - $dispersion = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName); + $dispersion = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName); $filePath = $dispersion; diff --git a/app/code/Magento/Customer/Model/FileProcessor.php b/app/code/Magento/Customer/Model/FileProcessor.php index 2d6917efdaf56..6a8472758c169 100644 --- a/app/code/Magento/Customer/Model/FileProcessor.php +++ b/app/code/Magento/Customer/Model/FileProcessor.php @@ -202,7 +202,7 @@ public function moveTemporaryFile($fileName) { $fileName = ltrim($fileName, '/'); - $dispersionPath = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName); + $dispersionPath = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName); $destinationPath = $this->entityTypeCode . $dispersionPath; if (!$this->mediaDirectory->create($destinationPath)) { diff --git a/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php b/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php index 3658e36a82ec3..9950526182e3e 100644 --- a/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php +++ b/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php @@ -110,7 +110,7 @@ public function execute() $remoteFileUrl = $this->getRequest()->getParam('remote_image'); $this->validateRemoteFile($remoteFileUrl); $localFileName = Uploader::getCorrectFileName(basename($remoteFileUrl)); - $localTmpFileName = Uploader::getDispretionPath($localFileName) . DIRECTORY_SEPARATOR . $localFileName; + $localTmpFileName = Uploader::getDispersionPath($localFileName) . DIRECTORY_SEPARATOR . $localFileName; $localFilePath = $baseTmpMediaPath . ($localTmpFileName); $localUniqFilePath = $this->appendNewFileName($localFilePath); $this->validateRemoteFileExtensions($localUniqFilePath); @@ -174,7 +174,7 @@ private function validateRemoteFileExtensions($filePath) protected function appendResultSaveRemoteImage($fileName) { $fileInfo = pathinfo($fileName); - $tmpFileName = Uploader::getDispretionPath($fileInfo['basename']) . DIRECTORY_SEPARATOR . $fileInfo['basename']; + $tmpFileName = Uploader::getDispersionPath($fileInfo['basename']) . DIRECTORY_SEPARATOR . $fileInfo['basename']; $result['name'] = $fileInfo['basename']; $result['type'] = $this->imageAdapter->getMimeType(); $result['error'] = 0; diff --git a/lib/internal/Magento/Framework/File/Uploader.php b/lib/internal/Magento/Framework/File/Uploader.php index c3316db7be016..e86277b905ba7 100644 --- a/lib/internal/Magento/Framework/File/Uploader.php +++ b/lib/internal/Magento/Framework/File/Uploader.php @@ -201,7 +201,7 @@ public function save($destinationFolder, $newFileName = null) if ($this->_enableFilesDispersion) { $fileName = $this->correctFileNameCase($fileName); $this->setAllowCreateFolders(true); - $this->_dispretionPath = self::getDispretionPath($fileName); + $this->_dispretionPath = self::getDispersionPath($fileName); $destinationFile .= $this->_dispretionPath; $this->_createDestinationFolder($destinationFile); } @@ -611,7 +611,7 @@ public static function getNewFileName($destinationFile) * @param string $fileName * @return string */ - public static function getDispretionPath($fileName) + public static function getDispersionPath($fileName) { $char = 0; $dispertionPath = ''; From daee4a8905ab50c6009f3baf304596644bc40d46 Mon Sep 17 00:00:00 2001 From: Pascal Brouwers Date: Fri, 1 Dec 2017 12:25:03 +0100 Subject: [PATCH 2/2] issue 12506: added PR changes --- lib/internal/Magento/Framework/File/Uploader.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/internal/Magento/Framework/File/Uploader.php b/lib/internal/Magento/Framework/File/Uploader.php index e86277b905ba7..07de9941271c3 100644 --- a/lib/internal/Magento/Framework/File/Uploader.php +++ b/lib/internal/Magento/Framework/File/Uploader.php @@ -605,6 +605,18 @@ public static function getNewFileName($destinationFile) return $destFileName; } + /** + * Get dispertion path + * + * @param string $fileName + * @return string + * @deprecated + */ + public static function getDispretionPath($fileName) + { + return self::getDispersionPath($fileName); + } + /** * Get dispertion path *