Changeset 3157468
- Timestamp:
- 09/25/2024 10:56:04 AM (19 months ago)
- Location:
- ergonet-varnish-cache
- Files:
-
- 1 added
- 1 edited
- 3 copied
-
tags/1.0.9 (added)
-
tags/1.0.9/index.php (copied) (copied from ergonet-varnish-cache/trunk/index.php)
-
tags/1.0.9/readme.txt (copied) (copied from ergonet-varnish-cache/trunk/readme.txt)
-
tags/1.0.9/varnishCache.php (copied) (copied from ergonet-varnish-cache/trunk/varnishCache.php) (3 diffs)
-
trunk/varnishCache.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ergonet-varnish-cache/tags/1.0.9/varnishCache.php
r3152539 r3157468 123 123 } 124 124 125 function populateFrontPageCache() 126 { 127 $url = get_home_url(); 128 $command = $this->populateCache($url); 129 } 130 125 131 function purgeAll() 126 132 { 127 133 $url = get_home_url()."/.*"; 134 $command = $this->execCachePurge($url); 135 $url = get_home_url()."/*"; 128 136 $command = $this->execCachePurge($url); 129 137 } … … 137 145 $url = get_permalink( $post_id ); 138 146 $command = $this->execCachePurge($url); 147 } 148 149 function populatePostCache($post_id) 150 { 151 if ( wp_is_post_revision( $post_id ) ) { 152 return; 153 } 154 155 $url = get_permalink( $post_id ); 156 $command = $this->populateCache($url); 157 } 158 159 function populatePostCategoriesCache($post_id) 160 { 161 $categorie = wp_get_post_categories($post_id); 162 foreach ($categorie as $category_id) { 163 $url = get_category_link($category_id); 164 $command = $this->populateCache($url); 165 } 139 166 } 140 167 … … 146 173 $command = $this->execCachePurge($url); 147 174 } 175 } 176 177 function populateCache( $url ) 178 { 179 $url = $this->getUrl($url); 180 $params = array( 181 'method' => 'GET', 182 'user-agent' => 'wp_purgeCache', 183 'sslverify' => false, 184 'headers' => array( 185 'host' => $url['hostname'] 186 ), 187 'redirection' => 0, 188 ); 189 $response = wp_remote_request($url['url'], $params); 148 190 } 149 191 -
ergonet-varnish-cache/trunk/varnishCache.php
r3152539 r3157468 123 123 } 124 124 125 function populateFrontPageCache() 126 { 127 $url = get_home_url(); 128 $command = $this->populateCache($url); 129 } 130 125 131 function purgeAll() 126 132 { 127 133 $url = get_home_url()."/.*"; 134 $command = $this->execCachePurge($url); 135 $url = get_home_url()."/*"; 128 136 $command = $this->execCachePurge($url); 129 137 } … … 137 145 $url = get_permalink( $post_id ); 138 146 $command = $this->execCachePurge($url); 147 } 148 149 function populatePostCache($post_id) 150 { 151 if ( wp_is_post_revision( $post_id ) ) { 152 return; 153 } 154 155 $url = get_permalink( $post_id ); 156 $command = $this->populateCache($url); 157 } 158 159 function populatePostCategoriesCache($post_id) 160 { 161 $categorie = wp_get_post_categories($post_id); 162 foreach ($categorie as $category_id) { 163 $url = get_category_link($category_id); 164 $command = $this->populateCache($url); 165 } 139 166 } 140 167 … … 146 173 $command = $this->execCachePurge($url); 147 174 } 175 } 176 177 function populateCache( $url ) 178 { 179 $url = $this->getUrl($url); 180 $params = array( 181 'method' => 'GET', 182 'user-agent' => 'wp_purgeCache', 183 'sslverify' => false, 184 'headers' => array( 185 'host' => $url['hostname'] 186 ), 187 'redirection' => 0, 188 ); 189 $response = wp_remote_request($url['url'], $params); 148 190 } 149 191
Note: See TracChangeset
for help on using the changeset viewer.