Skip to content

Additional scripts

Michelle Janowiecki edited this page Apr 8, 2022 · 2 revisions

These are scripts not included in the workflow to post new repository items to Drupal 8.

DELETE

deleteFiles.py
Script to delete files from Drupal 8 using the file_uuid.

GET

getFileMetadata.py
Script that finds the file_uuid and uri for specific filenames (example: Levy-201-087_006.jpg).

getNode_levy_collection_item_withoutField.py
Script that finds up to 10,000 repository items missing a specific field (change field in line 18).

POST

replaceImages.py
Script made to replace images in repository items.

  1. Finds old image file by its file_uuid.
  2. If old image is found, image is deleted.
  3. New image is posted to Drupal 8.
  4. Next, replaces old_id with new_id in the related collection_item_image paragraph.

Old image is deleted before the new image is posted to reduce errors. For instance, if you post the new image first and the filename of the new image is the same as the old image, Drupal 8 may throw an 422 error trying to post the new image to the same location.

Clone this wiki locally