我的安装程序脚本无法运行。
/app/etc/modules/Starmall_Salesorder.xml
<?xml version="1.0"?>
<config>
<modules>
<Starmall_Salesorder>
<active>true</active>
<version>0.1.0</version>
<codePool>local</codePool>
</Starmall_Salesorder>
</modules>
的Config.xml
<modules>
<Starmall_Salesorder>
<version>0.1.0</version>
</Starmall_Salesorder>
</modules>
...
<resources>
<starmall_salesorder_setup>
<setup>
<module>Starmall_Salesorder</module>
</setup>
</starmall_salesorder_setup>
</resources>
...
/app/code/local/Starmall/Salesorder/sql/starmall_salesorder_setup/mysql4-install-0.1.0.php:
<?php echo 'Running installer: '.get_class($this)."\n <br /> \n";
die("Exit for now");
加载页面时,我看不到测试输出
此模块的core_resource
中没有行。
在/ var / log
中没有错误为什么这个安装程序没有运行?
我在app/code/core/Mage/Core/Model/Resource/Setup.php
中添加了调试行
它不会出现在此函数_installResourceDb($newVersion)
protected function _installResourceDb($newVersion)
{
Mage::log("this line is not added to log file");
$oldVersion = $this->_modifyResourceDb(self::TYPE_DB_INSTALL, '', $newVersion);
$this->_modifyResourceDb(self::TYPE_DB_UPGRADE, $oldVersion, $newVersion);
$this->_getResource()->setDbVersion($this->_resourceName, $newVersion);
return $this;
}
答案 0 :(得分:1)
假设您有一个模块声明文件,其中modules
节点与您的帖子匹配,并且您位于区分大小写的文件系统上,则应用程序不会加载您的模块配置文件。
当Magento正在初始化时,<modules>
的子节点与codePool
值一起使用,作为每个模块配置文件路径的一部分。节点名称(例如starmall_salesorder
)将转换为目录路径 Starmall / Salesorder (请注意大写字母)。要解决此问题,请在声明和配置文件中将模块的节点名称更正为Starmall_Salesorder
,并将global/resources/starmall_salesorder_setup/setup/module
的值更改为匹配。
进一步说明:在Magento CE 1.6及更高版本中,模型层被重新设计为与数据库无关,因此适用于1.6+的新模块使用安装文件名,例如 install-1.0.php < / em>用于后端不可知的升级脚本。
答案 1 :(得分:0)
今天我也遇到了一些麻烦。我必须清除缓存,即使它已被禁用。因此,每当更新/更改/运行安装程序脚本时,请确保首先手动清除缓存。