Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento 1.8.1:使用符号链接时出现媒体目录错误_Magento_Wysiwyg_Magento 1.8 - Fatal编程技术网

Magento 1.8.1:使用符号链接时出现媒体目录错误

Magento 1.8.1:使用符号链接时出现媒体目录错误,magento,wysiwyg,magento-1.8,Magento,Wysiwyg,Magento 1.8,我的Magento安装有问题,在CMS中,当我使用wysiwig编辑器插入图像时,文件夹会不断重复打开 文件夹结构应为: - infortis - brands - fortis - ultimo 但我得到的是: -infortis -infortis -infortis -infortis -infortis 这只是不断重复 Magento版本1.8.1。感谢您的帮助。在Mage\u C

我的Magento安装有问题,在CMS中,当我使用wysiwig编辑器插入图像时,文件夹会不断重复打开

文件夹结构应为:

- infortis
    - brands
    - fortis
    - ultimo
但我得到的是:

-infortis
    -infortis
        -infortis
            -infortis
                -infortis
这只是不断重复


Magento版本1.8.1。感谢您的帮助。

Mage\u Cms\u Helper\u Wysiwyg\u Images::convertIdToPath中找到了问题

核心代码如下

public function convertIdToPath($id)
{
    $path = $this->idDecode($id);
    if (!strstr($path, $this->getStorageRoot())) {
        $path = $this->getStorageRoot() . $path;
    }
    return $path;
}
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;
}
修复方法是在获取存储根目录时使用realpath,如下所示

public function convertIdToPath($id)
{
    $path = $this->idDecode($id);
    if (!strstr($path, $this->getStorageRoot())) {
        $path = $this->getStorageRoot() . $path;
    }
    return $path;
}
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;
}

因此,我们所做的是重写
Mage\u Cms\u Helper\u Wysiwyg\u图像
,并使用更新的converIdToPath函数。我找到了原始的解决方案,但如果您有一个没有链接的开发系统和另一个有链接的系统,则该解决方案将中断。

我发现,以下编辑使其按预期工作,并且也可用于非符号链接(dev)资源:

在与提到的Mage\u Cms\u Helper\u Wysiwyg\u图像相同的类中,应用以下修补程序:

# 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;
     }
#此修补程序文件由NetBeans IDE生成
#它使用平台无关的UTF-8编码和换行符。
---Images.php(今天下午4:14:50)
+++当前文件
@@ -223,7 +223,7 @@
公共函数getCurrentUrl()
{
如果(!$this->\u 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)。“/”;
#此修补程序文件由NetBeans IDE生成
#它使用平台无关的UTF-8编码和换行符。
---Images.php(f47f0ff)
+++当前文件
@@ -68,7 +68,7 @@
*/
公共函数getStorageRoot()
{
-返回Mage::getConfig()->getOptions()->getMediaDir().DS.Mage\u Cms\u Model\u Wysiwyg\u Config::IMAGE\u目录
+返回realpath(Mage::getConfig()->getOptions()->getMediaDir()).DS.Mage\u Cms\u Model\u Wysiwyg\u Config::IMAGE\u目录
.DS;
}

我们最近也遇到了这个问题,我想分享更多的信息,以节省下一个人的时间。如果您正在运行Magento Enterprise Edition,并且有一个有效的支持协议,则有一个官方补丁可用。只需打开一个支持票证并直接请求补丁。补丁名称为“补丁_SUPEE-2662_EE_1.13.1.0_v1".

只是为了验证一下,您是否为编辑器或媒体浏览器使用了任何第三方扩展或插件?这种情况是否也发生在其他PC/浏览器上?媒体/wysiwyg
目录中的目录结构是否正确?最后一点:打开编辑器或图像上载程序时是否出现任何javascript错误?非常抱歉stions,只是想更好地了解这个问题:)@sandermangel我可以确认这是一个问题,我们也有同样的问题:(似乎
Mage_Cms_Helper_Wysiwyg_Images
没有很好地处理EE 1.13.1.0I上确认的LinksName问题我为此提出了一个错误:这似乎破坏了Wysiwyg编辑器中图像弹出窗口的缩略图。它无法放置“Wysiwyg”在url中,它看起来是这样的:
https://blabla.com/media//.thumbs/img.png?rand=1399016538 
将在我获得chance@Erfan我已经把这个补丁捆绑在一个迷你模块中,如果有人觉得它有用的话:谢谢@SteveRobbins,你的插件成功了!谢谢分享!