diff -u b/core/modules/file/src/Plugin/migrate/process/d6/CckFile.php b/core/modules/file/src/Plugin/migrate/process/d6/CckFile.php --- b/core/modules/file/src/Plugin/migrate/process/d6/CckFile.php +++ b/core/modules/file/src/Plugin/migrate/process/d6/CckFile.php @@ -10 +10 @@ -class CckFile extends FieldFile {} \ No newline at end of file +class CckFile extends FieldFile {} diff -u b/core/modules/file/src/Plugin/migrate/process/d6/FieldFile.php b/core/modules/file/src/Plugin/migrate/process/d6/CckFile.php --- b/core/modules/file/src/Plugin/migrate/process/d6/FieldFile.php +++ b/core/modules/file/src/Plugin/migrate/process/d6/CckFile.php @@ -5,100 +5,6 @@ -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\migrate\Plugin\MigrationInterface; -use Drupal\migrate\MigrateExecutableInterface; -use Drupal\migrate\MigrateSkipRowException; -use Drupal\migrate\Plugin\MigrateProcessInterface; -use Drupal\migrate\ProcessPluginBase; -use Drupal\migrate\Row; -use Symfony\Component\DependencyInjection\ContainerInterface; - /** * @MigrateProcessPlugin( - * id = "d6_field_file" + * id = "d6_cck_file" * ) */ -class FieldFile extends ProcessPluginBase implements ContainerFactoryPluginInterface { - - /** - * The migration process plugin, configured for lookups in d6_file. - * - * @var \Drupal\migrate\Plugin\MigrateProcessInterface - */ - protected $migrationPlugin; - - /** - * Constructs a FieldFile plugin instance. - * - * @param array $configuration - * The plugin configuration. - * @param string $plugin_id - * The plugin ID. - * @param mixed $plugin_definition - * The plugin definition. - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * The current migration. - * @param \Drupal\migrate\Plugin\MigrateProcessInterface $migration_plugin - * An instance of the 'migration' process plugin. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, MigrateProcessInterface $migration_plugin) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->migration = $migration; - $this->migrationPlugin = $migration_plugin; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { - // Configure the migration process plugin to look up migrated IDs from - // a d6 file migration. - $migration_plugin_configuration = $configuration + [ - 'migration' => 'd6_file', - 'source' => ['fid'], - ]; - - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $migration, - $container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_plugin_configuration, $migration) - ); - } - - /** - * {@inheritdoc} - */ - public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - $options = unserialize($value['data']); - - // Try to look up the ID of the migrated file. If one cannot be found, it - // means the file referenced by the current field item did not migrate for - // some reason -- file migration is notoriously brittle -- and we do NOT - // want to send invalid file references into the field system (it causes - // fatals), so return an empty item instead. - try { - $fid = $this->migrationPlugin->transform($value['fid'], $migrate_executable, $row, $destination_property); - } - // If the migration plugin completely fails its lookup process, it will - // throw a MigrateSkipRowException. It shouldn't, but that is being dealt - // with at https://www.drupal.org/node/2487568. Until that lands, return - // an empty item. - catch (MigrateSkipRowException $e) { - return []; - } - - if ($fid) { - return [ - 'target_id' => $fid, - 'display' => $value['list'], - 'description' => isset($options['description']) ? $options['description'] : '', - 'alt' => isset($options['alt']) ? $options['alt'] : '', - 'title' => isset($options['title']) ? $options['title'] : '', - ]; - } - else { - return []; - } - } - -} +class CckFile extends FieldFile {} diff -u b/core/modules/link/src/Plugin/migrate/process/d6/FieldLink.php b/core/modules/link/src/Plugin/migrate/process/d6/CckLink.php --- b/core/modules/link/src/Plugin/migrate/process/d6/FieldLink.php +++ b/core/modules/link/src/Plugin/migrate/process/d6/CckLink.php @@ -5,82 +5,9 @@ -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\migrate\Plugin\MigrationInterface; -use Drupal\migrate\MigrateExecutableInterface; -use Drupal\migrate\ProcessPluginBase; -use Drupal\migrate\Row; -use Symfony\Component\DependencyInjection\ContainerInterface; - /** + * @deprecated in Drupal 8.2.x and will be removed before Drupal 9.0.x. Use the + * d6_field_link plugin instead. + * * @MigrateProcessPlugin( - * id = "d6_field_link" + * id = "d6_cck_link" * ) */ -class FieldLink extends ProcessPluginBase implements ContainerFactoryPluginInterface { - - /** - * {@inheritdoc} - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->migration = $migration; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $migration - ); - } - - /** - * Turn a Drupal 6 URI into a Drupal 8-compatible format. - * - * @param string $uri - * The 'url' value from Drupal 6. - * - * @return string - * The Drupal 8-compatible URI. - * - * @see \Drupal\link\Plugin\Field\FieldWidget\LinkWidget::getUserEnteredStringAsUri() - */ - protected function canonicalizeUri($uri) { - // If we already have a scheme, we're fine. - if (empty($uri) || !is_null(parse_url($uri, PHP_URL_SCHEME))) { - return $uri; - } - - // Remove the component of the URL. - if (strpos($uri, '') === 0) { - $uri = substr($uri, strlen('')); - } - - // Add the internal: scheme and ensure a leading slash. - return 'internal:/' . ltrim($uri, '/'); - } - - /** - * {@inheritdoc} - */ - public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - $attributes = unserialize($value['attributes']); - // Drupal 6 link attributes might be double serialized. - if (!is_array($attributes)) { - $attributes = unserialize($attributes); - } - - if (!$attributes) { - $attributes = []; - } - - // Massage the values into the correct form for the link. - $route['uri'] = $this->canonicalizeUri($value['url']); - $route['options']['attributes'] = $attributes; - $route['title'] = $value['title']; - return $route; - } - -} +class CckLink extends FieldLink { } diff -u b/core/modules/migrate_drupal/src/Plugin/MigrateCckFieldInterface.php b/core/modules/migrate_drupal/src/Plugin/MigrateCckFieldInterface.php --- b/core/modules/migrate_drupal/src/Plugin/MigrateCckFieldInterface.php +++ b/core/modules/migrate_drupal/src/Plugin/MigrateCckFieldInterface.php @@ -4,7 +4,7 @@ /** - * Provides an interface for all field type plugins. + * Provides an interface for all CCK field type plugins. * * @deprecated in Drupal 8.2.x, to be removed before Drupal 9.0.x. Use * \Drupal\migrate_drupal\Annotation\MigrateField instead. diff -u b/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php b/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php --- b/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php +++ b/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php @@ -7,7 +7,7 @@ use Drupal\migrate\Plugin\MigrationInterface; /** - * Plugin manager for migrate field plugins. + * Plugin manager for migrate cckfield plugins. * * @see \Drupal\migrate_drupal\Plugin\MigrateFieldInterface * @see \Drupal\migrate\Annotation\MigrateField diff -u b/core/modules/migrate_drupal/src/Plugin/migrate/CckMigration.php b/core/modules/migrate_drupal/src/Plugin/migrate/CckMigration.php --- b/core/modules/migrate_drupal/src/Plugin/migrate/CckMigration.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/CckMigration.php @@ -3,7 +3,7 @@ namespace Drupal\migrate_drupal\Plugin\migrate; /** - * Migration plugin class for migrations dealing with field values. + * Migration plugin class for migrations dealing with CCK field values. * * @deprecated in Drupal 8.2.x, to be removed before Drupal 9.0.x. Use * \Drupal\migrate_drupal\Plugin\migrate\FieldMigration instead. diff -u b/core/modules/migrate_drupal/src/Plugin/migrate/FieldMigration.php b/core/modules/migrate_drupal/src/Plugin/migrate/CckMigration.php --- b/core/modules/migrate_drupal/src/Plugin/migrate/FieldMigration.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/CckMigration.php @@ -3,142 +3,16 @@ namespace Drupal\migrate_drupal\Plugin\migrate; -use Drupal\Component\Plugin\Exception\PluginNotFoundException; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\migrate\Exception\RequirementsException; -use Drupal\migrate\Plugin\MigrateDestinationPluginManager; -use Drupal\migrate\Plugin\MigratePluginManager; -use Drupal\migrate\Plugin\Migration; -use Drupal\migrate\Plugin\MigrationPluginManagerInterface; -use Drupal\migrate\Plugin\RequirementsInterface; -use Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - /** - * Migration plugin class for migrations dealing with field config and values. + * Migration plugin class for migrations dealing with CCK field values. + * + * @deprecated in Drupal 8.2.x, to be removed before Drupal 9.0.x. Use + * \Drupal\migrate_drupal\Plugin\migrate\FieldMigration instead. */ -class FieldMigration extends Migration implements ContainerFactoryPluginInterface { - - /** - * Defines which configuration option has the migration processing function. - * - * Default method is 'field_plugin_method'. For backwards compatibility, - * this constant is overridden in the CckMigration class, in order to - * fallback to the old 'cck_plugin_method'. - * - * @const string - */ - const PLUGIN_METHOD = 'field_plugin_method'; - - /** - * Flag indicating whether the field data has been filled already. - * - * @var bool - */ - protected $init = FALSE; - - /** - * List of field plugin IDs which have already run. - * - * @var string[] - */ - protected $processedFieldTypes = []; - - /** - * Already-instantiated field plugins, keyed by ID. - * - * @var \Drupal\migrate_drupal\Plugin\MigrateFieldInterface[] - */ - protected $fieldPluginCache; - - /** - * The field plugin manager. - * - * @var \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface - */ - protected $fieldPluginManager; - - /** - * Constructs a FieldMigration. - * - * @param array $configuration - * Plugin configuration. - * @param string $plugin_id - * The plugin ID. - * @param mixed $plugin_definition - * The plugin definition. - * @param \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface $field_manager - * The field plugin manager. - * @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager - * The migration plugin manager. - * @param \Drupal\migrate\Plugin\MigratePluginManager $source_plugin_manager - * The source migration plugin manager. - * @param \Drupal\migrate\Plugin\MigratePluginManager $process_plugin_manager - * The process migration plugin manager. - * @param \Drupal\migrate\Plugin\MigrateDestinationPluginManager $destination_plugin_manager - * The destination migration plugin manager. - * @param \Drupal\migrate\Plugin\MigratePluginManager $idmap_plugin_manager - * The ID map migration plugin manager. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateFieldPluginManagerInterface $field_manager, MigrationPluginManagerInterface $migration_plugin_manager, MigratePluginManager $source_plugin_manager, MigratePluginManager $process_plugin_manager, MigrateDestinationPluginManager $destination_plugin_manager, MigratePluginManager $idmap_plugin_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration_plugin_manager, $source_plugin_manager, $process_plugin_manager, $destination_plugin_manager, $idmap_plugin_manager); - $this->fieldPluginManager = $field_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('plugin.manager.migrate.field'), - $container->get('plugin.manager.migration'), - $container->get('plugin.manager.migrate.source'), - $container->get('plugin.manager.migrate.process'), - $container->get('plugin.manager.migrate.destination'), - $container->get('plugin.manager.migrate.id_map') - ); - } +class CckMigration extends FieldMigration { /** * {@inheritdoc} */ - public function getProcess() { - if (!$this->init) { - $this->init = TRUE; - $source_plugin = $this->migrationPluginManager->createInstance($this->pluginId)->getSourcePlugin(); - if ($source_plugin instanceof RequirementsInterface) { - try { - $source_plugin->checkRequirements(); - } - catch (RequirementsException $e) { - // Kill the rest of the method. - $source_plugin = []; - } - } - foreach ($source_plugin as $row) { - $field_type = $row->getSourceProperty('type'); - try { - $plugin_id = $this->fieldPluginManager->getPluginIdFromFieldType($field_type, [], $this); - } - catch (PluginNotFoundException $ex) { - continue; - } - - if (!isset($this->processedFieldTypes[$field_type]) && $this->fieldPluginManager->hasDefinition($plugin_id)) { - $this->processedFieldTypes[$field_type] = TRUE; - // Allow the field plugin to alter the migration as necessary so that - // it knows how to handle fields of this type. - if (!isset($this->fieldPluginCache[$field_type])) { - $this->fieldPluginCache[$field_type] = $this->fieldPluginManager->createInstance($plugin_id, [], $this); - } - $method = $this->pluginDefinition[static::PLUGIN_METHOD]; - call_user_func([$this->fieldPluginCache[$field_type], $method], $this); - } - } - } - return parent::getProcess(); - } + const PLUGIN_METHOD = 'cck_plugin_method'; } reverted: --- b/sites/default/default.settings.php +++ a/sites/default/default.settings.php @@ -144,11 +144,6 @@ * @code * 'prefix' => 'main_', * @endcode - * - * Per-table prefixes are deprecated as of Drupal 8.2, and will be removed in - * Drupal 9.0. After that, only a single prefix for all tables will be - * supported. - * * To provide prefixes for specific tables, set 'prefix' as an array. * The array's keys are the table names and the values are the prefixes. * The 'default' element is mandatory and holds the prefix for any tables