Today I had a weird behaviour of one of our customers store. We tried to install the Shopware Security Plugin and what happened was:
- I install the security plugin via composer
- I refresh the plugins via CLI -> plugin is in CLI and database
- I activate and install the plugin -> plugin is installed in CLI and database
- I update the plugin list on the admin area -> the plugin is deleted from database and gone in CLI
TL;DR: Opcache.
I turned to Shopware’s slack and asked the community. We had this behaviour in the past, but I couldn’t remember what the problem was.
Thankfully I got an answer <3
I think I had this problem once as well. Have you cleared OpCache? If I remember correctly, that did the trick for me
Johannes Przymusinski [die-lobby.de]
Thanks Johannes!
Reset opcache
I know two ways to reset opcache:
- Restart PHP-fpm
- or using the awesome cachetool by gordalina!
If you talk about a production system, activating the opcache is a good idea. Watch the option `opcache.validate_timestamps = 0` – that’s the one actually causing your troubles.
However, on a production system, it is not a recommended practice to install plugins manually. Rather use CI/CD with composer.
On staging and dev systems you may want to deactivate opcache in general or at least set `opcache.validate_timestamps = 1`.
Does that fix the symlink problem which is due to Deployer? Because currently we just clean the opcache and stat cache on deployment.
tl;dr Just set `opcache.validate_timestamps = 1` if you plan to install plugins/apps manually. The reason Admin seems to remove the plugin is that it just didn’t notice the new files in the custom/plugins/ folder because of caching.