Skip to content

Commit

Permalink
Merge pull request #42 from discoverygarden/fix/drush-12
Browse files Browse the repository at this point in the history
[DDST-215] Drush 12 compatibility
  • Loading branch information
nchiasson-dgi authored Jun 4, 2024
2 parents 14287ee + 249e14d commit 881a302
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 26 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"extra": {
"drush": {
"services": {
"drush.services.yml": "^10"
"drush.10-11.services.yml": "^10 || ^11"
}
}
}
Expand Down
9 changes: 3 additions & 6 deletions drush.services.yml → drush.10-11.services.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
services:
dgi_actions.commands:
class: \Drupal\dgi_actions\Commands\Generate
class: \Drupal\dgi_actions\Drush\Commands\Generate
arguments: [
'@http_client',
'@entity_type.manager',
'@dgi_actions.utils',
'@dgi_actions.dgiutils',
'@islandora.utils',
'@logger.dgi_actions'
'@logger.channel.dgi_actions'
]
tags:
- { name: drush.command }
dgi_actions.print_missing_identifier_entity_ids:
class: \Drupal\dgi_actions\Commands\PrintMissingEntityIds
class: \Drupal\dgi_actions\Drush\Commands\PrintMissingEntityIds
arguments: [
'@entity_type.manager',
'@dgi_actions.utils'
]
tags:
- { name: drush.command }
logger.dgi_actions:
parent: logger.channel_base
arguments: [ 'dgi_actions' ]
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Drupal\dgi_actions_ark_identifier\Plugin\Action;

use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\dgi_actions_ezid\Utility\EzidTrait;
use Drupal\dgi_actions\Plugin\Action\DeleteIdentifier;
use Drupal\dgi_actions\Plugin\Action\HttpActionDeleteTrait;
use Drupal\dgi_actions\Utility\IdentifierUtils;
use Drupal\dgi_actions_ezid\Utility\EzidTrait;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\RequestOptions;
use Psr\Http\Message\ResponseInterface;
Expand Down
2 changes: 1 addition & 1 deletion modules/dgi_actions_handle/drush.services.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
services:
dgi_actions_handle.commands:
class: \Drupal\dgi_actions_handle\Commands\HandleCommands
class: \Drupal\dgi_actions_handle\Drush\Commands\HandleCommands
arguments: ['@http_client', '@entity_type.manager', '@dgi_actions.utils']
tags:
- { name: drush.command }
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Drupal\dgi_actions_handle\Commands;
namespace Drupal\dgi_actions_handle\Drush\Commands;

use Consolidation\AnnotatedCommand\CommandData;
use Consolidation\AnnotatedCommand\CommandError;
Expand All @@ -9,6 +9,7 @@
use Drupal\dgi_actions\Utility\IdentifierUtils;
use Drush\Commands\DrushCommands;
use GuzzleHttp\ClientInterface;
use Psr\Container\ContainerInterface;

/**
* Drush commands for Handle.net things.
Expand Down Expand Up @@ -53,6 +54,17 @@ public function __construct(ClientInterface $client, EntityTypeManagerInterface
$this->utils = $utils;
}

/**
* {@inheritDoc}
*/
public static function create(ContainerInterface $container) : self {
return new static(
$container->get('http_client'),
$container->get('entity_type.manager'),
$container->get('dgi_actions.utils')
);
}

/**
* Validates the update command.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Drupal\dgi_actions_handle\Commands;
namespace Drupal\dgi_actions_handle\Drush\Commands;

use Drupal\dgi_actions\Entity\IdentifierInterface;
use Drupal\dgi_actions_handle\Utility\HandleTrait;
Expand Down
16 changes: 15 additions & 1 deletion src/Commands/Generate.php → src/Drush/Commands/Generate.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Drupal\dgi_actions\Commands;
namespace Drupal\dgi_actions\Drush\Commands;

use Consolidation\AnnotatedCommand\CommandData;
use Consolidation\AnnotatedCommand\CommandError;
Expand All @@ -13,6 +13,7 @@
use Drupal\islandora\IslandoraUtils;
use Drush\Commands\DrushCommands;
use GuzzleHttp\ClientInterface;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;

/**
Expand Down Expand Up @@ -90,6 +91,19 @@ public function __construct(ClientInterface $client, EntityTypeManagerInterface
$this->ourLogger = $logger;
}

/**
* {@inheritDoc}
*/
public static function create(ContainerInterface $container) : self {
return new static(
$container->get('http_client'),
$container->get('entity_type.manager'),
$container->get('dgi_actions.utils'),
$container->get('islandora.utils'),
$container->get('logger.channel.dgi_actions')
);
}

/**
* Generates missing identifiers for entities.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php

namespace Drupal\dgi_actions\Commands;
namespace Drupal\dgi_actions\Drush\Commands;

use Consolidation\AnnotatedCommand\CommandData;
use Consolidation\AnnotatedCommand\CommandError;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\dgi_actions\Utility\IdentifierUtils;
use Drush\Commands\DrushCommands;
use Psr\Container\ContainerInterface;

/**
* Drush commands for generating identifiers for existing objects.
Expand Down Expand Up @@ -45,6 +46,16 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Ide
$this->identifierUtils = $identifier_utils;
}

/**
* {@inheritDoc}
*/
public static function create(ContainerInterface $container) : self {
return new static(
$container->get('entity_type.manager'),
$container->get('dgi_actions.utils')
);
}

/**
* Prints entity IDs with missing identifiers.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Form/DataProfileDeleteForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Url;

/**
* Builds the form to delete Data Profile setting entities.
Expand Down
12 changes: 6 additions & 6 deletions src/Plugin/Action/IdentifierAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace Drupal\dgi_actions\Plugin\Action;

use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\dgi_actions\Entity\IdentifierInterface;
use Drupal\dgi_actions\Utility\IdentifierUtils;
use Drupal\Core\Action\ConfigurableActionBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Psr\Log\LoggerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\dgi_actions\Entity\IdentifierInterface;
use Drupal\dgi_actions\Utility\IdentifierUtils;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Base class for Identifier Actions.
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Action/MintIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\dgi_actions\Plugin\Action;

use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Field\EntityReferenceFieldItemList;
use Drupal\Core\Form\FormStateInterface;

Expand Down
6 changes: 3 additions & 3 deletions src/Plugin/Condition/EntityHasIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
use Drupal\Core\Condition\ConditionPluginBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\dgi_actions\Utility\IdentifierUtils;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Condition to check an Entity for an existing persistent identifier.
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/DataProfileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\dgi_actions\Plugin;

use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;

/**
* Provides the Data profile plugin manager.
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/ServiceDataTypeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\dgi_actions\Plugin;

use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;

/**
* Provides the Service data type plugin manager.
Expand Down

0 comments on commit 881a302

Please sign in to comment.