Skip to content

Commit 6d4e805

Browse files
dafederCopilot
andauthored
Remove drush.services.yml files, use autowire and attributes (#4731)
Co-authored-by: Copilot <copilot@github.com>
1 parent 4111bd9 commit 6d4e805

32 files changed

Lines changed: 292 additions & 672 deletions

File tree

composer.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@
5454
"php-http/discovery": true,
5555
"tbachert/spi": true,
5656
"drupal/core-composer-scaffold": true
57-
},
58-
"audit": {
59-
"ignore": {
60-
"PKSA-dwsq-ppd2-mb1x": "Temporarily ignoring this advisory until core-recommended is updated to bring in symfony/polyfill-intl-idn 1.28."
61-
}
6257
}
6358
},
6459
"extra": {

modules/dkan_common/dkan_common.services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ services:
4040
calls:
4141
- [setStorage, ['@?dkan.metastore.storage']]
4242
- [setResourceMapper, ['@?dkan.metastore.resource_mapper']]
43+
Drupal\dkan_common\DatasetInfo: '@dkan.common.dataset_info'
4344

4445
dkan.common.logger_channel:
4546
parent: logger.channel_base

modules/dkan_common/drush.services.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

modules/dkan_common/src/Commands/CommonCommands.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

modules/dkan_common/src/Commands/JobStoreCommands.php

Lines changed: 0 additions & 82 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Drupal\dkan_common\Drush\Commands;
4+
5+
use Drupal\dkan_common\DatasetInfo;
6+
use Drush\Commands\DrushCommands;
7+
use Drush\Commands\AutowireTrait;
8+
use Drush\Attributes as CLI;
9+
10+
/**
11+
* Drush commands providing utility common to DKAN's sub-modules.
12+
*/
13+
final class CommonCommands extends DrushCommands {
14+
15+
use AutowireTrait;
16+
17+
public function __construct(protected DatasetInfo $datasetInfo) {
18+
parent::__construct();
19+
}
20+
21+
/**
22+
* Display information about a dataset and its resource(s).
23+
*/
24+
#[CLI\Command(name: 'dkan:dataset-info', description: 'Display information about a dataset and its resource(s).')]
25+
public function datasetInfo(string $uuid) {
26+
return json_encode($this->datasetInfo->gather($uuid), JSON_PRETTY_PRINT);
27+
}
28+
29+
}

modules/dkan_common/tests/src/Unit/Commands/CommonCommandsTest.php renamed to modules/dkan_common/tests/src/Unit/Commands/Drush/CommonCommandsTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace Drupal\Tests\dkan_common\Unit\Commands;
44

5-
use Drupal\dkan_common\Commands\CommonCommands;
5+
use Drupal\dkan_common\Drush\Commands\CommonCommands;
66
use Drupal\dkan_common\DatasetInfo;
77
use PHPUnit\Framework\TestCase;
88

99
/**
10-
* @covers \Drupal\dkan_common\Commands\CommonCommands
11-
* @coversDefaultClass \Drupal\dkan_common\Commands\CommonCommands
10+
* @covers \Drupal\dkan_common\Drush\Commands\CommonCommands
11+
* @coversDefaultClass \Drupal\dkan_common\Drush\Commands\CommonCommands
1212
*/
1313
class CommonCommandsTest extends TestCase {
1414

modules/dkan_datastore/dkan_datastore.services.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ services:
1010
- '@dkan.metastore.resource_mapper'
1111
- '@event_dispatcher'
1212
- '@dkan.metastore.reference_lookup'
13+
Drupal\dkan_datastore\DatastoreService: '@dkan.datastore.service'
1314

1415
dkan.datastore.lookup:
1516
class: \Drupal\dkan_datastore\DatastoreLookup
1617
arguments:
1718
- '@database'
1819
- '@dkan.metastore.reference_lookup'
20+
Drupal\dkan_datastore\DatastoreLookupInterface: '@dkan.datastore.lookup'
1921

2022
dkan.datastore.service.post_import:
2123
class: \Drupal\dkan_datastore\Service\PostImport
@@ -32,6 +34,7 @@ services:
3234
arguments:
3335
- '@database'
3436
- '@dkan.metastore.resource_mapper'
37+
Drupal\dkan_datastore\PostImportResultFactory: '@dkan.datastore.post_import_result_factory'
3538

3639
dkan.datastore.query:
3740
class: \Drupal\dkan_datastore\Service\Query
@@ -47,6 +50,7 @@ services:
4750
- '@dkan.common.filefetcher_job_store_factory'
4851
- '@queue'
4952
- '@event_dispatcher'
53+
Drupal\dkan_datastore\Service\ResourceLocalizer: '@dkan.datastore.service.resource_localizer'
5054

5155
dkan.datastore.service.resource_processor_collector:
5256
class: \Drupal\dkan_datastore\Service\ResourceProcessorCollector
@@ -71,6 +75,7 @@ services:
7175
- '@dkan.metastore.storage'
7276
- '@dkan.datastore.service'
7377
- '@dkan.datastore.logger_channel'
78+
Drupal\dkan_datastore\Service\ResourcePurger: '@dkan.datastore.service.resource_purger'
7479

7580
dkan.datastore.service.factory.import:
7681
class: \Drupal\dkan_datastore\Service\Factory\ImportServiceFactory
@@ -138,6 +143,7 @@ services:
138143
arguments:
139144
- '@dkan.common.filefetcher_job_store_factory'
140145
- '@dkan.datastore.import_info'
146+
Drupal\dkan_datastore\Service\Info\ImportInfoList: '@dkan.datastore.import_info_list'
141147

142148
dkan.datastore.import_job_store_factory:
143149
class: \Drupal\dkan_datastore\Storage\ImportJobStoreFactory

modules/dkan_datastore/drush.services.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

modules/dkan_datastore/src/Commands/PurgeCommands.php

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)