1
votes

I am trying to follow This tutorial, somewhat unsuccessfully!

I have got to the point where my script should display "Running This Upgrade: Myname_Weblog_Model_Resource_Setup Exit for now". This does not happen.

I believe it is something to do with my config file but looking though it I cannot work out what is wrong.

I have put a die statement into the setup.php file and that killed the script as expected. I then removed the die statement from setup.php and placed it into mysql4-install-0.1.0.php, this had no effect and the script continued on to render data from my controller.

I have added the code which I have been looking at to try and find the solution (as well as the full folder structure, hopefully its clear enough), could someone please advise me where the problem is or where else I should be looking to resolve this issue.

  • Myname
    • Weblog
      • Model
        • Resource
          • Blogpost
          • -Collection.php
        • -Blogpost.php
        • -Setup.php
      • -Blogpost.php
      • controllers
      • -IndexController.php
      • etc
      • -config.xml
      • sql
        • weblog_setup
        • -mysql4-install.0.1.0.php

Myname/Weblog/etc/config.xml

<config>
<modules>
    <Tonysimpson_Weblog>
        <version>0.1.0</version>
    </Tonysimpson_Weblog>
</modules> 

<global>

    <models>            
        <weblog><!--group name, matches the module name-->
            <class>Tonysimpson_Weblog_Model</class><!--Base name allmodels in the weblog group will have-->
            <resourceModel>weblog_resource</resourceModel><!--indicagtes which resource model should be used-->
        </weblog>

        <weblog_resource>
            <class>Tonysimpson_Weblog_Model_Resource</class>
            <entities>
                <blogpost>
                    <table>blog_posts</table>
                </blogpost>
            </entities>                          
        </weblog_resource>  
    </models>

    <resources>
        <weblog_setup>
            <setup>
                <module>Tonysimpson_Weblog</module>
                <class>Tonysimpson_Weblog_Model_Resource_Setup</class>
            </setup>
        </weblog_setup>
    </resources>

</global>

<frontend>
    <routers>
        <weblog>
            <use>standard</use>
            <args>
                <module>Tonysimpson_Weblog</module>
                <frontName>weblog</frontName>
            </args>
        </weblog>
    </routers>
</frontend>

MyName/Weblog/Model/Resource/Setup.php

class Tonysimpson_Weblog_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
{

}

Myname/Weblog/sql/weblog_setup/mysql4-install-0.1.0.php

echo 'running this upgrde: ' . get_class($this) . "\n <br /> \n";
die("exit for now");
2
dont put die()!, just look at the logs and post here the error. do you have all the requirements? - Elzo Valugi
Does the core_resource contain an entry for weblog_setup? If so, delete it and try again. - Jürgen Thelen
It did, I have deleted and the information is still rendering, my cache is disabled, so its not that either - tony09uk

2 Answers

2
votes

checkout forweblog_setup in core_resoruce table, if your resource(weblog_setup) is present in this table than your installer will not run, what you can do is make an backup of your core_resource and delete its entry for weblog_setup OR else you can try to write an upgrade script.

0
votes

You can try to delete setup class and see if there will be any error. So you will now then if config.xml is OK.

Also check in database the core_resoruce table or something like that. Maybe it's already installed and this is why it can't run again.

Also delete cache.

What server do you use ? ngnix or apache? Because I had a client that has the first one and there was some permission problem and because of that extensions didn't install.