refactor: PostRow::update and PostGuard::assertNoMissedSchedule (M5)

- PostRow::update(id, columns, failure) / ::save(): the slashed wp_update_post of
  internal row writes, refusals as RuntimeException '<failure>: <why>'. Used by
  ContentUpdate::restoreRow, PostCloner::updateRow, MediaMetaWriter apply/restore.
- PostGuard::assertNoMissedSchedule(postId, message) replaces the re-read + check in
  ContentUpdate::restoreRow, PostCloner and DiviSaver::restore (DiviSaver keeps its
  own kses window; M4).
- PostCloner::restore uses Rollback::attempt.
Log messages unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-26 17:42:33 +02:00
co-authored by Claude Opus 5.5
parent 8e5ba9eac4
commit 4114bdb805
8 changed files with 140 additions and 49 deletions
+1 -4
View File
@@ -172,10 +172,7 @@ class DiviSaver
{
$detail = sprintf('Saving Divi content of post %d failed: %s', $postId, $cause->getMessage());
$failures = Rollback::attempt(function () use ($postId, $before): void {
$current = get_post($postId);
if ($current instanceof WP_Post && PostGuard::missedSchedule($current)) {
throw new RuntimeException('restoring would publish a missed schedule');
}
PostGuard::assertNoMissedSchedule($postId, 'restoring would publish a missed schedule');
$restored = $this->withoutKses(
static fn (): int|WP_Error