How to edit Magento Module Scripts?- Part 01

As a developer sometimes we need do some operations manually. Such as enabling Mage 2 module which includes Magento module install script. On the same note for disabling, we need the Magento module uninstall script. Today we’ll cover both of the scripts we need to enable or disable Mage 2 module.

However doing such jobs can be tricky and needs advanced understanding over Mage 2x scripts. Because a negligible mistake in the script can lead to crashes. In such cases, it is always advised to use some expert hands. So, if you’re up to hire developer, we suggest joining our network. As our Mage hosting plans comes with all development support. Also many other premium features such as Aspiration CDN, SSD cloud storage and so on. And all you need to spend $9.99 per month for enjoying our Mage basic plan.

Mehedi Hossain Chowdhury for Aspiration Hosting 

Magento module install script: Introduction

For enabling and upgrading any custom module, we need to run these following commands in shell:

php bin/magento module:enable Aspiration_Custom
php bin/magento setup:upgrade

Here note: the first command will add our Aspiration_Custom module in to the module list. Under the following path : app/etc/config.php .

Also it’ll keep crashing Mage 2 till we run the second command. As running the 1st code will only enable one new module. So, nothing will execute either.

Here the 2nd code will basically install the module. Generally it runs setup scripts for all Mage module whom needs setup. As we know that Mage needs to compare module versions in the list table to operate. So, in case the the module consist setup scripts only it’ll be executed. And also the current module will be saved in setup_module table. Similar to Mage 1 core_resource .

However for the 1st time installation, the upgrade and install operation will run only. Either if the module was installed earlier and after few days, the module version requires update. In such case, the upgrade script will run only.

Now reading Part 01 | Part 02 | Part 03