Feature Request: Drush command for automation.

Created on 28 July 2022, over 2 years ago
Updated 20 January 2023, almost 2 years ago

Problem/Motivation

As a site administrator I would like the ability to flush Cloudflare caches for specific url fragments and paths, individual entities or bundles of of entities via Drush commands.

The primary purpose of this would be to facilitate clearing caches during deployment operations and occasionally manually so as to do it without having to take the additional time to log into the site UI.

Proposed command structure could look like:

drush cloudflare:flush (alias: cfcr)

Arguments:

  • Naked command would clear the cache for the all configured zones. With a confirmation step. (bypassible with --yes (-y)
  • --domain Optional, primarily for validation to ensure commands are acting against the correctly configured domain
  • --zone Optional, default value is the root configured zone - useful if there are multiple zones for one site
  • --path Optional, would allow passing in specific paths for cloudflare to clear cache on. Ideally this would also allow arbitrary site paths (with some sort of same-site detection perhaps). eg: drush cloudflare:flush --path=/themes/custom/mytheme/assets/js/mycachedfile.js
  • --bundle Optional, if passed, could allow for the clearing of all entity paths for a specific bundle. (probably an edge case need)
  • --theme Optional, Given the machine name of an installed theme, would clear the cloudflare caches of library assets defined by the theme. (Site styles & JS), if wanted this could be done more generically and instead specify a library name to have CF act on that. This would then cover any core, theme, or module defined assets (example: drush cfcr --library=core/jquery)

Future ideas:

drush cloudflare:attack-mode (alias: cf-at) --zone=<zoneid>

  • Quickly place a site into under attack mode from the command line. Do a check against the configured zone's domain, and the domain calling the command to ensure a site cannot be placed into this mode from another environment.
✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada mikeohara Moncton, NB

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States cgmonroe

    Needed this function but my organization requires patched releases and not dev versions. Here is a patch that adds in the drush support.

Production build 0.71.5 2024