From 9e42a50177c5bb2c8577de3b4004f55018a14390 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 29 Aug 2016 21:18:30 -0700 Subject: [PATCH] CRM-15928 - CRM/Upgrade - Enable remote_profile_submissions --- CRM/Upgrade/Incremental/php/FourSeven.php | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/CRM/Upgrade/Incremental/php/FourSeven.php b/CRM/Upgrade/Incremental/php/FourSeven.php index 087f983943..973c155d21 100644 --- a/CRM/Upgrade/Incremental/php/FourSeven.php +++ b/CRM/Upgrade/Incremental/php/FourSeven.php @@ -235,6 +235,7 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base public function upgrade_4_7_11($rev) { $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); $this->addTask('Dashboard schema updates', 'dashboardSchemaUpdate'); + $this->addTask(ts('Fill in setting "remote_profile_submissions"'), 'migrateRemoteSubmissionsSetting'); } /* @@ -460,6 +461,35 @@ FROM `civicrm_dashboard_contact` JOIN `civicrm_contact` WHERE civicrm_dashboard_ return TRUE; } + /** + * v4.7.11 adds a new setting "remote_profile_submissions". This is + * long-standing feature that existing sites may be using; however, it's + * a bit prone to abuse. For new sites, the default is to disable it + * (since that is more secure). For existing sites, the default is to + * enable it (since that is more compatible). + * + * @param \CRM_Queue_TaskContext $ctx + * + * @return bool + */ + public function migrateRemoteSubmissionsSetting(CRM_Queue_TaskContext $ctx) { + $domains = CRM_Core_DAO::executeQuery("SELECT DISTINCT d.id FROM civicrm_domain d LEFT JOIN civicrm_setting s ON d.id=s.domain_id AND s.name = 'remote_profile_submissions' WHERE s.id IS NULL"); + while ($domains->fetch()) { + CRM_Core_DAO::executeQuery( + "INSERT INTO civicrm_setting (`name`, `value`, `domain_id`, `is_domain`, `contact_id`, `component_id`, `created_date`, `created_id`) + VALUES (%2, %3, %4, %5, NULL, NULL, %6, NULL)", + array( + 2 => array('remote_profile_submissions', 'String'), + 3 => array('s:1:"1";', 'String'), + 4 => array($domains->id, 'Integer'), + 5 => array(1, 'Integer'), + 6 => array(date('Y-m-d H:i:s'), 'String'), + ) + ); + } + return TRUE; + } + /** * CRM-11782 - Get rid of VALUE_SEPARATOR character in saved search form values * -- 2.25.1