Example #1
0
/**
 * Purge the whole cache.
 *
 * @since  1.0.0.
 *
 * @param  array $purge_args Additional args to pass to the purge request.
 * @return array|bool|WP_Error                   The purge response.
 */
function purgely_purge_all($purge_args = array())
{
    $purgely = new Purgely_Purge();
    $purge_args = array_merge(array('allow-all' => Purgely_Settings::get_setting('allow_purge_all')), $purge_args);
    $purgely->purge('all', '', $purge_args);
    return $purgely->get_result();
}
Example #2
0
/**
 * Purge the whole cache.
 *
 * @since  1.0.0.
 *
 * @param  array $purge_args Additional args to pass to the purge request.
 * @return array|bool|WP_Error                   The purge response.
 */
function purgely_purge_all($purge_args = array())
{
    $purgely = new Purgely_Purge();
    $purge_args = array_merge(array('allow-all' => PURGELY_ALLOW_PURGE_ALL), $purge_args);
    $purgely->purge('all', '', $purge_args);
    return $purgely->get_result();
}
Example #3
0
 public function test_failing_purge_request_for_all_items_when_not_allowed()
 {
     $purge = new Purgely_Purge();
     $actual_result = $purge->purge('all');
     $this->assertEquals(false, $actual_result);
 }
 /**
  * Iterate through and purge all related URLs.
  *
  * @since 1.0.0.
  *
  * @param  array $purge_args The arguments to send to the purge request.
  * @return array                   The list of purge request responses.
  */
 public function purge_related($purge_args = array())
 {
     $responses = array();
     $urls = $this->get_urls();
     // Iterate through each and purge.
     if (count($urls) > 0) {
         foreach ($urls as $categories) {
             foreach ($categories as $url) {
                 $purge = new Purgely_Purge();
                 $responses[$url] = $purge->purge('url', $url, $purge_args);
                 // Record the object.
                 $this->set_purge_request($purge);
             }
         }
     }
     $this->set_responses($responses);
     return $responses;
 }