Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -26,6 +26,8 @@ class EntityAliasTypeDeriver extends DeriverBase implements ContainerDeriverInte
protected $entityTypeManager;
/**
* The entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
protected $entityFieldManager;
@ -44,7 +46,7 @@ class EntityAliasTypeDeriver extends DeriverBase implements ContainerDeriverInte
* The entity field manager.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation service.
* @apram \Drupal\Token\TokenEntityMapperInterface $token_entity_mapper
* @param \Drupal\Token\TokenEntityMapperInterface $token_entity_mapper
* The token entity mapper.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, TranslationInterface $string_translation, TokenEntityMapperInterface $token_entity_mapper) {

View file

@ -11,6 +11,7 @@ use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Plugin\Context\Context;
use Drupal\Core\Plugin\ContextAwarePluginBase;
use Drupal\Core\Messenger\MessengerTrait;
use Drupal\pathauto\AliasTypeBatchUpdateInterface;
use Drupal\pathauto\AliasTypeInterface;
use Drupal\pathauto\PathautoState;
@ -26,6 +27,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
class EntityAliasTypeBase extends ContextAwarePluginBase implements AliasTypeInterface, AliasTypeBatchUpdateInterface, ContainerFactoryPluginInterface {
use MessengerTrait;
/**
* The module handler service.
*
@ -151,12 +154,15 @@ class EntityAliasTypeBase extends ContextAwarePluginBase implements AliasTypeInt
case 'create':
$query->isNull('ua.source');
break;
case 'update':
$query->isNotNull('ua.source');
break;
case 'all':
// Nothing to do. We want all paths.
break;
default:
// Unknown action. Abort!
return;
@ -182,7 +188,7 @@ class EntityAliasTypeBase extends ContextAwarePluginBase implements AliasTypeInt
$updates = $this->bulkUpdate($ids);
$context['sandbox']['count'] += count($ids);
$context['sandbox']['current'] = max($ids);
$context['sandbox']['current'] = !empty($ids) ? max($ids) : 0;
$context['results']['updates'] += $updates;
$context['message'] = $this->t('Updated alias for %label @id.', array('%label' => $entity_type->getLabel(), '@id' => end($ids)));
@ -226,7 +232,7 @@ class EntityAliasTypeBase extends ContextAwarePluginBase implements AliasTypeInt
$query->range(0, 100);
$pids_by_id = $query->execute()->fetchAllKeyed();
$this->bulkDelete($pids_by_id);
PathautoState::bulkDelete($this->getEntityTypeId(), $pids_by_id);
$context['sandbox']['count'] += count($pids_by_id);
$context['sandbox']['current'] = max($pids_by_id);
$context['results']['deletions'][] = $this->getLabel();
@ -255,7 +261,7 @@ class EntityAliasTypeBase extends ContextAwarePluginBase implements AliasTypeInt
* An optional array of additional options.
*
* @return int
* The number of updated URL aliases.
* The number of updated URL aliases.
*/
protected function bulkUpdate(array $ids, array $options = array()) {
$options += array('message' => FALSE);
@ -274,7 +280,10 @@ class EntityAliasTypeBase extends ContextAwarePluginBase implements AliasTypeInt
}
if (!empty($options['message'])) {
drupal_set_message(\Drupal::translation()->formatPlural(count($ids), 'Updated 1 %label URL alias.', 'Updated @count %label URL aliases.'), array('%label' => $this->getLabel()));
$this->messenger->addMessage($this->translationManager
->formatPlural(count($ids), 'Updated 1 %label URL alias.', 'Updated @count %label URL aliases.'), [
'%label' => $this->getLabel(),
]);
}
return $updates;
@ -285,19 +294,11 @@ class EntityAliasTypeBase extends ContextAwarePluginBase implements AliasTypeInt
*
* @param int[] $pids_by_id
* A list of path IDs keyed by entity ID.
*
* @deprecated Use \Drupal\pathauto\PathautoState::bulkDelete() instead.
*/
protected function bulkDelete(array $pids_by_id) {
$collection = 'pathauto_state.' . $this->getEntityTypeId();
$states = $this->keyValue->get($collection)->getMultiple(array_keys($pids_by_id));
$pids = [];
foreach ($pids_by_id as $id => $pid) {
// Only delete aliases that were created by this module.
if (isset($states[$id]) && $states[$id] == PathautoState::CREATE) {
$pids[] = $pid;
}
}
\Drupal::service('pathauto.alias_storage_helper')->deleteMultiple($pids);
PathautoState::bulkDelete($this->getEntityTypeId(), $pids_by_id);
}
/**
@ -338,5 +339,4 @@ class EntityAliasTypeBase extends ContextAwarePluginBase implements AliasTypeInt
return $this;
}
}