mirror of
https://github.com/Heretek-AI/heretek-control-core.git
synced 2026-10-12 02:03:55 +00:00
Four disabled-by-default, manage_options tools: run-wp-cli (synchronous) plus dispatch/get/list-wp-cli-job for detached background jobs (long migrations / bulk tasks polled for status + output). Execution: in-process via WP_CLI::runcommand() over the WP-CLI stdio transport (no shell); or a proc_open shell path (argv array — no interpolation) when an admin sets a wp base command (Connection tab / EMCP_TOOLS_WPCLI_COMMAND) for HTTP/proxy. Background jobs spawn a detached run.sh/run.bat per job under uploads/emcp-wpcli-jobs/ (web-protected) that captures stdout/stderr + exit code. Security: a command blocklist (eval, eval-file, shell, server, raw db query/cli/import, config set, package install, and --exec/--require/--path/--ssh flags) + a quote-aware, Windows-path-safe tokenizer; args are always passed as an array. Runs are recorded to the change ledger. New WP-CLI category on the Tools tab; seeded disabled-by-default (defaults v18). Classes: EMCP_Tools_WPCLI_Validator / _Runner / _Jobs (includes/wpcli/) + EMCP_Tools_WPCLI_Abilities. Co-Authored-By: Claude Opus 4.8 <[email protected]>