/** * {@inheritdoc} */ public function prepareRow(Row $row) { $vocab = $row->getSourceProperty('taxonomy'); $label = $vocab == 'category' ? 'Category' : 'Post Tags'; $row->setSourceProperty('label', $label); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // User roles. $roles = $this->select('users_roles', 'ur') ->fields('ur', array('rid')) ->condition('ur.uid', $row->getSourceProperty('uid')) ->execute() ->fetchCol(); $row->setSourceProperty('roles', $roles); // We are adding here the Event contributed module column. // @see https://api.drupal.org/api/drupal/modules%21user%21user.install/function/user_update_7002/7 if ($row->hasSourceProperty('timezone_id') && $row->getSourceProperty('timezone_id')) { if ($this->getDatabase()->schema()->tableExists('event_timezones')) { $event_timezone = $this->select('event_timezones', 'e') ->fields('e', array('name')) ->condition('e.timezone', $row->getSourceProperty('timezone_id')) ->execute() ->fetchField(); if ($event_timezone) { $row->setSourceProperty('event_timezone', $event_timezone); } } } // Unserialize Data. $row->setSourceProperty('data', unserialize($row->getSourceProperty('data'))); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $row->setSourceProperty('filename', basename($row->getSourceProperty('picture'))); $row->setSourceProperty('file_directory_path', $this->filePath); $row->setSourceProperty('temp_directory_path', $this->tempFilePath); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { if ($value = $row->getSourceProperty('value')) { $row->setSourceProperty('value', unserialize($value)); } return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $row->setSourceProperty('options', unserialize($row->getSourceProperty('options'))); $row->setSourceProperty('enabled', !$row->getSourceProperty('hidden')); $row->setSourceProperty('description', Unicode::truncate($row->getSourceProperty('options/attributes/title'), 255)); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // Select all related tickets (rnid) to the current ticket (nid) $query = $this->select('support_reference', 'sr')->fields('sr', array('rnid'))->condition('sr.nid', $row->getSourceProperty('nid')); $row->setSourceProperty('rnid', $query->execute()->fetchCol()); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // Find profile values for this row. $query = $this->select('profile_values', 'pv') ->fields('pv', array('fid', 'value')); $query->leftJoin('profile_fields', 'pf', 'pf.fid=pv.fid'); $query->fields('pf', array('name', 'type')); $query->condition('uid', $row->getSourceProperty('uid')); $results = $query->execute(); foreach ($results as $profile_value) { // Check special case for date. We need to unserialize. if ($profile_value['type'] == 'date') { $date = unserialize($profile_value['value']); $date = date('Y-m-d', mktime(0, 0, 0, $date['month'], $date['day'], $date['year'])); $row->setSourceProperty($profile_value['name'], array('value' => $date)); } elseif ($profile_value['type'] == 'list') { // Explode by newline and comma. $row->setSourceProperty($profile_value['name'], preg_split("/[\r\n,]+/", $profile_value['value'])); } else { $row->setSourceProperty($profile_value['name'], array($profile_value['value'])); } } return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $row->setSourceProperty('file_directory_path', $this->filePath); $row->setSourceProperty('temp_directory_path', $this->tempFilePath); $row->setSourceProperty('is_public', $this->isPublic); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $post_type = $row->getSourceProperty('post_type'); $type = $post_type == 'page' ? 'page' : 'article'; $row->setSourceProperty('type', $type); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $type = $row->getSourceProperty('type'); $row->setSourceProperty('language_content_type', $this->variableGet('language_content_type_' . $type, NULL)); $row->setSourceProperty('i18n_lock_node', $this->variableGet('i18n_lock_node_' . $type, 0)); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $filters = array(); $roles = $row->getSourceProperty('roles'); $row->setSourceProperty('roles', array_values(array_filter(explode(',', $roles)))); $format = $row->getSourceProperty('format'); // Find filters for this row. $results = $this->select('filters', 'f')->fields('f', array('module', 'delta', 'weight'))->condition('format', $format)->execute(); foreach ($results as $raw_filter) { $module = $raw_filter['module']; $delta = $raw_filter['delta']; $filter = array('module' => $module, 'delta' => $delta, 'weight' => $raw_filter['weight'], 'settings' => array()); // Load the filter settings for the filter module, modules can use // hook_migration_d6_filter_formats_prepare_row() to add theirs. if ($raw_filter['module'] == 'filter') { if (!$delta) { if ($setting = $this->variableGet("allowed_html_{$format}", NULL)) { $filter['settings']['allowed_html'] = $setting; } if ($setting = $this->variableGet("filter_html_help_{$format}", NULL)) { $filter['settings']['filter_html_help'] = $setting; } if ($setting = $this->variableGet("filter_html_nofollow_{$format}", NULL)) { $filter['settings']['filter_html_nofollow'] = $setting; } } elseif ($delta == 2 && ($setting = $this->variableGet("filter_url_length_{$format}", NULL))) { $filter['settings']['filter_url_length'] = $setting; } } $filters[] = $filter; } $row->setSourceProperty('filters', $filters); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $data = unserialize($row->getSourceProperty('data')); $row->setSourceProperty('widget', $data['widget']); $row->setSourceProperty('widget_settings', $data['widget']['settings']); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $row->setSourceProperty('teaser_length', $this->teaserLength); $row->setSourceProperty('node_preview', $this->nodePreview); $type = $row->getSourceProperty('type'); $source_options = $this->variableGet('node_options_' . $type, array('promote', 'sticky')); $options = array(); foreach (array('promote', 'sticky', 'status', 'revision') as $item) { $options[$item] = in_array($item, $source_options); } $row->setSourceProperty('options', $options); // Don't create a body field until we prove that this node type has one. $row->setSourceProperty('create_body', FALSE); if ($this->moduleExists('field')) { // Find body field for this node type. $body = $this->select('field_config_instance', 'fci')->fields('fci', array('data'))->condition('entity_type', 'node')->condition('bundle', $row->getSourceProperty('type'))->condition('field_name', 'body')->execute()->fetchAssoc(); if ($body) { $row->setSourceProperty('create_body', TRUE); $body['data'] = unserialize($body['data']); $row->setSourceProperty('body_label', $body['data']['label']); } } $row->setSourceProperty('display_submitted', $this->variableGet('node_submitted_' . $type, TRUE)); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // Find parents for this row. $parents = $this->select('term_hierarchy', 'th')->fields('th', array('parent', 'tid'))->condition('tid', $row->getSourceProperty('tid'))->execute()->fetchCol(); $row->setSourceProperty('parent', $parents); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row, $keep = TRUE) { foreach (unserialize($row->getSourceProperty('data')) as $key => $value) { $row->setSourceProperty($key, $value); } return parent::prepareRow($row); }
/** * {@inheritdoc} */ protected function initializeIterator() { $this->publicPath = $this->variableGet('file_public_path', 'sites/default/files'); $this->privatePath = $this->variableGet('file_private_path', NULL); $this->temporaryPath = $this->variableGet('file_temporary_path', '/tmp'); return parent::initializeIterator(); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $query = $this->select('upload', 'u')->fields('u', array('fid', 'description', 'list'))->condition('u.nid', $row->getSourceProperty('nid'))->orderBy('u.weight'); $query->innerJoin('node', 'n', static::JOIN); $row->setSourceProperty('upload', $query->execute()->fetchAll()); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // Find node types for this row. $node_types = $this->select('vocabulary_node_types', 'nt')->fields('nt', array('type', 'vid'))->condition('vid', $row->getSourceProperty('vid'))->execute()->fetchCol(); $row->setSourceProperty('node_types', $node_types); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { parent::prepareRow($row); $status = $row->getSourceProperty('status'); $nid = $row->getSourceProperty('nid'); $row->setSourceProperty('identifier', 'node/' . $nid); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // Find node types for this row. $node_types = $this->select('vocabulary_node_types', 'nt')->fields('nt', array('type', 'vid'))->condition('vid', $row->getSourceProperty('vid'))->execute()->fetchCol(); $row->setSourceProperty('node_types', $node_types); $row->setSourceProperty('cardinality', $row->getSourceProperty('tags') == 1 || $row->getSourceProperty('multiple') == 1 ? FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED : 1); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // format = 0 can happen when the body field is hidden. Set the format to 1 // to avoid migration map issues (since the body field isn't used anyway). if ($row->getSourceProperty('format') === '0') { $row->setSourceProperty('format', $this->filterDefaultFormat); } return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // Select the terms belonging to the revision selected. $query = $this->select('term_node', 'tn')->fields('tn', array('tid'))->condition('n.nid', $row->getSourceProperty('nid')); $query->join('node', 'n', static::JOIN); $query->innerJoin('term_data', 'td', 'td.tid = tn.tid AND td.vid = :vid', array(':vid' => $this->configuration['vid'])); $row->setSourceProperty('tid', $query->execute()->fetchCol()); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // Find parents for this row. $query = $this->select('wp_term_taxonomy', 'wptt')->fields('wptt', array('parent', 'term_id', 'taxonomy', 'description'))->condition('term_id', $row->getSourceProperty('term_id'))->execute()->fetchAssoc(); $row->setSourceProperty('parent', $query['parent']); $row->setSourceProperty('description', $query['description']); $row->setSourceProperty('vid', $query['taxonomy']); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $rid = $row->getSourceProperty('rid'); $permissions = $this->select('permission', 'p')->fields('p', array('perm'))->condition('rid', $rid)->execute()->fetchField(); $row->setSourceProperty('permissions', explode(', ', $permissions)); if (isset($this->filterPermissions[$rid])) { $row->setSourceProperty("filter_permissions:{$rid}", $this->filterPermissions[$rid]); } return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // Find filters for this format. $filters = $this->select('filter', 'f')->fields('f')->condition('format', $row->getSourceProperty('format'))->condition('status', 1)->execute()->fetchAllAssoc('name'); foreach ($filters as $id => $filter) { $filters[$id]['settings'] = unserialize($filter['settings']); } $row->setSourceProperty('filters', $filters); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $effects = array(); $results = $this->select('image_effects', 'ie')->fields('ie')->condition('isid', $row->getSourceProperty('isid'))->execute(); foreach ($results as $key => $result) { $result['data'] = unserialize($result['data']); $effects[$key] = $result; } $row->setSourceProperty('effects', $effects); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // Unserialize data. $widget_settings = unserialize($row->getSourceProperty('widget_settings')); $display_settings = unserialize($row->getSourceProperty('display_settings')); $global_settings = unserialize($row->getSourceProperty('global_settings')); $row->setSourceProperty('widget_settings', $widget_settings); $row->setSourceProperty('display_settings', $display_settings); $row->setSourceProperty('global_settings', $global_settings); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row, $keep = TRUE) { // Unserialize data. $global_settings = unserialize($row->getSourceProperty('global_settings')); $widget_settings = unserialize($row->getSourceProperty('widget_settings')); $db_columns = unserialize($row->getSourceProperty('db_columns')); $row->setSourceProperty('global_settings', $global_settings); $row->setSourceProperty('widget_settings', $widget_settings); $row->setSourceProperty('db_columns', $db_columns); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $actions = array(); $results = $this->select('imagecache_action', 'ica')->fields('ica')->condition('presetid', $row->getSourceProperty('presetid'))->execute(); foreach ($results as $key => $result) { $actions[$key] = $result; $actions[$key]['data'] = unserialize($result['data']); } $row->setSourceProperty('actions', $actions); return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // Compute the filepath property, which is a physical representation of // the URI relative to the Drupal root. $path = str_replace(['public:/', 'private:/', 'temporary:/'], [$this->publicPath, $this->privatePath, $this->temporaryPath], $row->getSourceProperty('uri')); // At this point, $path could be an absolute path or a relative path, // depending on how the scheme's variable was set. So we need to shear out // the source_base_path in order to make them all relative. $path = str_replace($this->migration->get('destination.source_base_path'), NULL, $path); $row->setSourceProperty('filepath', $path); return parent::prepareRow($row); }