PluginProbe
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel / trunk
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel vtrunk
1.7.1 1.7.0 1.6.0 1.5.2 trunk 0.1 0.2.0 0.2.1 0.3 0.3.1 0.3.2 0.3.3 0.3.4 0.4 0.4.1 0.4.2 0.4.3 1.0 1.1 1.2 1.3.1 1.4.0 1.4.1 1.5.0 1.5.1 All 26 releases
← All changes | includes/Fastcgi_Cache.php +20 -0 0.3trunk View file →
@@ -27,8 +27,23 @@
27 27 // add_action( 'wp_update_nav_menu', [ $this, 'purge_home_cache' ], 10, 2 );
28 28 }
29 29
30 30 /**
31 + * FastCGI cache purge url.
32 + *
33 + * @return string
34 + */
35 + public function purge_cache_url() {
36 + return wp_nonce_url(
37 + add_query_arg(
38 + [ 'flywp-action' => 'purge-fastcgi-cache' ],
39 + admin_url( 'index.php?page=flywp' )
40 + ),
41 + 'fly-fastcgi-purge-cache'
42 + );
43 + }
44 +
45 + /**
31 46 * Check if the cache is enabled.
32 47 *
33 48 * @return bool
34 49 */
@@ -104,8 +119,13 @@
104 119 */
105 120 public function purge_cache_by_url( $url ) {
106 121 $parsed = wp_parse_url( $url );
107 122 $path = isset( $parsed['path'] ) ? $parsed['path'] : '';
123 +
124 + // Ensure path ends with trailing slash
125 + if ( substr( $path, -1 ) !== '/' ) {
126 + $path .= '/';
127 + }
108 128
109 129 // cache key format (without space): $protocal $method $host $path
110 130 // because of nginx-proxy, all request will be http, so we don't need to check protocal
111 131 // $method is always GET as we only cache GET request