If calls to Composer Stager fail your active site will be unaffected except if the fail happens during apply()
.
In that case you site will be in an unknown state. Some files could have been copied over but not all. Your site might load but still not be completely updated or you site might not load at all.
Create a manual way to recover after failed update that happens in apply()
This would require access to the command line but could be relatively simple process to follow
apply
make a copy of the original composer files call composer.json.original composer.lock.original
From a starter template file dynamically create a update-recovery.php
that will be placed in the Drupal root and with the same file permissions as index.php
This will file will need 2 dynamic aspects
1. the path to composer as known to Package Manager
2. a dynamically create security key as it will not be able to rely on Drupal permissions
mysite.com/update-recovery.php?key=very-long-random-key
update-recovery.php
If the admin can still login in they should be presented with the mysite.com/update-recovery.php?key=very-long-random-key
link. We might want to stop all other actions on the site because even if the user can login it will be in an undetermined state, likely insecure
update-recovery.php
would perform these steps to recover the site
1. check for the correct random key in the request
2. delete composer.lock and composer.json (this may pre or post update versions depending on when the Apply failed
3. rename composer.lock.orignal and composer.json.original
4. run composer install
(with the composer at the path that was provide dynamically)
5. Inform the user if the operation was successful and if so that site not pre-update state, We could dynamically set a message when we create this fail.
update-recovery.php
should also include in comment at the top instructions on how to fix the site manually
Active
3.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.