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>
71 lines
1.9 KiB
PHP
71 lines
1.9 KiB
PHP
<?php
|
|
|
|
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 and the cleanup of probe entries a dead check left behind. Without abilities it
|
|
* is no tool group.
|
|
*/
|
|
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';
|
|
}
|
|
|
|
public function label(): string
|
|
{
|
|
return 'Pods';
|
|
}
|
|
|
|
public function isAvailable(): bool
|
|
{
|
|
return ($this->available)();
|
|
}
|
|
|
|
public function abilities(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public function compatibilities(): array
|
|
{
|
|
return [PodsCompatibility::profile()];
|
|
}
|
|
}
|