Add CLI command to install a module#3323
Conversation
67ac662 to
80740d0
Compare
Codecov Report
@@ Coverage Diff @@
## master #3323 +/- ##
============================================
- Coverage 27.79% 27.72% -0.07%
- Complexity 8010 8030 +20
============================================
Files 568 569 +1
Lines 30564 30640 +76
============================================
Hits 8496 8496
- Misses 22068 22144 +76
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
|
||
| // Reboot the kernel to trigger a kernel initialize which registers the Dependency Injection Extension of the | ||
| // module we would like to install. Also, make sure to replace the static cached container in our BaseModel! | ||
| $_SERVER['INSTALLING_MODULE'] = $module; |
There was a problem hiding this comment.
It took me a while to understand that in the Kernel.php we explicitly listen to the exact route which installs a module, and then we register the DI Extension file of the module.
I need a way to re-initialize the kernel and clearing the cache folder (as suggested here: https://github.com/forkcms/forkcms/blob/master/src/Backend/Modules/Extensions/Actions/InstallModule.php#L41-L43) did not seem to work, probably because the redirect in InstallModule.php creates a brand new request (which boots up the kernel) but here we're dealing in a CLI context. So I reboot the Kernel manually.
Also needed a way to pass the module name to the Kernel.php file to pick up the module name and initialize the DI Extension for it. Feel free to suggest better options than putting it in $_SERVER ? The whole register-module-extension-on-install feels a bit hacky unfortunately
Type
Resolves the following issues
When I setup CI/CD for a module, I kind of lack
dump.sqlwith the base schema of Fork CMS instead and generate the parameters.yml myself.dump.sqlfile and keep the sql dump up to date... because we work with Doctrine entities now anyway. Ideally, I can setup a database, importdump.sql(basic fork cms schema) and then install the module and the theme that I need (locale, tables, images, ...)Pull request description
This PR adds a command that allows the developer to install a module using his CLI. E.g.