Manual sync trying to find civicrm_* tables in wrong database when CiviCRM installed in separate db

Created on 29 April 2022, about 3 years ago
Updated 23 November 2023, over 1 year ago

Problem/Motivation

When pressing manual sync at /admin/config/civicrm/civicrm-group-roles/manual-sync, get this:

Base table or view not found: 1146 Table 'drupal9.civicrm_uf_match' doesn't exist: SELECT "uf"."contact_id" AS "contact_id" FROM "civicrm_uf_match" "uf"; Array () in Drupal\civicrm_group_roles\CivicrmGroupRoles->getSyncContactIds() (line 150 of modules/contrib/civicrm_group_roles-civicrm_group_roles/src/CivicrmGroupRoles.php).

Steps to reproduce

Install CiviCRM in separate database. Press Manually Sync at /admin/config/civicrm/civicrm-group-roles/manual-sync.

Proposed resolution

getSyncContactIds() uses the main database connection:

$select = $this->getDatabase()
      ->select('civicrm_uf_match', 'uf')
      ->fields('uf', ['contact_id']);

Perhaps instead this could be done with API4 (not sure if API3 can do it).

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇦Canada nubeli

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024