From 00f2800895ce4744038223e81002379f2dd8aa7e Mon Sep 17 00:00:00 2001 From: Jesse Hofmann-Smith Date: Thu, 23 Jan 2014 19:01:14 -0800 Subject: [PATCH] updated CommentVariable.php to use dbtng instead of direct queries --- .../Plugin/migrate/source/d6/CommentVariable.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CommentVariable.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CommentVariable.php index 97650f3..08b3880 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CommentVariable.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CommentVariable.php @@ -34,19 +34,26 @@ public function count() { protected function getCommentVariables() { $comment_prefixes = array_keys($this->commentPrefixes()); $variables = array(); - $node_types = $this->getDatabase()->query('SELECT type FROM {node_type}')->fetchCol(); + $node_types = $this->getDatabase()->select('node_type', 'nt')->fields('nt', array('type'))->execute(); foreach ($node_types as $node_type) { foreach ($comment_prefixes as $prefix) { - $variables[] = $prefix . '_' . $node_type; + $variables[] = $prefix . '_' . $node_type['type']; } } $return = array(); - $values = $this->getDatabase()->query('SELECT name, value FROM {variable} WHERE name IN (:name)', array(':name' => $variables))->fetchAllKeyed(); + $values_arrays = $this->getDatabase()->select('variable', 'v') + ->fields('v', array('name', 'value')) + ->condition('name', $variables, 'IN') + ->execute(); + // This is a non-keyed array. Make it an array keyed by variable name. + foreach ($values_arrays as $value) { + $values[$value['name']] = $value['value']; + } foreach ($node_types as $node_type) { foreach ($comment_prefixes as $prefix) { - $name = $prefix . '_' . $node_type; + $name = $prefix . '_' . $node_type['type']; if (isset($values[$name])) { - $return[$node_type][$prefix] = unserialize($values[$name]); + $return[$node_type['type']][$prefix] = unserialize($values[$name]); } } } -- 1.8.3.4 (Apple Git-47)