X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FSystem%2FBackdrop.php;h=692669e82f75b3c522c7705ec2139bacb5f489a3;hb=3514b4c89870eec7fabd828d4209c4540e7a277f;hp=ded63e216442af1d0c5a0a9d3cbba3e4831cc201;hpb=bf235d9d96c04ad4613e330e4525d5cf7cf46b0e;p=civicrm-core.git diff --git a/CRM/Utils/System/Backdrop.php b/CRM/Utils/System/Backdrop.php index ded63e2164..692669e82f 100644 --- a/CRM/Utils/System/Backdrop.php +++ b/CRM/Utils/System/Backdrop.php @@ -292,9 +292,11 @@ class CRM_Utils_System_Backdrop extends CRM_Utils_System_DrupalBase { $config = CRM_Core_Config::singleton(); $ufDSN = CRM_Utils_SQL::autoSwitchDSN($config->userFrameworkDSN); - $dbBackdrop = DB::connect($ufDSN); - if (DB::isError($dbBackdrop)) { - throw new CRM_Core_Exception("Cannot connect to Backdrop database via $ufDSN, " . $dbBackdrop->getMessage()); + try { + $dbBackdrop = DB::connect($ufDSN); + } + catch (Exception $e) { + throw new CRM_Core_Exception("Cannot connect to Backdrop database via $ufDSN, " . $e->getMessage()); } $account = $userUid = $userMail = NULL; @@ -539,9 +541,6 @@ AND u.status = 1 require_once "$cmsPath/core/includes/config.inc"; backdrop_bootstrap(BACKDROP_BOOTSTRAP_FULL); - // Explicitly setting error reporting, since we cannot handle Backdrop - // related notices. - error_reporting(1); if (!function_exists('module_exists') || !module_exists('civicrm')) { if ($throwError) { echo '
Sorry, could not load Backdrop bootstrap.'; @@ -1057,4 +1056,27 @@ AND u.status = 1 return ['ufAccessURL' => url('admin/config/people/permissions')]; } + /** + * Get the CRM database as a 'prefix'. + * + * This returns a string that can be prepended to a query to include a CRM table. + * + * However, this string should contain backticks, or not, in accordance with the + * CMS's drupal views expectations, if any. + */ + public function getCRMDatabasePrefix(): string { + return str_replace(parent::getCRMDatabasePrefix(), '`', ''); + } + + /** + * Return the CMS-specific UF Group Types for profiles. + * @return array + */ + public function getUfGroupTypes() { + return [ + 'User Registration' => ts('Backdrop User Registration'), + 'User Account' => ts('View/Edit Backdrop User Account'), + ]; + } + }