feat(pods): Verhaltensprobe als Prüfschritt
Beim Prüfen schreibt und liest PodsProbe auf einem Wegwerf-Entwurf ein Textfeld genau so, wie LIT MCP es tut, vergleicht die Werte und löscht den Entwurf wieder. Bevorzugt von Pods angelegte Typen; ohne Pod mit Textfeld gilt der Schritt als grün mit Hinweis „nicht geprüft“. Ein roter Schritt sperrt Pods über die Berichtssperre. Liegengebliebene Probe-Einträge räumt der Load-Hook des Reiters auf. Pods-Smoke um Probe und Bereinigung erweitert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
42aa4f8dc9
commit
1a294b7881
+31
-3
@@ -4,17 +4,45 @@ declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Integrations\Pods;
|
||||
|
||||
use LIT\MCP\Admin\CompatibilityTab;
|
||||
use LIT\MCP\Compatibility\ProvidesCompatibility;
|
||||
use LIT\MCP\Integrations\Bootable;
|
||||
use LIT\MCP\Integrations\Integration;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* Pods has no tools of its own (the content tools read its fields through PodsFieldSource); this integration only
|
||||
* brings the compatibility profile. Without abilities it is no tool group.
|
||||
* brings the compatibility profile and the cleanup of probe entries a dead check left behind. Without abilities it
|
||||
* is no tool group.
|
||||
*/
|
||||
final class PodsIntegration implements Integration, ProvidesCompatibility
|
||||
final class PodsIntegration implements Integration, ProvidesCompatibility, Bootable
|
||||
{
|
||||
/** @var callable(): bool */
|
||||
private $available;
|
||||
|
||||
/** @param callable(): bool|null $available Whether Pods is loaded; null = PODS_VERSION is defined. */
|
||||
public function __construct(?callable $available = null)
|
||||
{
|
||||
$this->available = $available ?? static fn (): bool => defined('PODS_VERSION');
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
add_action(CompatibilityTab::LOAD_ACTION, [$this, 'removeOrphans']);
|
||||
}
|
||||
|
||||
/**
|
||||
* lit_mcp_compat_profile_load('pods'), before any output: deletes probe entries a dead check left behind
|
||||
* (PodsProbe::removeOrphans()). A GET without nonce on purpose: only the plugin's own leftovers, idempotent.
|
||||
*/
|
||||
public function removeOrphans(string $profileId): void
|
||||
{
|
||||
if ($profileId === 'pods' && $this->isAvailable() && current_user_can('manage_options')) {
|
||||
PodsProbe::removeOrphans();
|
||||
}
|
||||
}
|
||||
|
||||
public function id(): string
|
||||
{
|
||||
return 'pods';
|
||||
@@ -27,7 +55,7 @@ final class PodsIntegration implements Integration, ProvidesCompatibility
|
||||
|
||||
public function isAvailable(): bool
|
||||
{
|
||||
return defined('PODS_VERSION');
|
||||
return ($this->available)();
|
||||
}
|
||||
|
||||
public function abilities(): array
|
||||
|
||||
Reference in New Issue
Block a user