feat: batch media metadata updates and delete with usage check
lit/media-update validates the whole batch first (edit_post, lengths, optional modified lock) and restores already written items when a write fails midway. lit/media-delete requires confirm, refuses used media without force and reports refused deletes as write_failed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -29,6 +29,8 @@ class MediaPresenter
|
||||
'height' => isset($meta['height']) ? (int) $meta['height'] : null,
|
||||
'filesize' => isset($meta['filesize']) ? (int) $meta['filesize'] : null,
|
||||
'date' => (string) $attachment->post_date,
|
||||
// Optimistic lock for lit/media-update (post_modified_gmt, changes with every row write).
|
||||
'modified' => (string) $attachment->post_modified_gmt,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -77,6 +79,7 @@ class MediaPresenter
|
||||
'height' => ['type' => ['integer', 'null']],
|
||||
'filesize' => ['type' => ['integer', 'null']],
|
||||
'date' => ['type' => 'string'],
|
||||
'modified' => ['type' => 'string'],
|
||||
],
|
||||
'required' => ['id', 'title', 'mime_type', 'url', 'alt'],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user