fix: global library edits check private and scheduled pages, name the backup on failure (P8a, P14)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 01:25:16 +02:00
co-authored by Claude Opus 5.5
parent d66ad36c2e
commit 520a639411
7 changed files with 332 additions and 45 deletions
+23 -1
View File
@@ -32,7 +32,7 @@ final class WriteFailed extends RuntimeException
public readonly ?int $postId,
public readonly ?int $revisionId,
?Throwable $previous,
string $detail,
private string $detail,
public readonly ?string $state,
public readonly ?string $hint,
public readonly array $details
@@ -82,6 +82,28 @@ final class WriteFailed extends RuntimeException
return new self($reason, false, $postId, $revisionId, $cause, $detail, $state, $hint, $details);
}
/**
* The same failure with $details merged into its client details; a non-null $hint or $state
* replaces the current one (see rolledBack()/partial()). For callers that learn about
* something kept (e.g. a backup) only after the failure was thrown.
*
* @param array<string, mixed> $details
*/
public function withDetails(array $details, ?string $hint = null, ?string $state = null): self
{
return new self(
$this->reason,
$this->rolledBack,
$this->postId,
$this->revisionId,
$this->getPrevious(),
$this->detail,
$state ?? $this->state,
$hint ?? $this->hint,
array_merge($this->details, $details)
);
}
public function toError(): WP_Error
{
return $this->rolledBack