[英]Magento not executing my module install script
我正在嘗試創建本地模塊。 關於此,這里有很多問題。 我幾乎全部都跟隨了。 但是它永遠都行不通。
最后,我遵循了這一點: http : //devdocs.magento.com/guides/m1x/magefordev/mage-for-dev-6.html
但是,這也不起作用。 這是我的結構:
應用程序/代碼/本地/ Mycompany /您好/模型/資源/Setup.php
<?php
class Mycompany_Hello_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
}
在app / code / local / Mycompany / Hello / sql / mycompany_hello_setup / install-0.1.0.php中
<?php
echo 'Running This test: '.get_class($this)."\n <br /> \n";
die("Exit for now");
應用程序/代碼/本地/Mycompany/Hello/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Hello>
<version>0.1.0</version>
</Mycompany_Hello>
</modules>
<frontend>
<routers>
<hello>
<use>standard</use>
<args>
<module>Mycompany_Hello</module>
<frontName>hello</frontName>
</args>
</hello>
</routers>
</frontend>
<global>
<resources>
<Mycompany_Hello_setup>
<setup>
<module>Mycompany_Hello</module>
<class>Mycompany_Hello_Model_Resource_Setup</class>
</setup>
</Mycomapny_Hello_setup>
</resources>
</global>
在這里,我面臨的唯一問題是它從不執行安裝腳本。 到目前為止,我的處理方法是:
在每次嘗試app / code / local / Mycompany / Hello / sql / hello_setup / install-0.1.0.php時 , 將app / code / local / Mycompany / Hello / sql / mycompany_hello_setup / install-0.1.0.php重命名為以下名稱, app / code / local / Mycompany / Hello / sql / hello_setup / mysql4-install-0.1.0.php , app / code / local / Mycompany / Hello / sql / mycompany_hello_setup / install-0.1.0.php , app / code /本地/Mycompany/Hello/sql/Mycompany_hello_setup/mysql4-install-0.1.0.php
在每次嘗試期間,我都會刷新緩存並從core_resources表中刪除該條目。
我所有的文件許可為777(出於調試目的,以后我將其更改為755)。 實際上,我在安裝中放置了調試代碼。 一旦執行,我將用我的實際安裝腳本替換它。
但似乎有些東西,我缺少了一些東西,因此它無法正常工作。
請幫忙。 先感謝您。
在resources
標記中,第一級節點必須與sql /中的文件夾名稱匹配,並且區分大小寫。
所以它應該看起來像這樣:
<resources>
<mycompany_hello_setup>
<setup>
<module>Mycompany_Hello</module>
<class>Mycompany_Hello_Model_Resource_Setup</class>
</setup>
</mycompany_hello_setup>
</resources>
設置腳本位於app / code / local / Mycompany / Hello / sql / mycompany_hello_setup / install-0.1.0.php中
如果仍然無法使用,請檢查core_resource
表中是否沒有code
=“ mycompany_hello_setup”的條目(如果存在,請刪除該條目),並確保您已創建app / etc / modules / Mycompany_Hello.xml文件,內容:
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Hello>
<active>true</active>
<codePool>local</codePool>
</Mycompany_Hello>
</modules>
</config>
如果仍然不起作用,請檢查core_resource表中是否沒有條目,如果存在,則將其刪除:這可行。 由於該表已經有一個[module_name] _setup條目,因此我創建了一個名為[Namespace_name] _ [module_name] _setup的新文件夾,而不是刪除現有的文件夾,它就起作用了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.