PluginProbe
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel / v1.3
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel vv1.3
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 +37 -0 0.2.0v1.3 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 */
@@ -127,8 +142,28 @@
127 142 $this->purge_cache_by_url( home_url() );
128 143 }
129 144
130 145 /**
146 + * Purge cache when a post is saved.
147 + *
148 + * @param int $post_id Post ID
149 + * @param object $post Post object
150 + *
151 + * @return void
152 + */
153 + public function on_save_post( $post_id, $post ) {
154 + if ( $post->post_status !== 'publish' ) {
155 + return;
156 + }
157 +
158 + if ( $this->get_setting( 'home_created' ) ) {
159 + $this->purge_home_cache();
160 + }
161 +
162 + $this->purge_cache_by_url( get_permalink( $post ) );
163 + }
164 +
165 + /**
131 166 * Purge cache when a post is trashed.
132 167 *
133 168 * @param int $post_id Post ID
134 169 *
@@ -146,9 +181,11 @@
146 181 }
147 182 }
148 183
149 184 public function purge_taxonomy_cache( $term_id, $taxonomy ) {
185 + // :TODO
150 186 }
151 187
152 188 public function purge_archive_cache() {
189 + // :TODO
153 190 }
154 191 }