From 7b8e08a09c01f776e9f72e358807870fff64e275 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 30 Aug 2016 14:00:30 +1000 Subject: [PATCH] CRM-15928 set allowing remote submissions on upgrade --- CRM/Upgrade/Incremental/php/FourSix.php | 40 +++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/CRM/Upgrade/Incremental/php/FourSix.php b/CRM/Upgrade/Incremental/php/FourSix.php index 0564ec34c4..02bd171b3d 100644 --- a/CRM/Upgrade/Incremental/php/FourSix.php +++ b/CRM/Upgrade/Incremental/php/FourSix.php @@ -75,9 +75,9 @@ class CRM_Upgrade_Incremental_php_FourSix { if ($rev == '4.6.alpha3') { $postUpgradeMessage .= '

' . ts('A new permission has been added for editing message templates. Previously, users needed the "administer CiviCRM" permission. Now, users need the new permission called "edit message templates." Please check your CMS permissions to ensure that users who should be able to edit message templates are assigned this new permission.'); } - if ($rev == '4.6.21') { - $postUpgradeMessage .= '

' . ts("WARNING: For increased security, profile submissions embedded in remote sites are no longer allowed to create or edit data by default. If you need to allow users to submit profiles from external sites, you can restore this at Administer > System Settings > Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.) > 'Accept profile submissions from external sites'"); - } + // if ($rev == '4.6.21') { + // $postUpgradeMessage .= '

' . ts("WARNING: For increased security, profile submissions embedded in remote sites are no longer allowed to create or edit data by default. If you need to allow users to submit profiles from external sites, you can restore this at Administer > System Settings > Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.) > 'Accept profile submissions from external sites'"); + // } } @@ -272,6 +272,16 @@ class CRM_Upgrade_Incremental_php_FourSix { $this->addTask('Add Getting Started dashlet', 'addGettingStartedDashlet', $rev); } + /** + * Upgrade function. + * + * @param string $rev + */ + public function upgrade_4_6_21($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'task_4_6_x_runSql', $rev); + $this->addTask('Set Remote Submissions setting', 'setRemoteSubmissionsSetting', $rev); + } + /** * Add Getting Started dashlet to dashboard * @@ -296,4 +306,28 @@ FROM `civicrm_dashboard_contact` JOIN `civicrm_contact` WHERE civicrm_dashboard_ return TRUE; } + /** + * Set the setting value for allowing remote submissions. + * + * @param \CRM_Queue_TaskContext $ctx + * + * @return bool + */ + public function setRemoteSubmissionsSetting(CRM_Queue_TaskContext $ctx) { + $domains = CRM_Core_DAO::executeQuery("SELECT id FROM civicrm_domain"); + while ($domains->fetch()) { + CRM_Core_DAO::executeQuery("INSERT INTO civicrm_setting (`group_name`, `name`, `value`, `domain_id`, `is_domain`, `contact_id`, `component_id`, `created_date`, `created_id`) + VALUES (%1, %2, %3, %4, %5, NULL, NULL, %6, NULL)", array( + 1 => array('CiviCRM Preferences', 'String'), + 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; + } + } -- 2.25.1