refactor: GlobalUsages sucht über UsageQuery – Bibliothekssuche als LibraryUsageQuery

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-16 17:36:21 +02:00
co-authored by Claude Sonnet 5.5
parent 3fe83e39d3
commit 454116851e
5 changed files with 171 additions and 43 deletions
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Integrations\Divi\Library;
defined('ABSPATH') || exit;
/**
* What GlobalUsages looks for (ruling P23 pattern, fail closed): a prepared SQL condition on post_content that
* keeps every post that may reference the thing (one query, ID/status/type only), and the decision on the
* content of each candidate. A library entry (LibraryUsageQuery), a preset (PresetUsageQuery, Etappe 4) …
*/
interface UsageQuery
{
/** A condition for "WHERE (…)", already passed through $db->prepare(). */
public function candidateCondition(\wpdb $db): string;
/** Whether $content references the thing; true when unsure (fail closed). */
public function matches(string $content): bool;
}