Skip to content

Document four missing environment variables in the config reference - #677

Open
ekamran wants to merge 1 commit into
wp-cli:mainfrom
ekamran:shifteq/config-env-vars
Open

ekamran wants to merge 1 commit into
wp-cli:mainfrom
ekamran:shifteq/config-env-vars

Conversation

@ekamran

@ekamran ekamran commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds four environment variables that WP-CLI 2.12.0 reads but the environment variable list in the Config reference does not mention.

Changes

  • WP_CLI_ALLOW_ROOT: run as root without adding --allow-root to every command.
  • WP_CLI_AUTO_CHECK_UPDATE_DAYS: number of days between automatic update checks. Default 1.
  • WP_CLI_CACHE_EXPIRY: lifetime of cached files in seconds. Default 15552000 (180 days).
  • WP_CLI_CACHE_MAX_SIZE: size limit of the file cache in bytes. Default 314572800 (300 MB).

The new entries follow the alphabetical order of the list. Variables that only exist on main and are not in a release yet, such as WP_CLI_AUTOCORRECT and WP_CLI_ERROR_RERUN, are left out.

In 2.12.0 they are read in php/WP_CLI/Bootstrap/CheckRoot.php, WP_CLI::get_cache() in php/class-wp-cli.php, and Runner::auto_check_update() in php/WP_CLI/Runner.php.

Verification

Checked each one against the WP-CLI 2.12.0 Phar:

  • WP_CLI_ALLOW_ROOT=1: wp cli version runs when the root check fires. Without it, the "YIKES!" error stops the command. Root was simulated with the same posix_geteuid() override that the "Test early root detection" scenario in features/bootstrap.feature uses.
  • WP_CLI_CACHE_EXPIRY=604800: WP_CLI::get_cache()->clean() removes a 31-day-old cache file and keeps the newer ones.
  • WP_CLI_CACHE_MAX_SIZE=450000: with three 400,000-byte cache files, clean() keeps only the most recently accessed one.
  • WP_CLI_AUTO_CHECK_UPDATE_DAYS=3: when the last check was two days ago, no new check runs. With the default of 1, it runs.
  • Ran git diff --check.

Use of AI

AI assistance: Yes
Tool(s): Claude Code and Codex
Used for: finding the undocumented variables, testing them against WP-CLI 2.12.0, drafting the change, and reviewing it. I reviewed the reasoning and test results, and I take responsibility for the contribution.

Summary by CodeRabbit

  • Documentation
    • Documented additional environment variables for configuring root access, update-check intervals, and cache expiration and size limits.

@ekamran
ekamran requested a review from a team as a code owner November 1, 2026 15:15
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0d7412b5-7eca-4fbf-864a-3f002554aa98
Commits

Reviewing files that changed from the base of the PR and between 4a78564 and a2be980.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7d813a54-bf34-4f48-b8b8-166cb7c9f12f
Commits

Reviewing files that changed from the base of the PR and between 4d4fb89 and 4a78564.

Files selected for processing: 1
  • references/config.md

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The configuration reference now documents four environment variables for root access, update-check timing, and cache settings.

Changes: Configuration Reference

Layer / File(s) Summary
Document environment variables
references/config.md
Adds WP_CLI_ALLOW_ROOT, WP_CLI_AUTO_CHECK_UPDATE_DAYS, WP_CLI_CACHE_EXPIRY, and WP_CLI_CACHE_MAX_SIZE, with their values, defaults, and cache trimming behavior.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Suggested labels: scope:documentation

Suggested reviewers: swissspidy

Merge Risk: Minimal · previous review 4a785

The documentation-only change is ready to merge.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states that four missing environment variables are documented in the config reference. The changeset adds exactly four entries (WP_CLI_ALLOW_ROOT, WP_CLI_AUTO_CHECK_UPDATE_DAYS, WP_CLI_CACHE…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states that four missing environment variables are documented in the config reference. The changeset adds exactly four entries (WP_CLI_ALLOW_ROOT, WP_CLI_AUTO_CHECK_UPDATE_DAYS, WP_CLI_CACHE_EXPIRY, WP_CLI_CACHE_MAX_SIZE) to references/config.md, so the title matches the main change. It is concise, specific, and free of noise.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

WP-CLI 2.12.0 reads WP_CLI_ALLOW_ROOT, WP_CLI_AUTO_CHECK_UPDATE_DAYS,
WP_CLI_CACHE_EXPIRY and WP_CLI_CACHE_MAX_SIZE, but the environment
variable list in the Config reference does not mention them.
@ekamran
ekamran force-pushed the shifteq/config-env-vars branch from 4a78564 to a2be980 Compare November 1, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant