Title: Bug: CLI cache busting broken with v7
Last modified: February 8, 2022

---

# Bug: CLI cache busting broken with v7

 *  Resolved [Mark Barnes](https://wordpress.org/support/users/mark8barnes/)
 * (@mark8barnes)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/bug-cli-cache-busting-broken-with-v7/)
 * The new v7 release has broken the `wp sg purge` command. This now always returns
   the error `Unable to Purge File Cache`.
 * The issue appears to be that `WP_CLI->file_cacher->purge_everything()` does not
   return anything, whereas line 54 of Cli_Purge.php excepts it to return a true/
   false.
    -  This topic was modified 4 years, 3 months ago by [Mark Barnes](https://wordpress.org/support/users/mark8barnes/).
    -  This topic was modified 4 years, 3 months ago by [Mark Barnes](https://wordpress.org/support/users/mark8barnes/).

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [Mark Barnes](https://wordpress.org/support/users/mark8barnes/)
 * (@mark8barnes)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/bug-cli-cache-busting-broken-with-v7/#post-15342326)
 * Even when I hack around the above problem, there’s a second issue, this time 
   with `Cli_Purge->supercacher->purge_everything()`. On my local test environment,
   that attempts to run the `site-tools-client domain-all update id=%s flush_cache
   =1 path='%s'` command, which of course fails. This should presumably be skipped
   when away from SiteGround servers.
    -  This reply was modified 4 years, 3 months ago by [Mark Barnes](https://wordpress.org/support/users/mark8barnes/).
 *  Plugin Support [Vladimir Trandev](https://wordpress.org/support/users/vtrandev/)
 * (@vtrandev)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/bug-cli-cache-busting-broken-with-v7/#post-15342341)
 * Hello [@mark8barnes](https://wordpress.org/support/users/mark8barnes/),
 * Thank you for your report!
 * We are aware of the issue and our developers are working on a fix.
 * Regards,
    Vladimir
 *  Thread Starter [Mark Barnes](https://wordpress.org/support/users/mark8barnes/)
 * (@mark8barnes)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/bug-cli-cache-busting-broken-with-v7/#post-15354438)
 * Thank you for the quick release of 7.0.2. This release partly fixes the issue.
   The purge command does now work, but with an important caveat. It exits with 
   an exit code of ‘200’. I presume this is supposed to be equivalent to an HTTP
   status code of 200 OK, but anything other than an exit code of 0 is usually interpreted
   by bash scripts as an error. The plugin should exit with a code of 0 if the cache
   was successfully purged.
 * (In our case, we’re using BitBucket Pipelines, which assumes a build has failed
   if there isn’t an exit code of 0. I’ve had to write a bash script to check for
   an error code of 200 and convert it to 0!)
 *  Plugin Support [Gergana Petrova](https://wordpress.org/support/users/gpetrova/)
 * (@gpetrova)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/bug-cli-cache-busting-broken-with-v7/#post-15355072)
 * Hello [@mark8barnes](https://wordpress.org/support/users/mark8barnes/),
 * Could you please elaborate a bit more on how are you checking the exit code on
   your end to get the 200 response? In our tests the exit code when the cache is
   purged via cli is 0, as expected.
 * Could you please also specify your domain name and if your site is with SiteGround?
 * Best Regards,
    Gergana Petrova
 *  Thread Starter [Mark Barnes](https://wordpress.org/support/users/mark8barnes/)
 * (@mark8barnes)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/bug-cli-cache-busting-broken-with-v7/#post-15362228)
 *     ```
       baseos | <redacted>@<redacted>.sgvps.net:~/www/samaritans-purse.org.uk/html$ wp sg purge
       Success: SiteGround Optimizer assets folder purged successfully.
       Success: File Cache Succesfully Purged.
       Success: Dynamic Cache Successfully Purged.
       baseos | <redacted>@<redacted>.sgvps.net:~/www/samaritans-purse.org.uk/html$ echo $?
       200
       ```
   
 * Thanks for the response. My site is with SiteGround. You can see the domain name
   above. There’s a typo in the File Cache “Succesfully” message, by the way.
 * You’ve got `halt(200)` commands all over `purge_everything()` and `purge_url()`.
 *  Plugin Support [Vladimir Trandev](https://wordpress.org/support/users/vtrandev/)
 * (@vtrandev)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/bug-cli-cache-busting-broken-with-v7/#post-15363762)
 * Hello again,
 * We have already implemented a fix, so please update the plugin to the latest 
   version -> 7.0.3.
 * Regards,
    Vladimir
 *  Thread Starter [Mark Barnes](https://wordpress.org/support/users/mark8barnes/)
 * (@mark8barnes)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/bug-cli-cache-busting-broken-with-v7/#post-15366820)
 * 7.0.3 does seem to have fixed the issues. Thanks for the quick response. (And
   it’s worthwhile, because the file-based cache is much faster than v6.)

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Bug: CLI cache busting broken with v7’ is closed to new replies.

 * ![](https://ps.w.org/sg-cachepress/assets/icon-256x256.gif?rev=2971889)
 * [Speed Optimizer - The All-In-One Performance-Boosting Plugin](https://wordpress.org/plugins/sg-cachepress/)
 * [Support Threads](https://wordpress.org/support/plugin/sg-cachepress/)
 * [Active Topics](https://wordpress.org/support/plugin/sg-cachepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sg-cachepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sg-cachepress/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [Mark Barnes](https://wordpress.org/support/users/mark8barnes/)
 * Last activity: [4 years, 3 months ago](https://wordpress.org/support/topic/bug-cli-cache-busting-broken-with-v7/#post-15366820)
 * Status: resolved