Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542

This commit is contained in:
Pantheon Automation 2015-08-27 12:03:05 -07:00 committed by Greg Anderson
parent 3b2511d96d
commit 81ccda77eb
2155 changed files with 54307 additions and 46870 deletions

View file

@ -70,20 +70,4 @@ class MigratePluginManager extends DefaultPluginManager {
return $plugin;
}
/**
* Helper for the plugin type to interface map.
*
* @return array
* An array map from plugin type to interface.
*/
protected function getPluginInterfaceMap() {
return [
'destination' => 'Drupal\migrate\Plugin\MigrateDestinationInterface',
'process' => 'Drupal\migrate\Plugin\MigrateProcessInterface',
'source' => 'Drupal\migrate\Plugin\MigrateSourceInterface',
'id_map' => 'Drupal\migrate\Plugin\MigrateIdMapInterface',
'entity_field' => 'Drupal\migrate\Plugin\MigrateEntityDestinationFieldInterface',
];
}
}

View file

@ -1,35 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\migrate\Plugin\migrate\destination\Book.
*/
namespace Drupal\migrate\Plugin\migrate\destination;
use Drupal\Core\Entity\EntityInterface;
use Drupal\migrate\Row;
/**
* @MigrateDestination(
* id = "book",
* provider = "book"
* )
*/
class Book extends EntityContentBase {
/**
* {@inheritdoc}
*/
protected static function getEntityTypeId($plugin_id) {
return 'node';
}
/**
* {@inheritdoc}
*/
protected function updateEntity(EntityInterface $entity, Row $row) {
$entity->book = $row->getDestinationProperty('book');
}
}

View file

