3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class generates form components for Site Url.
21 class CRM_Admin_Form_Setting_UF
extends CRM_Admin_Form_Setting
{
23 protected $_settings = [];
25 protected $_uf = NULL;
28 * Build the form object.
30 public function buildQuickForm() {
31 $config = CRM_Core_Config
::singleton();
32 $this->_uf
= $config->userFramework
;
33 $this->_settings
['syncCMSEmail'] = CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
;
35 if ($this->_uf
== 'WordPress') {
36 $this->_settings
['wpBasePage'] = CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
;
39 CRM_Utils_System
::setTitle(
40 ts('Settings - %1 Integration', [1 => $this->_uf
])
43 if ($config->userSystem
->is_drupal
) {
44 $this->_settings
['userFrameworkUsersTableName'] = CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
;
47 // find out if drupal has its database prefixed
50 if (isset($databases['default']['default']['prefix'])) {
51 if (is_array($databases['default']['default']['prefix'])) {
52 $drupal_prefix = $databases['default']['default']['prefix']['default'];
55 $drupal_prefix = $databases['default']['default']['prefix'];
59 if ($config->userSystem
->viewsExists() &&
61 $config->dsn
!= $config->userFrameworkDSN ||
!empty($drupal_prefix)
64 $dsn = CRM_Utils_SQL
::autoSwitchDSN($config->dsn
);
65 $dsnArray = DB
::parseDSN($dsn);
66 $tableNames = CRM_Core_DAO
::getTableNames();
68 $tablePrefixes = '$databases[\'default\'][\'default\'][\'prefix\']= array(';
69 if ($config->userFramework
=== 'Backdrop') {
70 $tablePrefixes = '$database_prefix = array(';
72 // add default prefix: the drupal database prefix
73 $tablePrefixes .= "\n 'default' => '$drupal_prefix',";
75 if ($config->dsn
!= $config->userFrameworkDSN
) {
76 $prefix = "`{$dsnArray['database']}`.";
78 foreach ($tableNames as $tableName) {
79 $tablePrefixes .= "\n '" . str_pad($tableName . "'", 41) . " => '{$prefix}',";
81 $tablePrefixes .= "\n);";
82 $this->assign('tablePrefixes', $tablePrefixes);
85 parent
::buildQuickForm();