My Magento Extension Install Script Will Not Run

My Magento Extension Install Script Will Not Run

Work your way through this article to make sure you don't have any misunderstanding of what the setup resources do, how they work, and how you can troubleshoot them.

Once you've done that, from everything you've said on this question thread it sounds like you're getting your resource "installed", but that your install script never runs. My guess is that the version number you used in

//0.0.1 is your version number
mysql4-install-0.0.1.php

didn't match up with the version of your module

<modules>
<Nie_Nie>
<version>?.?.?</version>
</Nie_Nie>
</modules>

Those should match for the script to run. I think Magento is smart enough to run previous versions if it finds them, but the code in the setup resources is the kind that's hard to follow, so I always make sure they match.

Regardless, here's how you can see which file(s) magento is trying to run when it runs your setup resource. Delete any entries from core_resource related to your module. Clear your cache. Then find the following locations in the setup class

app/code/core/Mage/Core/Model/Resource/Setup.php:

protected function _modifyResourceDb($actionType, $fromVersion, $toVersion)
{
...

$sqlFilesDir = Mage::getModuleDir('sql', $modName).DS.$this->_resourceName;

if (!is_dir($sqlFilesDir) || !is_readable($sqlFilesDir)) {
return false;
}

...

$sqlDir->close();

if (empty($arrAvailableFiles)) {
return false;
}

...

$arrModifyFiles = $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrAvailableFiles);
if (empty($arrModifyFiles)) {
return false;
}

and then modify them to add some temporary debugging exceptions

    if (!is_dir($sqlFilesDir) || !is_readable($sqlFilesDir)) {
throw new Exception("$sqlFilesDir not found");
return false;
}

...

if (empty($arrAvailableFiles)) {
throw new Exception("No files found to run");
return false;
}

...

$arrModifyFiles = $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrAvailableFiles);
if (empty($arrModifyFiles)) {
throw new Exception("No valid upgrade files found to run for ");
return false;
}

throw new Exception("If you're getting here, we have a file. Remove your exceptions here and place one in your installer to make sure it's the one you think it is.");

Reload the page and you'll get exception text complaining about whatever Magento can't find. That should be enough to help you track down which installer script Magento is trying to run, but failing to find. Just remember to delete your module's row in core_resource and to clear your cache. (Magento caches which modules need to check for an install/upgrade)

If that doesn't work, start digging into the logic of applyAllDataUpdates and figure out why the class isn't including your installer file.

Magento 1.9 install script not running

Solved. The problem was because I didn't have file with class:

Anglingdirect_Jobadverts_Model_Mysql4_Setup

Now it's fine. I removed this extension files from project folder and returned them back. Install script then has run.

Cheers

Magento - Install script not running (but record add to core_resource correctly)

Based on the fact that your module's config XML is being merged in (hence the record in core_resource), and assuming that the XML in your post is a copy of that content, there are three possibilities:

  1. Filesystem hierarchy: you have a typo in your filename, folders, or incorrect folder structure
  2. Permissions: PHP cannot include() the contents of your file
  3. There is duplicate config.xml which specifies a different subdirectory, and this file is actually not being merged.

Solutions:

  1. Look, look, look
  2. Check permissions, test the script directly
  3. grep, break the config XML in the file in which you are working, and/or dump the config XML for the xpaths in question:

    echo Mage::getConfig()->getNode('modules/Sulman_Custompermissions/version');
    echo Mage::getConfig()->getNode('global/resources/mymodule_setup/setup/module');

magento .. can't run install script

In your etc/modules make the module name capital i.e.

<config>
<modules>
<Mdg_Gift>
<active>true</active>
<codePool>local</codePool>
</Mdg_Gift>
</modules>
</config>

Magento. Install script will not run, much less create customer attributes

There is a chance that your install script doesn't run because of its setup resource name (customer_setup). Since core extension Mage_Customer has the same name of setup resource and it is already installed in core_resource table with version 1.6.2.0 or something like that, your install script with version 0.1.0 may be considered as too old and is being ignored. So you can try renaming your resource to something unique.

Magento won't run my install script

So I figured it out. I am not sure if this is a version thing, but for thoroughness I am using magento 1.13.

Here is my issue:

<blizzardlabs_customer_setup>
</blizzardlabs_customer_setup>

Needed to be:

  <blizzardlabscustomer_setup>  
</blizzardlabscustomer_setup>

I of course had to edit my folder to match this. So the new path is /BlizzardLabs/Customer/sql/blizzardlabscustomer_setup/<file_name>.

Also, for posterity sake, using "customer_setup" would not work because this would clash with the Magento base class and not run the install script.

I am not sure if this is a magento version issue or something old but you can't have any underscores before _setup. Thanks!

Magento Module DB Setup Script not running

In Magento module entry stored in code field like below:
yourmodulename_setup

Check for record like check_setup in code field of core_resource table.

So for run install script again you have to find module record in module and remove that record.
It will automatically run the script again.



Related Topics



Leave a reply



Submit