I have a rescue project that just landed on my plate, which involves a decently large website that was built on Drupal 8.3.x, How ever many years ago, using Lightning 2.x. --- and has never had core/contrib or lightning updated. Yay.

The project never really used everything that lightning provides, It appears that it was just used as a quick way to get "media installed and configured" for them, and in the 3 years of the client internal team adding functionality to the site, never leveraged Lightning ... and obviously ever updated the platform.

Attempting to update core to 8.6.x, as an effort to fix a bunch of things that just are starting to go wrong, and of course to solve all of the security updates, composer yells at me about Lightning 2.x not being supported by 8.6.x, obviously.

I'm not familiar enough with Lightning as a product, or its road map, where its been, and where its going to recognize what it is doing, or should be doing, or what the client is ignoring it can do... And in the very brief reading I did of the Lightning project home page, I can see there's a lot of new functionality coming in the package using Layout, including React based functionality, and other stuff that is not on the client's wish list or anywhere near what they want to start supporting internally right now.

As such, I want to unwind Lightning, completely, and uninstall it from the site, but do so in a way that I can maintain the functionality that was installed with it.

Ie, remove it as a dependency, even if I have to manually reconfigure media types and permission structures by hand, to replicate its functionality. --- this is not the ideal solution, but it is one.

Thoughts?
Advice?
Anyone else deal with anything like this?

Thank you very much!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alphex created an issue. See original summary.

alphex’s picture

Issue summary: View changes
phenaproxima’s picture

It's not documented, but it can be done. This is because Lightning's functionality was split into stand-alone components in version 3.x. If they were using the media functionality only, you can preserve that by bringing in Lightning Media only, even while removing Lightning itself. The main caveat is that in order to do this, the site must have been built with Composer.

alphex’s picture

@ phenaproxima -- it wasn't originally built with composer, of course :)

phenaproxima’s picture

Well, the good news is that moving it to Composer is a thing that can be done as well. It's a pain, but it can be done.

So my suggestion to you is:

1) Rebuild the code base on full Lightning, but using the Composer infrastructure.
2) Once that's done, you can restructure composer.json to remove most of Lightning except the stuff you need.
3) Then you'll need to flip a few switches in Drupal itself so that it no longer uses Lightning as the install profile.

At that point, you should be set.

alphex’s picture

@ phenaproxima
Thank you.

I've got a new site set up with Composer.

I stopped when i ran in to the Lightning 2.x dependency errors, but I'll give your suggested path a try.

Thank you!

ThomWilhelm’s picture

I'm in exactly the same boat, we had a 8.3.x site built by an agency using 2.x lightning. I now need to upgrade to Drupal 8.6.x but am finding the upgrade path troublesome with things like workflow and media.

I also decided I don't want to keep lightning as we don't use it for any of our other sites, and we don't use any features from lightning. Also having lightning seems to require you to stay up to date with the direction lightning is going, and how it all interacts/conflicts with other Drupal modules.

Anyway, so far I've found removing it to be a real nightmare. I was initially going to do this in 2 stages, firstly do an upgrade that removed all the lightning modules, then secondly do a standard Drupal upgrade to bring everything up to date now lightning is gone. With some black magic I've managed to upgrade all my dependencies to the latest versions (I had some pretty tricky dependencies around entity_browser), and remove lightning at the same time.

I've attached to the ticket the upgrade script I've been running to upgrade Drupal then remove lightning modules. There's some hacky stuff I had to do to change the install profile, and clear a value from the menu_tree table that wasn't removed on uninstall. I've also attached the composer.json file we're currently using.

My plan to upgrade is as follows:

- Run this upgrade script on staging.
- Get content editors and site owners to test the functionality of the site.
- Once I'm happy with this, run this migration on staging, and then when it's complete, immediately copy the staging site to production.
- Download the production database and perform a config export as there'll be a huge amount of site configuration that has changed.
- Remove all lightning modules from the codebase.

Hope this helps someone out :)

phenaproxima’s picture

Here's what I'm considering posting as official documentation for how Lightning can be "uninstalled". Comments welcome!

---

Lightning is an installation profile, so there's no "official" way to remove it. The procedure explained here is one that you do at your own risk -- it is wise to do this in such a way that you can test the outcome before you make these changes on production.

  1. First, change the current installation profile from Lightning to Standard (or another install profile of your choice), like so: drush config:set core.extension profile standard
  2. Uninstall any Lightning modules that you aren't actively using.
  3. Export your configuration to account for changes made by the outgoing modules, if needed.
  4. You may be using modules that ship with Lightning -- ensure that all of these are explicitly added to your composer.json file, in at least the same version you were already using. For example: composer require drupal/panelizer:^4.2 --no-update, if you were using Panelizer 4.2 or later. This is very important, because your site my break if you remove Lightning before ensuring that all the modules you need are imported by Composer. If you need to continue using a Lightning module, you can import it as you would any other module; for example, composer require --no-update drupal/lightning_media:^3.10. Note that this "à la carte" style only works with Lightning 3 or later.
  5. Remove acquia/lightning from your composer.json file: composer remove --no-update acquia/lightning
  6. Explicitly require Drupal core in your composer.json file: composer require --no-update drupal/core:~8.7.0. (You should specify the same minor version of core you were using when Lightning was installed.)
  7. Run composer update.
  8. You should be all set. If you ever reinstall the site, you will need to specify the new installation profile (probably Standard), either in the web installer, drush site:install PROFILENAME, or as a configuration parameter for BLT.
Dane Powell’s picture

Status: Active » Reviewed & tested by the community

Looks good to me!

phenaproxima’s picture

Status: Reviewed & tested by the community » Fixed

Added to README.md in the 8.x-4.x and 8.x-3.x branches, and committed/pushed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.