0

Let's say you are writing an improved reviews extension for Magento 2. Due to the vast differences to the core magento/module-review module, it makes sense to create an entirely new extension, while completely disabling the core module.

A requirement is that an admin, via the admin interface or command line, is not able to enable the core module again. It should be completely disabled while the custom module is enabled.

How might one do this via a module setup?

What I've tried/considered

  1. Simply disabling the core module. Although easy enough to do, it's unclear how to ensure enabling the module again is not possible.

  2. Magento 1 had a concept of setting arbitrary modules as active/inactive via config.xml in your custom extension -- however, I'm not seeing a means of doing this in Magento 2.

1

You could disable the module setting it to 0 in

app/etc/config.php

...
'Magento_RequireJs' => 1,
'Magento_Review' => 0, // done!
'Magento_Rss' => 1,
...

BTW you must know that all modules has dependencies so you must check which modules depends on Magento_Review.

You can get a list of dependencies executing:

// Shows number of dependencies on Magento framework
php bin/magento info:dependencies:show-framework

// Shows number of dependencies between modules
php bin/magento info:dependencies:show-modules

// Shows number of circular dependencies between modules
php bin/magento info:dependencies:show-modules-circular  

Each command export a file (in the folder were executed)

NOTE: if you perform a setup:uninstall/setup:install the config.php file will be destroyed and recreated with the new settings. So take in account that if you set/unset some module and/or set there some manual config like redis/memcached cache or session these commands will destroy all.

  • Very helpful learning information, thank you. Unfortunately misses the requirements: solution can be distributed as 3rd party plugin, and disables ability to enable the core module if my module is active. – Zachary Schuessler Jan 30 '16 at 21:29
  • ooh I missed that part. sorry – MauroNigrele Jan 30 '16 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.