6

Is it possible to di compile to specific module instead of whole magento di compile ?

Because, Whole Magento take a long time to compile. So, is it possible to di compile to specific module.

php bin/magento setup:di:compile CompanyName_ModuleName

Please help me. If it is possible.

12

You can do this by follow this step :

Go to :

/var/www/html/m224/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php

Find this line :

$modulePaths = $this->componentRegistrar->getPaths(ComponentRegistrar::MODULE);

Replace this below line and add path of the module which you want to compile like this :

$modulePaths = ['CompanyName_ModuleName' => '/var/www/html/m224/app/code/CompanyName/ModuleName'];

Make sure module register with thisCompanyName_ModuleName in registration.php file.

It's temporary solution for di compile single module. Remove di generated module folder and refresh cache.

Hope, It will helpful for you.

Reference

  • Happy to help !! Happy Coding :) – Rohan Hapani Jul 26 '18 at 18:46
  • 2
    excellent work....Suggest to create a custom command and implement the this logic – Amit Bera Jul 26 '18 at 19:39
  • 1
    Yes, a custom command that could be integrated in bin/magento or n98-magerun would be great – simonthesorcerer Aug 1 '18 at 11:46
2

If your focus is to try to contain as well as possible the downtime of your production, the below may help:

You could clone your codebase on the same server and separate folder (clone basically).

Once both environments would coexist, you can deploy static content on the clone without penalising the production environment uptime.

Finally, when the deploy is complete, you could either symlink the pub/static folder or just rsync. Of course, this may be done with a script.

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.