Files
heretek-control-core/includes/wpcli
Mian Shahzad RazaandClaude Opus 4.8 a7ea8d026e feat(wp-cli): run wp-cli commands over MCP, with background jobs
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]>
2026-07-15 01:01:37 +05:00
..