Skip to content

Commit

Permalink
Allow orphan cleanup of draft distributions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jastraat committed Jun 21, 2023
1 parent b339406 commit 4fae668
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function getSubscribedEvents() {
public function cleanResourceMapperTable(Event $event) {
$distribution_id = $event->getData();
// Use the metastore service to build a distribution object.
$distribution = $this->service->get('distribution', $distribution_id);
$distribution = $this->service->get('distribution', $distribution_id, FALSE);
// Attempt to extract all resources for the given distribution.
$resources = $distribution->{'$.data["%Ref:downloadURL"]..data'} ?? [];

Expand Down
6 changes: 4 additions & 2 deletions modules/metastore/src/MetastoreService.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,14 @@ public function isPublished(string $schema_id, string $identifier): bool {
* The {schema_id} slug from the HTTP request.
* @param string $identifier
* Identifier.
* @param bool $published
* If true, retrieve only published revision.
*
* @return \RootedData\RootedJsonData
* The json data.
*/
public function get(string $schema_id, string $identifier): RootedJsonData {
$json_string = $this->getStorage($schema_id)->retrieve($identifier, TRUE);
public function get(string $schema_id, string $identifier, bool $published = TRUE): RootedJsonData {
$json_string = $this->getStorage($schema_id)->retrieve($identifier, $published);
$data = $this->validMetadataFactory->get($json_string, $schema_id);

$data = $this->dispatchEvent(self::EVENT_DATA_GET, $data);
Expand Down

0 comments on commit 4fae668

Please sign in to comment.