栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

我的Magento扩展安装脚本无法运行

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

我的Magento扩展安装脚本无法运行

在本文中逐步进行操作,以确保您对设置资源的功能,它们如何工作以及如何对它们进行故障排除没有任何误解。

完成此操作后,从您在此问题线程上说的所有内容看来,您似乎正在“安装”资源,但是安装脚本永远不会运行。我的猜测是您使用的版本号

//0.0.1 is your version numbermysql4-install-0.0.1.php

与您的模块版本不匹配

<modules>    <Nie_Nie>        <version>?.?.?</version>    </Nie_Nie></modules>

那些应该匹配才能运行脚本。我 认为 Magento可以找到以前的版本,足够聪明地运行它们,但是设置资源中的代码很难遵循,因此我始终确保它们匹配。

无论如何,这是当您运行设置资源时如何查看magento尝试运行的文件的方式。删除

core_resource
与模块相关的所有条目。清除缓存。然后在安装程序类中找到以下位置

app / pre / core / Mage / Core / Model / Resource / Setup.php

protected function _modifyResourceDb($actionType, $fromVersion, $toVersion){    ...    $sqlFilesDir = Mage::getModuleDir('sql', $modName).DS.$this->_resourceName;    if (!is_dir($sqlFilesDir) || !is_readable($sqlFilesDir)) {        return false;    }    ...    $sqlDir->close();    if (empty($arrAvailableFiles)) {        return false;    }    ...    $arrModifyFiles = $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrAvailableFiles);    if (empty($arrModifyFiles)) {        return false;    }

然后修改它们以添加一些临时调试异常

    if (!is_dir($sqlFilesDir) || !is_readable($sqlFilesDir)) {        throw new Exception("$sqlFilesDir not found");        return false;    }    ...    if (empty($arrAvailableFiles)) {        throw new Exception("No files found to run");        return false;    }    ...    $arrModifyFiles = $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrAvailableFiles);    if (empty($arrModifyFiles)) {        throw new Exception("No valid upgrade files found to run for ");        return false;    }    throw new Exception("If you're getting here, we have a file.  Remove your exceptions here and place one in your installer to make sure it's the one you think it is.");

重新加载页面,您会收到异常文本,抱怨Magento找不到任何内容。这应该足以帮助您跟踪Magento尝试运行的安装程序脚本,但是找不到。只要记住要删除模块中的行

core_resource
并清除缓存即可。(Magento缓存需要检查安装/升级的模块)

如果那不起作用,请开始研究的逻辑

applyAllDataUpdates
并弄清楚为什么该类不包括您的安装程序文件。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/468804.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号