Handling Patches When Updating
However, there are a number of problems we have had while maintaining Varbase and building sites on Varbase. Those problems are:
- There's no logging mechanism for failed patches
- Patches most of the times get included in new releases, there's no way this package can detect if the patch is already included in the new release
These issues become quite irritating and when maintaining a Drupal site, as Varbase and other Drupal distros rely on patches to work well.
When you execute
composer require vendor/xyzcommand, newer versions of modules or core are downloaded. If patches for those modules are included, there are 3 possible scenarios:
Based on the scenarios mentioned above, we have forked the
"cweagans/composer-patches"package, and added an Event Dispatcher on patch failure. The Event Dispatcher will dispatch an Event that will prompt you to perform an action depending on the scenarios above. Thus:
Example screenshot below:
Example screenshot of
If you're using Varbase 8.6.3 or greater, just run
composer updateand it will work.
- 1.From a command prompt window, navigate to your project:
- 2.Add Vardot's composer-patches repository to use our forked package instead of the cweagans's.
composer config repositories.composer-patches vcs https://github.com/vardot/composer-patches
- 3.Require the Varbase Updater package. (Requiring the package only without running the update command will add the Composer plugins for patching but won't update Varbase. To update, you need to run the update command).
composer require vardot/varbase-updater
composer updateto get the new package and start applying the new patching mechanism.