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 #606

Merged
merged 5 commits into from
Jul 13, 2020

Conversation

totten
Copy link
Member

@totten totten commented Jul 6, 2020

Overview

This adds support for installing CiviCRM-Drupal 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)

Note: This is a port of civicrm/civicrm-backdrop#121 to D7.

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

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.

For a sense of how it looks, here's a screenshot+mp4 from the Backdrop variant:

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

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-Drupal hooks fail gracefully (in the absence of civicrm.settings.php). Many 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://dmaster.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 D7 site with CiviCRM codebase -- but without installing. (I specifically used a modified civibuild with the drupal-demo type - ie hack app/config/demo-demo/install.sh to skip most of the install logic. Then run civibuild create dmaster or civibuild reinstall dmaster)
    2. Login.
    3. Make a new DB snapshot (eg civibuild snapshot dmaster). (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 dmaster ; rm -rf ~/bknix/build/dmaster/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 6, 2020

(Standard links)

@civibot civibot bot added the 7.x-master label Jul 6, 2020
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 Drupal 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.
@seamuslee001
Copy link
Contributor

I tested this and confirmed it works, I would note that this new setup routine doesn't allow you or at least not obvious to me how to install into a separate DB, it assumes you want to use the same DB as the CMS

@seamuslee001 seamuslee001 merged commit 1bf6c8e into civicrm:7.x-master Jul 13, 2020
@totten totten deleted the 7.x-master-setup branch July 16, 2020 02:27
@totten
Copy link
Member Author

totten commented Jul 16, 2020

I tested this and confirmed it works, I would note that this new setup routine doesn't allow you or at least not obvious to me how to install into a separate DB, it assumes you want to use the same DB as the CMS

@seamuslee001 Good comment. Just to clarify - it should work with a separate DB, but it's an advanced option. When you skim the technical details at the bottom, the Civi DSN should have a pencil button. The styling is maybe too subtle.

Screen Shot 2020-07-15 at 7 31 50 PM

In any event, click that to edit.

Screen Shot 2020-07-15 at 7 32 06 PM

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.

2 participants