2

While setting up new module and after running php bin/magento setup:upgrade it started to clean cache and file and deleted all front end css and adminhtml css and all visual files. How Can I prevent this happen again as I need to make that module working?

[user@server html]$ php bin/magento setup:upgrade
Cache cleared successfully
File system cleanup:
/chroot/home/user/rootdir/html/generated/code/Composer
/chroot/home/user/rootdir/html/generated/code/Ebizmarts
/chroot/home/user/rootdir/html/generated/code/Magento
/chroot/home/user/rootdir/html/generated/code/Symfony
/chroot/home/user/rootdir/html/generated/code/Wyomind
The directory '/chroot/home/user/rootdir/html/generated/metadata/' doesn't 
exist - skipping cleanup
/chroot/home/user/rootdir/html/pub/static/_po_compressor
/chroot/home/user/rootdir/html/pub/static/adminhtml
/chroot/home/user/rootdir/html/pub/static/deployed_version.txt
/chroot/home/user/rootdir/html/pub/static/frontend
/chroot/home/user/rootdir/html/var/view_preprocessed/pub

1 Answer 1

1

You can use --keep-generated flag like

magento setup:upgrade --keep-generated

It will not remove static files and change only database schema and data if any.

check link for more

4
  • 1
    What I misunderstood, that I should regenerate static files after doin gthat right? Its not that I want to keep generated, I just want to follow correct procedure which woul dbe to delete all in pub/static, and then regenerate them with setup:static-content:deploy, woul dthat be right procedure?
    – SPL
    Sep 25, 2018 at 6:54
  • If you are in developer mode then you don't need to run deploy command if you have right permissions on files & folders. If you are on production then you don't need to run deploy unless you have changes in static files. --keep-generated flag mainly effective when you are on production mode and you don't want to run static content deploy as it forces some downtime. Let me know if you still have any confusion on this. Sep 25, 2018 at 8:50
  • I understand now, only user kee generated when no impact on static files. Otherwise what is better environmet for module instal production or development?
    – SPL
    Sep 25, 2018 at 12:04
  • Generally what we did is that develop our project on local machine and after that deploy whole code on production server and then put this instance on production mode. If there is need to install a module after this you can use module enable command then run upgrade if it required with --keep-generated as I said earlier it will generate files in generated folder for this module only and won't clear all static files and generated files. Sep 25, 2018 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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