fix: Divi-Reiter ohne Divi, Zustandstexte, Schreibsperren und Aufräum-Filter aus der Abschlussprüfung
Behebt die fünf Befunde der Abschlussprüfung von divi-absicherung: Divi-Reiter ohne aktives Divi zeigt nur noch einen Hinweis (kein Status, keine Prüfung, kein Aufräumen), Zustandstexte werden erst beim Rendern übersetzt, DiviPages::setFlags() und DiviThemeBuilder::liveId(true) prüfen jetzt selbst die Freigabesperre, WriteProbe::removeOrphans() löscht nur noch Entwürfe mit passendem Titel, und wp lit-mcp divi-check --update-reference verweigert sich ohne Entwicklungskopie, bevor irgendetwas geschrieben wird. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -114,25 +114,31 @@ class WriteProbe
|
||||
return $problems;
|
||||
}
|
||||
|
||||
/** @return list<int> IDs of check pages a dead check left behind, deleted now. */
|
||||
/**
|
||||
* @return list<int> IDs of check pages a dead check left behind, deleted now. Only drafts whose title starts
|
||||
* with self::TITLE are considered – the marker meta alone is not enough (it is only a query hint here).
|
||||
*/
|
||||
public static function removeOrphans(): array
|
||||
{
|
||||
$ids = get_posts([
|
||||
$posts = get_posts([
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'any',
|
||||
'post_status' => 'draft',
|
||||
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- a handful of marked pages at most.
|
||||
'meta_key' => self::MARKER,
|
||||
'date_query' => [['before' => self::ORPHAN_AGE, 'column' => 'post_date_gmt']],
|
||||
'fields' => 'ids',
|
||||
'fields' => 'all',
|
||||
'posts_per_page' => 20,
|
||||
'no_found_rows' => true,
|
||||
'suppress_filters' => true,
|
||||
]);
|
||||
|
||||
$removed = [];
|
||||
foreach (is_array($ids) ? $ids : [] as $id) {
|
||||
if (self::delete((int) $id)) {
|
||||
$removed[] = (int) $id;
|
||||
foreach (is_array($posts) ? $posts : [] as $post) {
|
||||
if (! $post instanceof WP_Post || ! str_starts_with((string) $post->post_title, self::TITLE)) {
|
||||
continue;
|
||||
}
|
||||
if (self::delete((int) $post->ID)) {
|
||||
$removed[] = (int) $post->ID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user