1
votes

My installer script does not run.

/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");

When loading a page I don't see the test output.
There is no row in core_resource for this module.

No errors to see in /var/log

Why does this installer not run?

I added debug line in app/code/core/Mage/Core/Model/Resource/Setup.php
It doesn't get here in this function _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;
}
2
1) Verify that config cache is disabled or at least that it is being cleared. 2) Post your module's declaration file (located in app/etc/modules/). - benmarks
I have added my /app/etc/modules/Starmall_Salesorder.xml I have cache disabled and deleted to be sure the /var folder - August

2 Answers

1
votes

Assuming you have a module declaration file with a modules node matching your post, and that you are on a case-sensitive filesystem, then the application is not loading your module configuration file.

When Magento is initializing, the children nodes of <modules> are used along with the codePool values as part of the path to each module's configuration file. The node name (e.g. starmall_salesorder) is converted to the directory path Starmall/Salesorder (note the uppercasing). To resolve this, correct the node name for your module in both the declaration and configuration files to be Starmall_Salesorder and also change the value of global/resources/starmall_salesorder_setup/setup/module to match.

One further note: in Magento CE 1.6 and higher the model layer was reworked to be database-agnostic, so it is appropriate for new modules intended for 1.6+ to use install filenames such as install-1.0.php for backend-agnostic upgrade scripts.

0
votes

Today I have had some trouble with this as well. I had to clear the cache, even though it was disabled. So whenever updating/changing/running your installer script, make sure you first clear your cache manually.