Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete media when deleting nodes #38

Closed
mjordan opened this issue Jul 10, 2019 · 3 comments
Closed

Delete media when deleting nodes #38

mjordan opened this issue Jul 10, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@mjordan
Copy link
Owner

mjordan commented Jul 10, 2019

No description provided.

@mjordan
Copy link
Owner Author

mjordan commented Jul 16, 2019

This should probably be True by default and configurable to False.

@mjordan
Copy link
Owner Author

mjordan commented Jul 16, 2019

  1. GET node's media: http://admin:islandora@localhost:8000/node/399/media?_format=json
  2. Loop through media entries and get each entry's mid
  3. DELETE each media.
  4. Files associated with media need to be deleted separately:
    1. Get the target_id associated with each media (note that the field name differs across media types - field_media_file, field_media_image, field_media_audio_file, field_media_document, field_media_video_file) and issue a DELETE request on it.

Here is an example of the JSON returned from a GET on the media that contains the file field and target ID:

   "field_media_file":[
      {
         "target_id":419,
         "display":null,
         "description":null,
         "target_type":"file",
         "target_uuid":"7b691848-48e6-4468-8517-7fdca4b55821",
         "url":"http:\/\/localhost:8000\/sites\/default\/files\/2020-04\/95-FITS%20File.xml"
      }
   ],

@mjordan mjordan added the enhancement New feature or request label Mar 30, 2020
mjordan added a commit that referenced this issue Apr 6, 2020
@mjordan
Copy link
Owner Author

mjordan commented Apr 6, 2020

Resolved with 281e142.

@mjordan mjordan closed this as completed Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant