fix: detach meldet nicht „alles erledigt“, solange nicht lesbare Fundstellen Verweise enthalten können; PageRewriter::apply liefert hidden_count; Tests für Sperre durch nicht lesbare Seiten und post_ids über der Obergrenze

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-18 17:38:01 +02:00
co-authored by Claude Sonnet 5.5
parent b805ed64dd
commit 06398242d6
7 changed files with 132 additions and 11 deletions
+12 -4
View File
@@ -123,8 +123,9 @@ class PageRewriter
* @param Closure(): NodeRewrite $rewrite A fresh strategy per post.
* @param list<int>|null $postIds Only these posts; null = every usage.
* @return array{saved: list<array{post_id: int, revision_id: ?int, nodes: int}>, remaining: int,
* warnings: list<string>, skipped: list<array{post_id: int, reason: string}>}|WP_Error
* unsupported (above HARD_CAP), forbidden (blocked), partial_write (data.saved)
* warnings: list<string>, skipped: list<array{post_id: int, reason: string}>, hidden_count: int}|WP_Error
* hidden_count = usages this account may not read (never rewritten, as in preview(); 0 with post_ids);
* errors: unsupported (above HARD_CAP), forbidden (blocked), partial_write (data.saved)
* @throws WriteFailed When saving the first post fails.
* @throws DiviLocked When Divi is not released – before the first post is written.
*/
@@ -136,7 +137,8 @@ class PageRewriter
string $summary
): array|WP_Error {
$ids = self::ids($postIds);
$refusal = $this->refusal($this->usages->reportFor($query), $ids);
$report = $this->usages->reportFor($query);
$refusal = $this->refusal($report, $ids);
if ($refusal !== null) {
return $refusal;
}
@@ -158,7 +160,13 @@ class PageRewriter
}
}
return ['saved' => $saved, 'remaining' => $remaining, 'warnings' => $warnings, 'skipped' => $skipped];
return [
'saved' => $saved,
'remaining' => $remaining,
'warnings' => $warnings,
'skipped' => $skipped,
'hidden_count' => $ids === null ? $report->hidden : 0,
];
}
/**