php - Magento 设置资源 : Installer script not running

标签 php magento

我正在开发 Magento 版本。 1.11.2.0(企业版)。

我正在关注艾伦·斯托姆的帖子here .

我的模块config.xml:

<?xml version="1.0"?>
<config>
<modules>
    <Invent_Instance>
        <version>0.1</version>
    </Invent_Instance>
</modules>
<global>
    <models>
        <instance>
            <class>Invent_Instance_Model</class>
            <resourceModel>instance_mysql4</resourceModel>
        </instance>
        <instance_mysql4>
            <class>Invent_Instance_Model_Mysql4</class>
            <entities>
                <instance>
                    <table>instance</table>
                </instance>
            </entities>
        </instance_mysql4>
    </models>
    <resources>
        <instance_setup>
            <setup>
                <module>Invent_Instance</module>
                <class>Invent_Instance_Model_Resource_Mysql4_Setup</class>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </instance_setup>
        <instance_write>
            <connection>
                <use>core_write</use>
            </connection>
        </instance_write>
        <instance_read>
            <connection>
                <use>core_read</use>
            </connection>
        </instance_read>
    </resources>

...

Invent_Instance_Model_Resource_Mysql4_Setup 类似乎在我创建它之前被调用,但它给出了一个错误,说它不存在。

我的文件结构如下:

Module file structure

我的安装程序的内容是

echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";
die("Exit for now");

删除所有缓存后,我重新加载管理模块,它会在不提供输出的情况下加载,或者显然不运行此脚本。

有人可以告诉我我做错了什么吗?我仔细检查了模块版本号(0.1),但无法弄清楚为什么它没有运行。

我的模块模型设置有什么问题吗?感谢您的帮助!

最佳答案

看看上面的一切似乎都很好。

值得检查 core_resource 表并在“code”列中查找 instance_setup,如果“value”列中的值与 config.xml 中的版本号匹配,则脚本将不会运行。

您随时可以删除此行以再次运行安装脚本。

关于php - Magento 设置资源 : Installer script not running,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10996199/

相关文章:

php - 如何将项目添加到json文件格式的数组

php - Magento:找不到命名的 PHP session 模块(文件)

javascript - jQuery AJAX 问题 - 代码在加载时运行,然后什么都没有

javascript - Magento 1 - 通过布局更新 xml 代码将内联 javascript 添加到产品页面

magento - Magento无法创建贷项凭证

php - 使用ajax加载下拉值后,Yii2 kartik依赖的下拉列表未使用ajax更改所选值

php - 如何在我的 php 页面中应用反向 ajax 来重新加载我列出的项目?

php - Magento:获取 "disable module output"的值

php - 从 Magento 中提取翻译短语

页面上的 JavaScript 错误