I am trying to create an install file but Magento is not running that file, although it is putting an entry in to the core_resource table.
I have deleted the row which was created and loaded the page again. The row was re-created but the install file was not called (There is only and echo statement and die statement in that file to check if its working).
Trying to solve this problem I found this question on stackoverflow and have followed the advice, but I cant seem to get a result. When I break the config, I get a 404 page, I have changed the file permission so there is no problem there. Finally I have loaded the config, in there I have found Ps_Prefs_Model_Mysql4_Setupcore_setupcore_writecore_read
, so Magento is doing something with my file, but I cannot tell what from this.
I'm hoping that it is a simple casing issue (which I cannot see, so below is my files and my config)
I also tried renaming the install file mysql4-install-0.1.0.php, that had no effect
<config>
<modules>
<Ps_Prefs>
<version>0.1.0</version>
</Ps_Prefs>
</modules>
<global>
<models>
........
</models>
<resources>
<prefs_setup>
<setup>
<module>Ps_Prefs</module>
<class>Ps_Prefs_Model_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</prefs_setup>
<prefs_write>
<connection>
<use>core_write</use>
</connection>
</prefs_write>
<prefs_read>
<connection>
<use>core_read</use>
</connection>
</prefs_read>
</resources>
............
</global>
In log/system.log I get this message
2013-10-01T09:36:13+00:00 ERR (3): Warning: simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: Entity: line 8: parser error : Start tag expected, '<' not found in /Users/tsimps/Sites/magentoDevTest/lib/Varien/Simplexml/Config.php on line 510
2013-10-01T09:36:13+00:00 ERR (3): Warning: simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: </config>--> in /Users/tsimps/Sites/magentoDevTest/lib/Varien/Simplexml/Config.php on line 510
2013-10-01T09:36:13+00:00 ERR (3): Warning: simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: ^ in /Users/tsimps/Sites/magentoDevTest/lib/Varien/Simplexml/Config.php on line 510
2013-10-01T09:36:14+00:00 DEBUG (7): HEADERS ALREADY SENT: <pre>[0] /Users/tsimps/Sites/magentoDevTest/app/code/core/Mage/Core/Controller/Response/Http.php:52
[1] /Users/tsimps/Sites/magentoDevTest/lib/Zend/Controller/Response/Abstract.php:766
[2] /Users/tsimps/Sites/magentoDevTest/app/code/core/Mage/Core/Controller/Response/Http.php:83
[3] /Users/tsimps/Sites/magentoDevTest/app/code/core/Mage/Core/Controller/Varien/Front.php:188
[4] /Users/tsimps/Sites/magentoDevTest/app/code/core/Mage/Core/Model/App.php:354
[5] /Users/tsimps/Sites/magentoDevTest/app/Mage.php:683
[6] /Users/tsimps/Sites/magentoDevTest/index.php:87
</pre>
Cache is disabled and has been cleared (just incase)
I am using version 1.7.0.2
Best Answer
The row is created when you have an entry inside of your
config.xml
. If no setup file exists (or it is in the wrong place) magento just creates the row in thecore_resource
table and doesn't call any script.This is a problem if you later add a install-script, which is never called, because the entry already exists.
So first write an install script, then add the setup to the
config.xml
and later add upgrade-scripts if needed,