I’m trying to set up a deployment process from my laptop to my server using mysqldump and rsync in a bash script, but I only want to rsync media files which are public. I looked in the media table, along with lots of others, but can’t track down a dedicated is_public
or similar value for a given media id.
I know media files can be public or private independent of their parent item, so I don’t want the item’s privacy status. How does a media know whether it’s public or private? Thanks!
EDIT: Aha! It’s in the resource
table! Thanks for letting me rubber ducky this on the forum. I’m learning a ton and having fun.
In case it helps anyone else:
This SQL command finds all media files which are themselves public.
SELECT m.id, m.storage_id
FROM media AS m
JOIN resource AS r
ON m.id = r.id
WHERE r.is_public = 1;
This SQL command finds all media files where the parent item is public.
SELECT m.id, m.storage_id
FROM media AS m
JOIN resource AS r
ON m.item_id = r.id
WHERE r.is_public = 1;