@ -7,7 +7,6 @@
namespace Drupal\migrate\Plugin\migrate\destination;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\File\FileSystemInterface;
@ -83,7 +82,7 @@ class EntityFile extends EntityContentBase {
// Ensure the source file exists, if it's a local URI or path.
if ($this->isLocalUri($source) && !file_exists($source)) {
throw new MigrateException(SafeMarkup::format('File @source does not exist.', ['@source' => $source]));
throw new MigrateException("File '$source' does not exist.");
}
// If the start and end file is exactly the same, there is nothing to do.
@ -99,7 +98,7 @@ class EntityFile extends EntityContentBase {
$success = $this->writeFile($source, $destination, $replace);
}
else {
throw new MigrateException(SafeMarkup::format('Could not create directory @dir', ['@dir' => $dir]));
throw new MigrateException("Could not create directory '$dir'");
}
}
@ -107,7 +106,7 @@ class EntityFile extends EntityContentBase {
return parent::import($row, $old_destination_id_values);
}
else {
throw new MigrateException(SafeMarkup::format('File %source could not be copied to %destination.', ['%source' => $source, '%destination' => $destination]));
throw new MigrateException("File $source could not be copied to $destination.");
}
}
@ -121,7 +120,7 @@ class EntityFile extends EntityContentBase {
* @param integer $replace
* FILE_EXISTS_REPLACE (default) or FILE_EXISTS_RENAME.
*
* @return boolean
* @return bool
* TRUE on success, FALSE on failure.
*/
protected function writeFile($source, $destination, $replace = FILE_EXISTS_REPLACE) {
@ -164,7 +163,7 @@ class EntityFile extends EntityContentBase {
* @param string $uri
* The URI or path.
*
* @return boolean|string
* @return string|false
* The directory component of the path or URI, or FALSE if it could not
* be determined.
*/
@ -187,7 +186,7 @@ class EntityFile extends EntityContentBase {
* @param string $destination
* The destination URI.
*
* @return boolean
* @return bool
* TRUE if the source and destination URIs refer to the same physical path,
* otherwise FALSE.
*/
@ -210,7 +209,7 @@ class EntityFile extends EntityContentBase {
* @param string $uri
* The URI or path to test.
*
* @return boolean
* @return bool
*/
protected function isLocalUri($uri) {
$scheme = $this->fileSystem->uriScheme($uri);

View file

@ -1,33 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\migrate\Plugin\migrate\destination\EntitySearchPage.
*/
namespace Drupal\migrate\Plugin\migrate\destination;
use Drupal\Core\Entity\EntityInterface;
use Drupal\migrate\Row;
/**
* @MigrateDestination(
* id = "entity:search_page"
* )
*/
class EntitySearchPage extends EntityConfigBase {
/**
* Updates the entity with the contents of a row.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The search page entity.
* @param \Drupal\migrate\Row $row
* The row object to update from.
*/
protected function updateEntity(EntityInterface $entity, Row $row) {
$entity->setPlugin($row->getDestinationProperty('plugin'));
$entity->getPlugin()->setConfiguration($row->getDestinationProperty('configuration'));
}
}

View file

@ -1,29 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\migrate\Plugin\migrate\destination\EntityTaxonomyTerm.
*/
namespace Drupal\migrate\Plugin\migrate\destination;
use Drupal\migrate\Row;
/**
* @MigrateDestination(
* id = "entity:taxonomy_term"
* )
*/
class EntityTaxonomyTerm extends EntityContentBase {
/**
* {@inheritdoc}
*/
protected function getEntity(Row $row, array $old_destination_id_values) {
if ($row->isStub()) {
$row->setDestinationProperty('name', $this->t('Stub name for source tid:') . $row->getSourceProperty('tid'));
}
return parent::getEntity($row, $old_destination_id_values);
}
}

View file

@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\migrate\Plugin\migrate\destination\Null.
* Contains \Drupal\migrate\Plugin\migrate\destination\NullDestination.
*/
namespace Drupal\migrate\Plugin\migrate\destination;
@ -16,7 +16,7 @@ use Drupal\migrate\Row;
* requirements_met = false
* )
*/
class Null extends DestinationBase {
class NullDestination extends DestinationBase {
/**
* {@inheritdoc}

View file

@ -1,97 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\migrate\Plugin\migrate\destination\UrlAlias.
*/
namespace Drupal\migrate\Plugin\migrate\destination;
use Drupal\Core\Path\AliasStorage;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Row;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
/**
* @MigrateDestination(
* id = "url_alias"
* )
*/
class UrlAlias extends DestinationBase implements ContainerFactoryPluginInterface {
/**
* The alias storage service.
*
* @var \Drupal\Core\Path\AliasStorage $aliasStorage
*/
protected $aliasStorage;
/**
* Constructs an entity destination plugin.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param MigrationInterface $migration
* The migration.
* @param \Drupal\Core\Path\AliasStorage $alias_storage
* The alias storage service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, AliasStorage $alias_storage) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
$this->aliasStorage = $alias_storage;
}
/**
* {@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,
$container->get('path.alias_storage')
);
}
/**
* {@inheritdoc}
*/
public function import(Row $row, array $old_destination_id_values = array()) {
$path = $this->aliasStorage->save(
$row->getDestinationProperty('source'),
$row->getDestinationProperty('alias'),
$row->getDestinationProperty('langcode'),
$old_destination_id_values ? $old_destination_id_values[0] : NULL
);
return array($path['pid']);
}
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['pid']['type'] = 'integer';
return $ids;
}
/**
* {@inheritdoc}
*/
public function fields(MigrationInterface $migration = NULL) {
return [
'pid' => 'The path id',
'source' => 'The source path.',
'alias' => 'The url alias.',
'langcode' => 'The language code for the url.',
];
}
}

View file

@ -7,7 +7,6 @@
namespace Drupal\migrate\Plugin\migrate\process;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\migrate\MigrateException;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
@ -34,7 +33,7 @@ class Concat extends ProcessPluginBase {
return implode($delimiter, $value);
}
else {
throw new MigrateException(sprintf('%s is not an array', SafeMarkup::checkPlain(var_export($value, TRUE))));
throw new MigrateException(sprintf('%s is not an array', var_export($value, TRUE)));
}
}

View file

@ -0,0 +1,29 @@
<?php
/**
* @file
* Contains \Drupal\migrate\Plugin\migrate\source\DummyQueryTrait.
*/
namespace Drupal\migrate\Plugin\migrate\source;
/**
* Trait providing a dummy select query object for source plugins based on
* SqlBase which override initializeIterator() to obtain their data from other
* SqlBase services instead of a direct query. This ensures that query() returns
* a valid object, even though it isn't used for iteration.
*/
trait DummyQueryTrait {
/**
* @return \Drupal\Core\Database\Query\SelectInterface
*/
public function query() {
// Pass an arbritrary table name - the query should never be executed anyway.
$query = $this->select(uniqid(), 's')
->range(0, 1);
$query->addExpression('1');
return $query;
}
}