From 0460a7ea5a824a4b16a2c17cc4a4648928ccf1e2 Mon Sep 17 00:00:00 2001
From: damienmckenna <damienmckenna@108450.no-reply.drupal.org>
Date: Thu, 12 Oct 2017 10:59:03 -0400
Subject: [PATCH] Issue #2290707 by DamienMcKenna, mitsuroseba: Fixed setting
 to exclude data from tables reverting to default.

---
 includes/profiles.inc   | 19 +++++++++++++++++++
 includes/sources.db.inc |  2 +-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/includes/profiles.inc b/includes/profiles.inc
index d4bdc32..3e5a029 100644
--- a/includes/profiles.inc
+++ b/includes/profiles.inc
@@ -215,6 +215,25 @@ class backup_migrate_profile extends backup_migrate_item {
   var $title_singular = 'Settings Profile';
 
   /**
+   * Perform a shallow merge of the defaults and the parameters.
+   *
+   * This is needed because otherwise it will *combine* the nested arrays and
+   * make it impossible to deselect database tables from the 'nodata' setting.
+   *
+   * @param array $params
+   */
+  public function __construct(array $params = array()) {
+    $params = (array)$params;
+    $defaults = (array)$this->get_default_values();
+    foreach ($defaults as $key => $val) {
+      if (!isset($params[$key])) {
+        $params[$key] = $val;
+      }
+    }
+    $this->from_array($params);
+  }
+
+  /**
    * This function is not supposed to be called. It is just here to help the po extractor out.
    */
   function strings() {
diff --git a/includes/sources.db.inc b/includes/sources.db.inc
index 3cbc716..413b4f6 100644
--- a/includes/sources.db.inc
+++ b/includes/sources.db.inc
@@ -108,7 +108,7 @@ class backup_migrate_source_db extends backup_migrate_source_remote {
     }
 
     return array(
-      'nodata_tables' => array_merge($basic, $cache, module_invoke_all('devel_caches')),
+      'nodata_tables' => drupal_map_assoc(array_merge($basic, $cache, module_invoke_all('devel_caches'))),
       'exclude_tables' => $simpletest,
       'utils_lock_tables' => FALSE,
     );
-- 
2.13.5 (Apple Git-94)

