Skip to content
Snippets Groups Projects
Unverified Commit 5af3556f authored by Seamus Lee's avatar Seamus Lee Committed by GitHub
Browse files

Merge pull request #15842 from totten/master-config-backend

#1387 Continue removal of "config_backend"
parents 41de5d4a 889bb141
Branches
Tags
No related merge requests found
......@@ -41,6 +41,9 @@ class CRM_Core_BAO_ConfigSetting {
*
* @param array $params
* Associated array of civicrm variables.
* @deprecated
* This method was historically used to access civicrm_domain.config_backend.
* However, that has been fully replaced by the settings system since v4.7.
*/
public static function add(&$params) {
$domain = new CRM_Core_DAO_Domain();
......@@ -69,6 +72,9 @@ class CRM_Core_BAO_ConfigSetting {
* @param $defaults
*
* @return array
* @deprecated
* This method was historically used to access civicrm_domain.config_backend.
* However, that has been fully replaced by the settings system since v4.7.
*/
public static function retrieve(&$defaults) {
$domain = new CRM_Core_DAO_Domain();
......@@ -80,7 +86,8 @@ class CRM_Core_BAO_ConfigSetting {
$urlVar = 'task';
}
if ($isUpgrade && CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_domain', 'config_backend')) {
$hasBackend = CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_domain', 'config_backend');
if ($isUpgrade && $hasBackend) {
$domain->selectAdd('config_backend');
}
else {
......@@ -89,7 +96,10 @@ class CRM_Core_BAO_ConfigSetting {
$domain->id = CRM_Core_Config::domainID();
$domain->find(TRUE);
if ($domain->config_backend) {
if ($hasBackend && $domain->config_backend) {
// This whole branch can probably be removed; the transitional loading
// is in SettingBag::loadValues(). Moreover, since 4.7.alpha1 dropped
// the column, anyone calling ::retrieve() has likely not gotten any data.
$defaults = unserialize($domain->config_backend);
if ($defaults === FALSE || !is_array($defaults)) {
$defaults = [];
......
......@@ -196,10 +196,13 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge {
/**
* Reset the serialized array and recompute.
* use with care
*
* @deprecated
*/
public function reset() {
$query = "UPDATE civicrm_domain SET config_backend = null";
CRM_Core_DAO::executeQuery($query);
// This is what it used to do. However, it hasn't meant anything since 4.6.
// $query = "UPDATE civicrm_domain SET config_backend = null";
// CRM_Core_DAO::executeQuery($query);
}
/**
......
......@@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/Domain.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:63a7b29cbea5066fe2605191bd41226a)
* (GenCodeChecksum:cdd41aa071b68a8a4be6b28f7ca3a0a3)
*/
/**
......@@ -49,13 +49,6 @@ class CRM_Core_DAO_Domain extends CRM_Core_DAO {
*/
public $description;
/**
* Backend configuration.
*
* @var text
*/
public $config_backend;
/**
* The civicrm version this instance is running
*
......@@ -159,18 +152,6 @@ class CRM_Core_DAO_Domain extends CRM_Core_DAO {
'type' => 'Text',
],
],
'config_backend' => [
'name' => 'config_backend',
'type' => CRM_Utils_Type::T_TEXT,
'title' => ts('Domain Configuration'),
'description' => ts('Backend configuration.'),
'where' => 'civicrm_domain.config_backend',
'table_name' => 'civicrm_domain',
'entity' => 'Domain',
'bao' => 'CRM_Core_BAO_Domain',
'localizable' => 0,
'serialize' => self::SERIALIZE_PHP,
],
'version' => [
'name' => 'version',
'type' => CRM_Utils_Type::T_STRING,
......
......@@ -29,6 +29,14 @@ class CRM_Upgrade_Incremental_php_FiveTwentyThree extends CRM_Upgrade_Incrementa
// if ($rev == '5.12.34') {
// $preUpgradeMessage .= '<p>' . ts('A new permission, "%1", has been added. This permission is now used to control access to the Manage Tags screen.', array(1 => ts('manage tags'))) . '</p>';
// }
if ($rev == '5.23.alpha1' && version_compare($currentVer, '4.7', '>=')) {
if ($this->hasConfigBackendData()) {
$preUpgradeMessage .= '<br/>' . ts("WARNING: The column \"<code>civicrm_domain.config_backend</code>\" is <a href='%2'>flagged for removal</a>. However, the upgrader has detected data in this copy of \"<code>civicrm_domain.config_backend</code>\". Please <a href='%1' target='_blank'>report</a> anything you can about the usage of this column. In the mean-time, the data will be preserved.", [
1 => 'https://civicrm.org/bug-reporting',
2 => 'https://lab.civicrm.org/dev/core/issues/1387',
]);
}
}
}
/**
......@@ -75,6 +83,11 @@ class CRM_Upgrade_Incremental_php_FiveTwentyThree extends CRM_Upgrade_Incrementa
$this->addTask('Remove Google + location option', 'removeGooglePlusOption');
$this->addTask('dev/mailing#59 Add in IMAP_XOAUTH2 protocol option for mailbox access', 'addXoauth2ProtocolOption');
$this->addTask('dev/translation#34 Fix contact-reference option for Postal Code', 'fixContactRefOptionPostalCode');
// (dev/core#1387) This column was dropped in 4.7.alpha1, but it was still created on new installs.
if (!$this->hasConfigBackendData()) {
$this->addTask('Drop column "civicrm_domain.config_backend"', 'dropColumn', 'civicrm_domain', 'config_backend');
}
}
/**
......@@ -146,4 +159,12 @@ class CRM_Upgrade_Incremental_php_FiveTwentyThree extends CRM_Upgrade_Incrementa
return TRUE;
}
/**
* @return bool
*/
private function hasConfigBackendData() {
return CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_domain', 'config_backend')
&& CRM_Core_DAO::singleValueQuery('SELECT count(*) c FROM `civicrm_domain` WHERE config_backend IS NOT NULL') > 0;
}
}
......@@ -50,7 +50,6 @@ function domain_create_expectedresult() {
'id' => '3',
'name' => 'A-team domain',
'description' => 'domain of chaos',
'config_backend' => '',
'contact_id' => '7',
'locales' => '',
'locale_custom_strings' => '',
......
......@@ -48,7 +48,7 @@ cms_eval 'civicrm_initialize();'
php GenerateData.php
## Prune local data
$MYSQLCMD -e "DROP TABLE zipcodes; DROP TABLE IF EXISTS civicrm_install_canary; UPDATE civicrm_domain SET config_backend = NULL; DELETE FROM civicrm_extension; DELETE FROM civicrm_cache; DELETE FROM civicrm_setting;"
$MYSQLCMD -e "DROP TABLE zipcodes; DROP TABLE IF EXISTS civicrm_install_canary; DELETE FROM civicrm_extension; DELETE FROM civicrm_cache; DELETE FROM civicrm_setting;"
TABLENAMES=$( echo "show tables like 'civicrm_%'" | $MYSQLCMD | grep ^civicrm_ | xargs )
cd $CIVISOURCEDIR/sql
......
......@@ -211,9 +211,9 @@ fi
if [ -n "$DO_FLUSH" ]; then
pushd "$CALLEDPATH/.."
# reset config_backend and userFrameworkResourceURL which gets set
# reset userFrameworkResourceURL which gets set
# when config object is initialized
$MYSQLCMD -e "UPDATE civicrm_domain SET config_backend = NULL; UPDATE civicrm_setting SET value = NULL WHERE name = 'userFrameworkResourceURL';"
$MYSQLCMD -e "UPDATE civicrm_setting SET value = NULL WHERE name = 'userFrameworkResourceURL';"
popd
fi
......
......@@ -399,7 +399,7 @@ UNLOCK TABLES;
 
LOCK TABLES `civicrm_domain` WRITE;
/*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */;
INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'5.23.alpha1',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,'5.23.alpha1',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
/*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */;
UNLOCK TABLES;
 
......@@ -93,6 +93,7 @@
<comment>Backend configuration.</comment>
<serialize>PHP</serialize>
<add>1.6</add>
<drop>5.23</drop>
</field>
<field>
<name>version</name>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment