Magento extension update using direct download of package file - file already exists

I created the module, exported the extension and the afterwords that I installed (in the new store) using direct download of the package file. The extension works as expected.

Now I have made several updates, exported the extension with a different release version number, but when I try to download the archive (in the same mode), I get an error message ( "CONNECT ERROR: package file is invalid [..] './app/code /local/Smart2Pay/Globalpay/Block/Form/Pay.php already exists )

I read that I can modify the file downloader \ lib \ Mage \ Connect \ Validator.php ( here ) to allow file rewriting, but I want to know if there is another solution related to best practice. I need this extension update to work for all magento users.

+4
source share
1 answer

Tim says the right way to install a newer version of the Magento extension package is to first run the uninstall option in MagentoConnect Manager to remove the old extension, and then run the installation to install from the newer package file.

Unfortunately, this is the (bad) design of the MagentoConnect package manager function.

It is also worth explaining what happens to any database changes that the extension / package makes. Magento modules do not have the ability to specify removal scripts or instructions. This means that after deleting the source module / package, any database changes are still present and NOT deleted. When the new version of the module is reinstalled, this should run the DB module update scripts, and not "install scripts".

So, a detailed breakdown of what happens is as follows:

  • When the module is initially installed from the package, the latest installation script module is launched, which corresponds to the module version in the config.xml file, making the necessary changes to the database.

  • When the module is not configured from the MagentoConnect manager, the database remains as it is, so all changes to the module are still present in the database.

  • When a newer version of the module is installed, the Magento database core_resource table tells the installer which version of the module was previously installed. The numbers of the previous version and the new version are used to find the applicable script database update in the module code. If the corresponding script update is located, it will be launched.

+4
source

Source: https://habr.com/ru/post/1447066/


All Articles