[5.x]: Updating Craft removes all plugins
What happened?
Description
Under Utilities > Updates I had two updates: one for CraftCMS, and one for Datastar.
I pressed "Update All". After updating Craft to version 5.8.19 I noticed all the plugins were removed, only Datastar was available (which also had an update). All the other plugins were completely removed and had to be re-installed. Luckily, all the settings persisted, so no further configuration was required. After reinstalling the previously installed plugins, the website was working again.
(If I remember correctly I had 3 Craft updates, so that'd mean I was on Craft v5.8.16)
Steps to reproduce
- Press "Update All" under Utilities > Updates
Expected behavior
Craft and plugins get updated
Actual behavior
Craft and plugins get updated, but not updated plugins got uninstalled.
Craft CMS version
5.8.19
PHP version
8.4.13
Operating system and version
Linux 6.5.0-45-generic
Database type and version
MariaDB 11.4.3
Image driver and version
Imagick (ImageMagick 7.1.1-47)
Installed plugins and versions
After reinstalling all the plugins:
- CKEditor 4.10.1
- Datastar 1.0.0-RC.9
- Contact Form 3.1.0
- Contact Form Extensions 5.0.0
- SEO 5.0.0
Was there an error after the first update attempt?
Craft keeps track of which Craft plugins are currently composer-installed via a Composer plugin which gets involved in Composer operations. If something goes wrong with the Composer update/install, or if that plugin isn’t expressly enabled via config.allowed-plugins in composer.json, then Craft will lose track of which plugins are installed.
No visible error was shown, no.
I tried searching under storage/logs, but don't have the logs from that day, unfortunately. I also didn't tinker with the composer.json file, before or even after the update.
(Partial) contents of my composer.json:
"require": {
"craftcms/ckeditor": "^4.4.0",
"craftcms/cms": "5.8.19",
"craftcms/contact-form": "^3.1.0",
"ether/seo": "^5.0.0",
"hybridinteractive/craft-contact-form-extensions": "^5.0.0",
"mutation/translate": "4.2.1",
"putyourlightson/craft-datastar": "1.0.0-RC.9",
"vlucas/phpdotenv": "^5.4.0"
},
"require-dev": {
"craftcms/generator": "^2.0.0",
"yiisoft/yii2-shell": "^2.0.3"
},
"autoload": {
"psr-4": {
"modules\\": "modules/"
}
},
"config": {
"allow-plugins": {
"craftcms/plugin-installer": true,
"yiisoft/yii2-composer": true
},
"sort-packages": true,
"optimize-autoloader": true,
"platform": {
"php": "8.2"
}
},
The record of installed plugins is stored in vendor/craftcms/plugins.php, which is maintained by the craftcms/plugin-installer Composer plugin.
I’m guessing that there was an issue updating that file for some reason. Not really sure what, though. If this happens again, please check that file, and see if it includes each of the expected plugins’ configs.