* * "real" uses the profile as shipped (3.3.9.2 is tested, so releasing is refused); "untested" is the same profile * with an empty testedVersions list, which simulates a Pods version the plugin was not tested with. * No strict_types: wp eval-file runs this through eval(). */ defined('WP_CLI') && WP_CLI || exit; use LIT\MCP\Admin\AdminPostAction; use LIT\MCP\Admin\CompatibilityTab; use LIT\MCP\Compatibility\Compatibility; use LIT\MCP\Integrations\Pods\PodsCompatibility; [$mode, $profileKind] = [$args[0] ?? '', $args[1] ?? '']; $real = PodsCompatibility::profile(); $profile = $profileKind === 'untested' ? new LIT\MCP\Compatibility\Profile( id: $real->id, label: $real->label, tier: $real->tier, capabilities: $real->capabilities, manifests: $real->manifests, active: $real->active, version: $real->version, minVersion: $real->minVersion, testedVersions: [] ) : $real; $admins = get_users(['role' => 'administrator', 'number' => 1]); wp_set_current_user($admins[0]->ID); $action = $mode === 'withdraw' ? CompatibilityTab::WITHDRAW_ACTION : CompatibilityTab::RELEASE_ACTION; $_POST['profile'] = 'pods'; $_REQUEST['_wpnonce'] = wp_create_nonce($action . '_pods'); $location = ''; add_filter('wp_redirect', static function ($url) use (&$location) { $location = (string) $url; return false; // do not send anything: the CLI has no response to redirect. }); $tab = new CompatibilityTab( new Compatibility([$profile], report: Compatibility::storedReport(...)), null, new AdminPostAction(static function (): void { }) ); $mode === 'withdraw' ? $tab->withdraw() : $tab->release(); parse_str((string) wp_parse_url($location, PHP_URL_QUERY), $query); echo $query['lit_mcp_notice'] ?? 'no-redirect', "\n";