Update to Drupal 8.2.2. For more information, see https://www.drupal.org/project/drupal/releases/8.2.2
This commit is contained in:
parent
23ffed3665
commit
507b45a0ed
378 changed files with 11434 additions and 5542 deletions
|
|
@ -416,6 +416,9 @@ class User extends ContentEntityBase implements UserInterface {
|
|||
static::$anonymousUser = new $class([
|
||||
'uid' => [LanguageInterface::LANGCODE_DEFAULT => 0],
|
||||
'name' => [LanguageInterface::LANGCODE_DEFAULT => ''],
|
||||
// Explicitly set the langcode to ensure that field definitions do not
|
||||
// need to be fetched to figure out a default.
|
||||
'langcode' => [LanguageInterface::LANGCODE_DEFAULT => LanguageInterface::LANGCODE_NOT_SPECIFIED]
|
||||
], $entity_type->id());
|
||||
}
|
||||
return clone static::$anonymousUser;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\user\Plugin\migrate\process;
|
||||
|
||||
use Drupal\Core\Language\LanguageManager;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\ProcessPluginBase;
|
||||
use Drupal\migrate\Row;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides a process plugin for the user langcode.
|
||||
*
|
||||
* @MigrateProcessPlugin(
|
||||
* id = "user_langcode"
|
||||
* )
|
||||
*/
|
||||
class UserLangcode extends ProcessPluginBase implements ContainerFactoryPluginInterface {
|
||||
|
||||
/**
|
||||
* The language manager.
|
||||
*
|
||||
* @var \Drupal\Core\Language\LanguageManager
|
||||
*/
|
||||
protected $languageManager;
|
||||
|
||||
/**
|
||||
* Constructs a UserLangcode object.
|
||||
*
|
||||
* @param array $configuration
|
||||
* Plugin configuration.
|
||||
* @param string $plugin_id
|
||||
* The plugin ID.
|
||||
* @param mixed $plugin_definition
|
||||
* The plugin definiiton.
|
||||
* @param \Drupal\Core\Language\LanguageManager $language_manager
|
||||
* The language manager service.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, LanguageManager $language_manager) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
$this->languageManager = $language_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
|
||||
return new static(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('language_manager')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
if (!isset($this->configuration['fallback_to_site_default'])) {
|
||||
$this->configuration['fallback_to_site_default'] = TRUE;
|
||||
}
|
||||
|
||||
// If the user's language is empty, it means the locale module was not
|
||||
// installed, so the user's langcode should be English and the user's
|
||||
// preferred_langcode and preferred_admin_langcode should fallback to the
|
||||
// default language.
|
||||
if (empty($value)) {
|
||||
if ($this->configuration['fallback_to_site_default']) {
|
||||
return $this->languageManager->getDefaultLanguage()->getId();
|
||||
}
|
||||
else {
|
||||
return 'en';
|
||||
}
|
||||
}
|
||||
// If the user's language does not exists, use the default language.
|
||||
elseif ($this->languageManager->getLanguage($value) === NULL) {
|
||||
return $this->languageManager->getDefaultLanguage()->getId();
|
||||
}
|
||||
|
||||
// If the langcode is a valid one, just return it.
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ class ProfileFieldValues extends DrupalSqlBase {
|
|||
public function query() {
|
||||
$query = $this->select('profile_values', 'pv')
|
||||
->distinct()
|
||||
->fields('pv', array('fid', 'uid'));
|
||||
->fields('pv', array('uid'));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,15 @@ class Role extends DrupalSqlBase {
|
|||
->condition('rid', $rid)
|
||||
->execute()
|
||||
->fetchField();
|
||||
$row->setSourceProperty('permissions', explode(', ', $permissions));
|
||||
|
||||
// If a role has no permissions then set to an empty array. The role will
|
||||
// be migrated and given the default D8 permissions.
|
||||
if ($permissions) {
|
||||
$row->setSourceProperty('permissions', explode(', ', $permissions));
|
||||
}
|
||||
else {
|
||||
$row->setSourceProperty('permissions', []);
|
||||
}
|
||||
if (isset($this->filterPermissions[$rid])) {
|
||||
$row->setSourceProperty("filter_permissions:$rid", $this->filterPermissions[$rid]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ class User extends DrupalSqlBase {
|
|||
'name' => $this->t('Username'),
|
||||
'pass' => $this->t('Password'),
|
||||
'mail' => $this->t('Email address'),
|
||||
'theme' => $this->t('Theme'),
|
||||
'signature' => $this->t('Signature'),
|
||||
'signature_format' => $this->t('Signature format'),
|
||||
'created' => $this->t('Registered timestamp'),
|
||||
|
|
|
|||
Reference in a new issue