From 8575f87948550f4b222a3631d2f651f7bc636691 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 16 May 2013 15:19:23 -0400 Subject: [PATCH] CRM-12647 - CRM_Utils_Migrate_Export - Split run() into build() and toXML() ---------------------------------------- * CRM-12647: Customization export/import crashes on "&" http://issues.civicrm.org/jira/browse/CRM-12647 --- CRM/Utils/Migrate/Export.php | 17 ++++++++++++++--- bin/migrate/export.php | 4 ++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CRM/Utils/Migrate/Export.php b/CRM/Utils/Migrate/Export.php index 6d60fb4bda..a3e5edd1b8 100644 --- a/CRM/Utils/Migrate/Export.php +++ b/CRM/Utils/Migrate/Export.php @@ -118,7 +118,12 @@ class CRM_Utils_Migrate_Export { ); } - function run() { + /** + * Scan local customizations and build an in-memory representation + * + * @return void + */ + function build() { // fetch the option group / values for // activity type and event_type @@ -280,7 +285,14 @@ AND entity_id IS NULL array('relationshipType', 'relationship_type_id', 'relationship_type_name'), ) ); + } + /** + * Render the in-memory representation as XML + * + * @return string XML + */ + function toXML() { $buffer = ''; $buffer .= "\n\n\n"; foreach (array_keys($this->_xml) as $key) { @@ -292,8 +304,7 @@ AND entity_id IS NULL } } $buffer .= "\n"; - - CRM_Utils_System::download('CustomGroupData.xml', 'text/plain', $buffer); + return $buffer; } function fetch($groupName, $daoName, $sql = NULL, $map = NULL, $add = NULL) { diff --git a/bin/migrate/export.php b/bin/migrate/export.php index 4511499c5f..fc4076120e 100644 --- a/bin/migrate/export.php +++ b/bin/migrate/export.php @@ -44,8 +44,8 @@ function run() { require_once 'CRM/Utils/Migrate/Export.php'; $export = new CRM_Utils_Migrate_Export(); - - $export->run(); + $export->build(); + CRM_Utils_System::download('CustomGroupData.xml', 'text/plain', $export->toXML()); } run(); -- 2.25.1