From 84fb7424b4422936811431696b9182b1e1665cf6 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 20 Aug 2015 00:08:45 -0700 Subject: [PATCH] CRM_Core_BAO_Setting::getItem() - Fix calls which use deprecated parameters --- CRM/Core/BAO/ConfigSetting.php | 8 +++----- CRM/Core/BAO/Email.php | 2 +- CRM/Core/InnoDBIndexer.php | 2 +- CRM/Core/Page.php | 4 +--- CRM/Core/Resources.php | 4 +--- CRM/Upgrade/Incremental/General.php | 2 +- settings/Mailing.setting.php | 14 ++++++++++++++ tests/phpunit/api/v3/SyntaxConformanceTest.php | 2 +- 8 files changed, 23 insertions(+), 15 deletions(-) diff --git a/CRM/Core/BAO/ConfigSetting.php b/CRM/Core/BAO/ConfigSetting.php index 0086008db5..ddc5f16bcd 100644 --- a/CRM/Core/BAO/ConfigSetting.php +++ b/CRM/Core/BAO/ConfigSetting.php @@ -319,7 +319,7 @@ class CRM_Core_BAO_ConfigSetting { CRM_Core_BAO_Setting::retrieveDirectoryAndURLPreferences($defaults); // Pickup enabled-components from settings table if found. - $enableComponents = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array()); + $enableComponents = Civi::settings()->get('enable_components'); if (!empty($enableComponents)) { $defaults['enableComponents'] = $enableComponents; @@ -649,8 +649,7 @@ WHERE option_group_id = ( } // get enabled-components from DB and add to the list - $enabledComponents - = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array()); + $enabledComponents = Civi::settings()->get('enable_components'); $enabledComponents[] = $componentName; self::setEnabledComponents($enabledComponents); @@ -675,8 +674,7 @@ WHERE option_group_id = ( } // get enabled-components from DB and add to the list - $enabledComponents - = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array()); + $enabledComponents = Civi::settings()->get('enable_components'); $enabledComponents = array_diff($enabledComponents, array($componentName)); self::setEnabledComponents($enabledComponents); diff --git a/CRM/Core/BAO/Email.php b/CRM/Core/BAO/Email.php index d4f343424b..c4ccb4bacc 100644 --- a/CRM/Core/BAO/Email.php +++ b/CRM/Core/BAO/Email.php @@ -319,7 +319,7 @@ AND reset_date IS NULL * @return object */ public static function isMultipleBulkMail() { - return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'civimail_multiple_bulk_emails', NULL, FALSE); + return Civi::settings()->get('civimail_multiple_bulk_emails'); } /** diff --git a/CRM/Core/InnoDBIndexer.php b/CRM/Core/InnoDBIndexer.php index 51da1ccda3..12f5ecd914 100644 --- a/CRM/Core/InnoDBIndexer.php +++ b/CRM/Core/InnoDBIndexer.php @@ -75,7 +75,7 @@ class CRM_Core_InnoDBIndexer { array('name'), ), ); - $active = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'enable_innodb_fts', NULL, FALSE); + $active = Civi::settings()->get('enable_innodb_fts'); self::$singleton = new self($active, $indices); } return self::$singleton; diff --git a/CRM/Core/Page.php b/CRM/Core/Page.php index 84907ee01d..37979b198d 100644 --- a/CRM/Core/Page.php +++ b/CRM/Core/Page.php @@ -217,9 +217,7 @@ class CRM_Core_Page { // Intermittent alert to admins CRM_Utils_Check::singleton()->showPeriodicAlerts(); - if ($this->useLivePageJS && - CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajaxPopupsEnabled', NULL, TRUE) - ) { + if ($this->useLivePageJS && Civi::settings()->get('ajaxPopupsEnabled')) { CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header'); } diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index f5f57cfd4c..7d0e3649e4 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -143,9 +143,7 @@ class CRM_Core_Resources { if (!$this->cacheCode) { $this->resetCacheCode(); } - $this->ajaxPopupsEnabled = (bool) CRM_Core_BAO_Setting::getItem( - CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajaxPopupsEnabled', NULL, TRUE - ); + $this->ajaxPopupsEnabled = (bool) Civi::settings()->get('ajaxPopupsEnabled'); } /** diff --git a/CRM/Upgrade/Incremental/General.php b/CRM/Upgrade/Incremental/General.php index c2b4020ead..9be29b28a2 100644 --- a/CRM/Upgrade/Incremental/General.php +++ b/CRM/Upgrade/Incremental/General.php @@ -80,7 +80,7 @@ class CRM_Upgrade_Incremental_General { } } - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'enable_innodb_fts', NULL, FALSE)) { + if (Civi::settings()->get('enable_innodb_fts')) { // The FTS indexing feature dynamically manipulates the schema which could // cause conflicts with other layers that manipulate the schema. The // simplest thing is to turn it off and back on. diff --git a/settings/Mailing.setting.php b/settings/Mailing.setting.php index 4503aa0b2a..30a8bc973d 100644 --- a/settings/Mailing.setting.php +++ b/settings/Mailing.setting.php @@ -178,4 +178,18 @@ return array( 'description' => 'If enabled, a randomized hash key will be used to reference the mailing URL in the mailing.viewUrl token, instead of the mailing ID', 'help_text' => NULL, ), + 'civimail_multiple_bulk_emails' => array( + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'civimail_multiple_bulk_emails', + 'type' => 'Integer', + 'html_type' => 'checkbox', + 'default' => 0, + 'add' => '4.5', + 'title' => ' Multiple Bulk Emails', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If enabled, CiviMail will deliver a copy of the email to each bulk email listed for the contact.', + 'help_text' => NULL, + ), ); diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 90be85cfcf..1d9a1fe5fd 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -240,7 +240,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { */ public static function custom_data_entities() { $entities = CRM_Core_BAO_CustomQuery::$extendsMap; - $enabledComponents = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array()); + $enabledComponents = Civi::settings()->get('enable_components'); $customDataEntities = array(); $invalidEntities = array('Individual', 'Organization', 'Household'); $entitiesToFix = array('Case', 'Relationship'); -- 2.25.1