documentation icon indicating copy to clipboard operation
documentation copied to clipboard

CMS-890: Adds tab for the wp pantheon cache commands.

Open rwagner00 opened this issue 1 year ago • 8 comments

Closes https://getpantheon.atlassian.net/browse/CMS-890

Summary

Pantheon WP-CLI Commands - Adds documentation about commands added by the Pantheon mu-plugin to control caching on WP sites via the WP-CLI.

Release:

  • [X] When ready
  • [ ] After date: $DATE

Post Launch

Do not remove - To be completed by the docs team upon merge:

  • [ ] Redirect /docs/old-path/ => /docs/new-path/ (if applicable)
  • [ ] Include/exclude pages ^ respectively within docs search service provider (if applicable)
  • [ ] For Heroes - add a props post to the discussion board.
  • [ ] Remove from the project board

rwagner00 avatar Oct 03 '22 20:10 rwagner00

@jazzsequence Hrmm, running terminus wp -- jrw-wp-test.dev pantheon cache produces only the set-maintenance-mode subcommand, which is the one documented. Running terminus wp -- jrw-wp-test.dev pantheon session produces an error that there is no such command. This is on a brand new site using the standard WP upstream. Is there something I'm missing?

rwagner00 avatar Oct 04 '22 18:10 rwagner00

@rwagner00 You're missing the Native PHP Sessions plugin. I think the other caching functions are coming from Pantheon Advanced Page Cache.

~I'm missing the maintenance mode plugin, and so I'm wondering what I'm missing in my environment but IIRC (and since your site doesn't have any other Pantheon plugins installed) that should be in the mu-plugin. If you've cloned your site locally, does it have a wp-content/mu-plugins/pantheon/cli.php file?~ Figured out my issue, it was totally a PEBKAC problem.

jazzsequence avatar Oct 04 '22 21:10 jazzsequence

@jazzsequence Neither the Native PHP nor the Advanced Page Cache plugins are included by default, per their own README files and a review of my stock site, which is why I didn't have those commands. ~~With that in mind, I think the sections for those belong in their own tabs. Does that make sense to you?~~

rwagner00 avatar Oct 05 '22 16:10 rwagner00

Pushed changes which include the other commands

rwagner00 avatar Oct 05 '22 17:10 rwagner00

@jazzsequence I believe I've resolved the feedback and issues, let me know if there's anything else I need to take care of!

rwagner00 avatar Oct 06 '22 19:10 rwagner00

preview

EdwardAngert avatar Oct 12 '22 20:10 EdwardAngert

@rwagner00 @jspellman814 before I move this to a copy review, I'm getting some errors in testing - set-maintenance-mode everyone worked (tested after the cache clearing command), but the cache commands are giving me this:

Error: 'purge-all' is not a registered subcommand of 'pantheon cache'. See 'wp help pantheon cache' for available subcommands.
 [notice] Command: $SITE.dev -- wp help pantheon cache purge-all [Exit: 1]

for good measure, here's the help output

╰─❯ terminus wp -- $SITE.dev help pantheon cache
 [warning] This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
NAME

  wp pantheon cache

SYNOPSIS

  wp pantheon cache <command>

SUBCOMMANDS

  set-maintenance-mode      Sets maintenance mode status.





GLOBAL PARAMETERS

  --path=<path>
      Path to the WordPress files.

  --url=<url>
      Pretend request came from given URL. In multisite, this argument is how
      the target site is specified.

  --ssh=[<scheme>:][<user>@]<host|container>[:<port>][<path>]
      Perform operation against a remote server over SSH (or a container using
      scheme of "docker", "docker-compose", "vagrant").

  --http=<http>
      Perform operation against a remote WordPress installation over HTTP.

  --user=<id|login|email>
      Set the WordPress user.

  --skip-plugins[=<plugins>]
      Skip loading all plugins, or a comma-separated list of plugins. Note:
      mu-plugins are still loaded.

  --skip-themes[=<themes>]
      Skip loading all themes, or a comma-separated list of themes.

  --skip-packages
      Skip loading all installed packages.

  --require=<path>
      Load PHP file before running the command (may be used more than once).

  --exec=<php-code>
      Execute PHP code before running the command (may be used more than once).

  --context=<context>
      Load WordPress in a given context.

  --[no-]color
      Whether to colorize the output.

  --debug[=<group>]
      Show all PHP errors and add verbosity to WP-CLI output. Built-in groups
      include: bootstrap, commandfactory, and help.

  --prompt[=<assoc>]
      Prompt the user to enter values for all command arguments, or a subset
      specified as comma-separated values.

  --quiet
      Suppress informational messages.

 [notice] Command: $SITE.dev -- wp help pantheon cache [Exit: 0]

EdwardAngert avatar Oct 12 '22 21:10 EdwardAngert

I'll take a look.

rwagner00 avatar Oct 12 '22 21:10 rwagner00

@EdwardAngert The pantheon-advanced-page-cache plugin is inactive by default, even though it is also included in the composer file. If you activate the plugin, the commands appear. Opinions on if we should note this in the doc, or enable it by default?

rwagner00 avatar Oct 19 '22 21:10 rwagner00

@rwagner00 thanks! I was able to activate it and/but I'm torn about how much users want things active by default, and as far as documenting it goes, I added a few command examples in the latest commit that I hope will help folks run them

re: pantheon session list I'm not sure how to give folks instructions to delete a session (because I'm not sure how to trigger a session), so it's a little incomplete for now (L72)

╰─❯ terminus wp $SITE.$ENV -- pantheon session list
+------------+---------+----------+------------+------+
| session_id | user_id | datetime | ip_address | data |
+------------+---------+----------+------------+------+
+------------+---------+----------+------------+------+
 [notice] Command: $SITE.$ENV -- wp pantheon session list [Exit: 0]

other than that, if it looks ready to y'all, I'll pass it on to the rest of the Docs team for a copy review

EdwardAngert avatar Oct 20 '22 17:10 EdwardAngert

@EdwardAngert I don't actually know anything more about the PHP Session module than you do, so I'm useless there. The rest looks good to me!

rwagner00 avatar Oct 20 '22 18:10 rwagner00

@pantheon-systems/docs-admins when you merge, please use the Squash and merge option

EdwardAngert avatar Oct 20 '22 18:10 EdwardAngert

LGTM

whitneymeredith avatar Oct 21 '22 22:10 whitneymeredith