Magento 1.8.1: error in the media directory when using a symbolic link

I am having problems installing Magento, in CMS, when I go to paste the image with the wysiwig editor, the folder continues to open again.

The folder structure should be:

- infortis - brands - fortis - ultimo 

But I get:

 -infortis -infortis -infortis -infortis -infortis 

And it just repeats itself.

Magento Version 1.8.1. Any help was appreciated.

+7
wysiwyg magento
source share
3 answers

I found that the following changes make the work work as expected, and also work with asymmetric (dev) resources:

In the same class as mentiond Mage_Cms_Helper_Wysiwyg_Images , apply these fixes:

 # This patch file was generated by NetBeans IDE # It uses platform neutral UTF-8 encoding and \n newlines. --- <html>Images.php (<b>Today 4:14:50 PM</b>)</html> +++ <html><b>Current File</b></html> @@ -223,7 +223,7 @@ public function getCurrentUrl() { if (!$this->_currentUrl) { - $path = str_replace(Mage::getConfig()->getOptions()->getMediaDir(), '', $this->getCurrentPath()); + $path = str_replace(realpath(Mage::getConfig()->getOptions()->getMediaDir()), '', $this->getCurrentPath()); $path = trim($path, DS); $this->_currentUrl = Mage::app()->getStore($this->_storeId)->getBaseUrl('media') . $this->convertPathToUrl($path) . '/'; # This patch file was generated by NetBeans IDE # It uses platform neutral UTF-8 encoding and \n newlines. --- <html>Images.php (<b>f47f0ff</b>)</html> +++ <html><b>Current File</b></html> @@ -68,7 +68,7 @@ */ public function getStorageRoot() { - return Mage::getConfig()->getOptions()->getMediaDir() . DS . Mage_Cms_Model_Wysiwyg_Config::IMAGE_DIRECTORY + return realpath(Mage::getConfig()->getOptions()->getMediaDir()) . DS . Mage_Cms_Model_Wysiwyg_Config::IMAGE_DIRECTORY . DS; } 
+11
source share

Problem detected in Mage_Cms_Helper_Wysiwyg_Images::convertIdToPath

The kernel code is as follows.

 public function convertIdToPath($id) { $path = $this->idDecode($id); if (!strstr($path, $this->getStorageRoot())) { $path = $this->getStorageRoot() . $path; } return $path; } 

And the fix is ​​to use realpath when getting the storage root as follows.

 public function convertIdToPath($id) { $path = $this->idDecode($id); $realpath = $this->getStorageRoot(); if (is_link(rtrim($realpath,'/'))) { $realpath = realpath($realpath); } if (!strstr($path, $realpath)) { $path = $realpath . $path; } return $path; } 

So, we did rewrite Mage_Cms_Helper_Wysiwyg_Images and use the updated convertIdToPath function. I found the original solution on a German site , but it will break if you say that you have a dev system without links and another system with a link.

+2
source share

We recently ran into this problem, and I wanted to share a bit more information to save the next person for a while. If you are using Magento Enterprise Edition and have a valid support agreement, there is an official patch. Just open a support request and request a fix directly. The patch name is "PATCH_SUPEE-2662_EE_1.13.1.0_v1".

0
source share

All Articles