diff --git a/admin/class-fastcgi-purger.php b/admin/class-fastcgi-purger.php index 687d862..ed30e30 100644 --- a/admin/class-fastcgi-purger.php +++ b/admin/class-fastcgi-purger.php @@ -69,6 +69,10 @@ public function purge_url( $url, $feed = true ) { case 'get_request': // Go to default case. + + case 'get_request_torden': + // Go to default case. + default: $_url_purge_base = $this->purge_base_url() . $parse['path']; $_url_purge = $_url_purge_base; @@ -137,6 +141,10 @@ public function custom_purge_urls() { case 'get_request': // Go to default case. + + case 'get_request_torden': + // Go to default case. + default: $_url_purge_base = $this->purge_base_url(); @@ -166,7 +174,48 @@ public function custom_purge_urls() { */ public function purge_all() { - $this->unlink_recursive( RT_WP_NGINX_HELPER_CACHE_PATH, false ); + global $nginx_helper_admin; + + switch ( $nginx_helper_admin->options['purge_method'] ) { + + case 'get_request_torden': + $site = get_site_url(); + $find = [ 'http://', 'https://' ]; + $replace = ''; + $host = str_replace( $find, $replace, $site); + + if ( is_ssl() ) { + + $purgeurl = $site . '/purgeall' ; + $curl = curl_init( $purgeurl ); + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PURGE" ); + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curl, CURLOPT_RESOLVE, array( $host . ":443:127.0.0.1" )); + + } else { + + $curl = curl_init( "http://127.0.0.1/purgeall" ); + curl_setopt($curl, CURLOPT_HTTPHEADER, array('Host:' . $host )); + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PURGE" ); + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE); + + } + + $response = curl_exec($curl); + if ($response === false) + $this->log( curl_errno($curl) .': '. curl_error($curl) ); + curl_close($curl); + break; + + case 'get_request': + // Go to default case. + + default: + $this->unlink_recursive( RT_WP_NGINX_HELPER_CACHE_PATH, false ); + break; + } + $this->log( '* * * * *' ); $this->log( '* Purged Everything!' ); $this->log( '* * * * *' ); diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index 87f2e32..615725c 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -181,7 +181,40 @@ sprintf( // translators: %s Nginx cache purge module link. __( 'Uses the %s module.', 'nginx-helper' ), - 'ngx_cache_purge' + 'ngx_cache_purge (FRiCKLE)' + ), + array( + 'strong' => array(), + 'a' => array( + 'href' => array(), + ), + ) + ); + ?> + + +
+