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

dev/core#2490 Drupal8: Fix CMS intergration table mapping #19989

Merged
merged 2 commits into from
Apr 21, 2021
Merged

dev/core#2490 Drupal8: Fix CMS intergration table mapping #19989

merged 2 commits into from
Apr 21, 2021

Conversation

olivierh65
Copy link
Contributor

@olivierh65 olivierh65 commented Apr 7, 2021

In Drupal8, CMS intergration don't show table mapping, because $database global variable is no more defined and can be retreived using Drupal\Core\Database\Database::getConnectionInfo()

Before

On the "CMS database integration" page, when running CiviCRM/Drupal on separate databases, the CMS database settings are not visible:

cms-2021-04-20_09-43

After

cms-2021-04-20_09-45

Technical Details

Fetches the Drupal8 database info from the place where D8/D9 now manages this.

Comments

edits by mlutfy.

In Drupal8, CMS intergration don't show table mapping, because $database global variable is no more defined and can be retreived using Drupal\Core\Database\Database::getConnectionInfo()
@civicrm-builder
Copy link

Can one of the admins verify this patch?

@civibot
Copy link

civibot bot commented Apr 7, 2021

(Standard links)

@civibot civibot bot added the master label Apr 7, 2021
@demeritcowboy
Copy link
Contributor

@eileenmcnaughton
Copy link
Contributor

add to whitelis

@eileenmcnaughton
Copy link
Contributor

add to whitelist

@eileenmcnaughton
Copy link
Contributor

We probably should put the funciton on the drupal classes & then it becomes

$databases = CRM_Core_Config::singleton()->userSystem->getDatabases();

with the functions being called being on CRM_Utils_System_Drupal etc

@demeritcowboy
Copy link
Contributor

Agree just I'm also trying to figure out why this patch isn't working for me locally. Regardless of the location it seems like it should.

@demeritcowboy
Copy link
Contributor

Oh, it would help if I update the right install. So yes it works.

Actually this whole code function is full of if cms stuff. Maybe could leave that cleanup for a followup?

@demeritcowboy
Copy link
Contributor

@olivierh65 The test run is failing because there are blank spaces on lines 46 and 54 and the style checker doesn't like that.

Removes spaces on line 56
@demeritcowboy
Copy link
Contributor

  • General standards
    • [r-explain] PASS
    • [r-user] PASS
    • [r-doc] PASS
    • [r-run] PASS
      • Works in drupal 8/9 and 7.
  • Developer standards
    • [r-tech] Soft Pass
      • As noted earlier it would be better to refactor to use OO-style and the CRM_Utils_System hierarchy, however the whole block of surrounding code is full of if [cms] for wordpress and backdrop too and that needs improving too. And why even bother with the $databases wrangling unless you're already inside the if $config->userSystem->viewsExists(). So there are a couple things for future if someone wants to take them on.
    • [r-code] Soft Pass
      • Usually commits are squashed before merging.
      • It might be safer to have the leading \ on Drupal\Core\Database\Database, but as noted above the whole thing should eventually be moved out.
    • [r-maint] ?
      • Difficult to write a test for.
    • [r-test] PASS

@totten
Copy link
Member

totten commented Apr 19, 2021

Agree with the 'Soft pass' comments under r-tech/r-code -- the patch is consistent with the context/style around it. Yes, the existing page is wonky. But this page specifically calls-out things that haven't been abstracted well across CMSs, so I think it's gonna be a little wonky regardless. For fixing this concrete problem... the approach in the patch is sensible. So kudos @olivierh65.

But IMHO the r-explain needs work -- i.e. it's still got a large blob of template/boilerplate text. If the Gitlab issue summarizes everything you need to know, then that's cool - but the description should have the link and should clean-up the boilerplate.

@mlutfy mlutfy changed the title In Drupal8, CMS intergration don't show table mapping dev/core#2490 Drupal8: Fix CMS intergration table mapping Apr 20, 2021
@mlutfy
Copy link
Member

mlutfy commented Apr 20, 2021

I took the liberty of editing the PR summary to add more details.

@totten
Copy link
Member

totten commented Apr 21, 2021

Looks good. Thanks @mlutfy @demeritcowboy @olivierh65

@totten totten merged commit 105f6b6 into civicrm:master Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants