Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation - Support "activate first" w/setup UI #121

Merged
merged 4 commits into from
Jul 9, 2020

Conversation

totten
Copy link
Member

@totten totten commented Jul 4, 2020

Overview

This adds support for installing CiviCRM-Backdrop through the Setup API. Most notable changes:

  • Better layout and more useful options on the installation screen
  • Extensible installation logic - under the hood, this installer can initialize settings, toggle extensions, etc.
  • Reusable installation logic - can run the same installation code for CLI and web UI
  • No need to bypass regular module activation or bypass router (no need for install/index.php entry-point)

Before

The sysadmin downloads the CiviCRM module - but they must not install it. Instead, navigate to this path:

http://example.org/modules/civicrm/install/index.php?civicrm_install_type=backdrop

This is a special, standalone entry-point.

After

After downloading the CiviCRM module, you simply enable it like any module. Then use any link to open a CiviCRM page (e.g. there are links in the post-install status-message and in the main menu). The page will display the setup screen.

Screen Shot 2020-07-03 at 11 17 37 PM

Slightly better demo: http://think.hm/tmp/Backdrop-Civicrm-Setup.mp4

Technical Details

  1. The old install screen is still available as a fallback (in case there's some edge-case that got missed).
  2. The basic gist of this change is:
    • Ensure that all CiviCRM-Backdrop hooks fail gracefully (in the absence of civicrm.settings.php). Most already do - there were just a couple oddballs.
    • Update the handling of civicrm/* URLs. If CiviCRM cannot initialize, then show the civicrm-setup web installer.
  3. This is the same API used in the newer Civi-WP installer. (Note: For historical reasons, the Civi-WP has a few extra contingencies that aren't needed here.)
  4. When testing/r-running, here are some of things that I tried:
    • Enable the module and try to view it as regular/non-admin user. Regular users cannot perform installation.
    • Install via web UI
    • Install via CLI (cv core:install -vv --cms-base-url=http://bcmaster.bknix:8001), with the civicrm.module enabled or disabled
    • Install in US English or French.
  5. During development, my workflow went a bit like this:
    1. Create Backdrop site with CiviCRM codebase -- but without installing. (I specifically used a modified civibuild with the backdrop-clean type - ie hack app/config/backdrop-clean/install.sh to skip the scripted civicrm_install, etal. Then run civibuild create bcmaster or civibuild reinstall bcmaster)
    2. Login.
    3. Make a new DB snapshot (eg civibuild snapshot bcmaster). (This way my login-session is part of the snapshot.)
    4. Repeatedly do the following:
      • Edit code
      • Use the installer - and see how it goes.
      • Cleanup: ./bin/cv.phar core:uninstall -f ; civibuild restore bcmaster ; rm -rf ~/bknix/build/bcmaster/web/files/civicrm/
  6. This depends on another PR for civicrm-core: Support for installing CiviCRM-Backdrop via "setup" UI civicrm-core#17749

@civibot
Copy link

civibot bot commented Jul 4, 2020

(Standard links)

@herbdool
Copy link
Contributor

herbdool commented Jul 7, 2020

I tested and left feedback here civicrm/civicrm-core#17749 (comment)

totten added 3 commits July 7, 2020 18:02
Before
------

Every time `civicrm_initialize()` is called with a failure, it enqueues another status message
which prompts the admin to setup CiviCRM.

This leads to some quirks - e.g. if you activate `civicrm.module` in the admin GUI, and then use
the web-based installer, and then finally return to a Backdrop page - you may see some
old/stale notifications prompting you to setup CiviCRM (which is weird... since you just did that).

After
-----

The setup message is displayed in two ways:

1. In `hook_enable`, it displays the message one time.
2. In `hook_requirements`, it displays the message if initialization fails.
@totten totten force-pushed the 1.x-master-setup branch from bfb5fcc to 55b7294 Compare July 8, 2020 02:01
@seamuslee001 seamuslee001 merged commit 9f2488a into civicrm:1.x-master Jul 9, 2020
@totten totten deleted the 1.x-master-setup branch September 3, 2020 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants