Version Description
- Added Manual 'Purge all URLs' functionality (by darren-slatten
Download this release
Release Info
Developer | saurabhshukla |
Plugin | Nginx Helper |
Version | 1.6.6 |
Comparing to | |
See all releases |
Code changes from version 1.6.5 to 1.6.6
- admin/admin.php +31 -25
- admin/assets/style.css +8 -0
- nginx-helper.php +50 -19
- purger.php +4 -2
- readme.txt +7 -4
admin/admin.php
CHANGED
@@ -91,8 +91,13 @@ namespace rtCamp\WP\Nginx {
|
|
91 |
<div class="icon32" id="icon-options-nginx"><br /></div>
|
92 |
<h2>Nginx Settings</h2>
|
93 |
<div id="content_block" class="align_left">
|
|
|
|
|
|
|
|
|
|
|
94 |
<form id="post_form" method="post" action="#" name="smart_http_expire_form">
|
95 |
-
|
96 |
|
97 |
<input type="hidden" name="is_submit" value="1" />
|
98 |
|
@@ -101,22 +106,22 @@ namespace rtCamp\WP\Nginx {
|
|
101 |
<table class="form-table">
|
102 |
<tr valign="top">
|
103 |
<td>
|
104 |
-
<label for="enable_purge"><input type="checkbox" value="1" id="enable_purge" name="enable_purge"<?php checked( $rt_wp_nginx_helper->options[ 'enable_purge' ], 1 );
|
105 |
-
|
106 |
-
<label for="enable_map"><input type="checkbox" value="1" id="enable_map" name="enable_map"<?php checked( $rt_wp_nginx_helper->options[ 'enable_map' ], 1 );
|
107 |
<?php } ?>
|
108 |
-
<label for="enable_log"><input type="checkbox" value="1" id="enable_log" name="enable_log"<?php checked( $rt_wp_nginx_helper->options[ 'enable_log' ], 1 );
|
109 |
-
<label for="enable_stamp"><input type="checkbox" value="1" id="enable_stamp" name="enable_stamp"<?php checked( $rt_wp_nginx_helper->options[ 'enable_stamp' ], 1 );
|
110 |
</td>
|
111 |
</tr>
|
112 |
</table>
|
113 |
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
<h3<?php echo $displayvar; ?>>Purging Options</h3>
|
121 |
|
122 |
<table class="form-table rtnginx-table"<?php echo $displayvar; ?>>
|
@@ -184,10 +189,10 @@ namespace rtCamp\WP\Nginx {
|
|
184 |
</tr>
|
185 |
</table>
|
186 |
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
<h3>Nginx Map</h3>
|
192 |
<?php if ( ! is_writable( RT_WP_NGINX_HELPER_PATH . 'map.conf' ) ) { ?>
|
193 |
<span class="error fade" style="display : block"><p><?php printf( __( "Can't write on map file.<br /><br />Check you have write permission on <strong>%s</strong>", "rt_wp_nginx_helper" ), RT_WP_NGINX_HELPER_PATH . 'map.conf' ); ?></p></span>
|
@@ -200,7 +205,7 @@ namespace rtCamp\WP\Nginx {
|
|
200 |
<small>(recommended)</small>
|
201 |
</th>
|
202 |
<td>
|
203 |
-
|
204 |
</td>
|
205 |
</tr>
|
206 |
<tr>
|
@@ -215,12 +220,12 @@ namespace rtCamp\WP\Nginx {
|
|
215 |
</tr>
|
216 |
</table>
|
217 |
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
<h3>Logging</h3>
|
222 |
|
223 |
-
|
224 |
<span class="error fade" style="display : block"><p><?php printf( __( "Can't write on log file.<br /><br />Check you have write permission on <strong>%s</strong>", "rt_wp_nginx_helper" ), RT_WP_NGINX_HELPER_PATH . 'nginx.log' ); ?></p></span>
|
225 |
<?php } ?>
|
226 |
|
@@ -251,7 +256,7 @@ namespace rtCamp\WP\Nginx {
|
|
251 |
<th><label for="log_filesize"><?php _e( 'Max log file size', 'rt_wp_nginx_helper' ); ?></label></th>
|
252 |
<td>
|
253 |
<input id="log_filesize" class="small-text" type="text" name="log_filesize" value="<?php echo $rt_wp_nginx_helper->options[ 'log_filesize' ] ?>" /> Mb
|
254 |
-
|
255 |
<span class="error fade" style="display : block"><p><strong><?php echo $error_log_filesize; ?></strong></p></span>
|
256 |
<?php } ?>
|
257 |
</td>
|
@@ -260,16 +265,17 @@ namespace rtCamp\WP\Nginx {
|
|
260 |
</table>
|
261 |
|
262 |
<br />
|
263 |
-
|
264 |
<?php } ?>
|
265 |
|
266 |
<p class="submit">
|
267 |
<input type="submit" name="smart_http_expire_save" class="button-primary" value="Save" />
|
268 |
</p>
|
269 |
</form>
|
|
|
270 |
</div>
|
271 |
<div id="rtads" class="metabox-holder align_left">
|
272 |
-
|
273 |
</div>
|
274 |
</div>
|
275 |
<?php
|
@@ -315,4 +321,4 @@ namespace rtCamp\WP\Nginx {
|
|
315 |
}
|
316 |
|
317 |
}
|
318 |
-
?>
|
91 |
<div class="icon32" id="icon-options-nginx"><br /></div>
|
92 |
<h2>Nginx Settings</h2>
|
93 |
<div id="content_block" class="align_left">
|
94 |
+
<form id="purgeall" action="" method="post">
|
95 |
+
<?php $purge_url = add_query_arg( array( 'nginx_helper_action' => 'purge', 'nginx_helper_urls' => 'all' ) ); ?>
|
96 |
+
<?php $nonced_url = wp_nonce_url( $purge_url, 'nginx_helper-purge_all' ); ?>
|
97 |
+
<a href="<?php echo $nonced_url; ?>" class="button-primary">Purge all URLs</a>
|
98 |
+
</form>
|
99 |
<form id="post_form" method="post" action="#" name="smart_http_expire_form">
|
100 |
+
<?php if ( ! ( ! is_network_admin() && is_multisite()) ) { ?>
|
101 |
|
102 |
<input type="hidden" name="is_submit" value="1" />
|
103 |
|
106 |
<table class="form-table">
|
107 |
<tr valign="top">
|
108 |
<td>
|
109 |
+
<label for="enable_purge"><input type="checkbox" value="1" id="enable_purge" name="enable_purge"<?php checked( $rt_wp_nginx_helper->options[ 'enable_purge' ], 1 ); ?>> Enable Cache Purge (requires external settings for nginx).</label><br />
|
110 |
+
<?php if ( is_network_admin() ) { ?>
|
111 |
+
<label for="enable_map"><input type="checkbox" value="1" id="enable_map" name="enable_map"<?php checked( $rt_wp_nginx_helper->options[ 'enable_map' ], 1 ); ?>> Enable Nginx Map.</label><br />
|
112 |
<?php } ?>
|
113 |
+
<label for="enable_log"><input type="checkbox" value="1" id="enable_log" name="enable_log"<?php checked( $rt_wp_nginx_helper->options[ 'enable_log' ], 1 ); ?>> Enable Logging</label><br />
|
114 |
+
<label for="enable_stamp"><input type="checkbox" value="1" id="enable_stamp" name="enable_stamp"<?php checked( $rt_wp_nginx_helper->options[ 'enable_stamp' ], 1 ); ?>> Enable Nginx Timestamp in HTML</label>
|
115 |
</td>
|
116 |
</tr>
|
117 |
</table>
|
118 |
|
119 |
+
<?php
|
120 |
+
$displayvar = '';
|
121 |
+
if ( $rt_wp_nginx_helper->options[ 'enable_purge' ] == false ) {
|
122 |
+
$displayvar = ' style="display:none"';
|
123 |
+
}
|
124 |
+
?>
|
125 |
<h3<?php echo $displayvar; ?>>Purging Options</h3>
|
126 |
|
127 |
<table class="form-table rtnginx-table"<?php echo $displayvar; ?>>
|
189 |
</tr>
|
190 |
</table>
|
191 |
|
192 |
+
<?php
|
193 |
+
}
|
194 |
+
if ( is_network_admin() && $rt_wp_nginx_helper->options[ 'enable_map' ] != false ) {
|
195 |
+
?>
|
196 |
<h3>Nginx Map</h3>
|
197 |
<?php if ( ! is_writable( RT_WP_NGINX_HELPER_PATH . 'map.conf' ) ) { ?>
|
198 |
<span class="error fade" style="display : block"><p><?php printf( __( "Can't write on map file.<br /><br />Check you have write permission on <strong>%s</strong>", "rt_wp_nginx_helper" ), RT_WP_NGINX_HELPER_PATH . 'map.conf' ); ?></p></span>
|
205 |
<small>(recommended)</small>
|
206 |
</th>
|
207 |
<td>
|
208 |
+
<?php echo RT_WP_NGINX_HELPER_PATH . 'map.conf'; ?>
|
209 |
</td>
|
210 |
</tr>
|
211 |
<tr>
|
220 |
</tr>
|
221 |
</table>
|
222 |
|
223 |
+
<?php
|
224 |
+
if ( $rt_wp_nginx_helper->options[ 'enable_log' ] != false ) {
|
225 |
+
?>
|
226 |
<h3>Logging</h3>
|
227 |
|
228 |
+
<?php if ( ! is_writable( RT_WP_NGINX_HELPER_PATH . 'nginx.log' ) ) { ?>
|
229 |
<span class="error fade" style="display : block"><p><?php printf( __( "Can't write on log file.<br /><br />Check you have write permission on <strong>%s</strong>", "rt_wp_nginx_helper" ), RT_WP_NGINX_HELPER_PATH . 'nginx.log' ); ?></p></span>
|
230 |
<?php } ?>
|
231 |
|
256 |
<th><label for="log_filesize"><?php _e( 'Max log file size', 'rt_wp_nginx_helper' ); ?></label></th>
|
257 |
<td>
|
258 |
<input id="log_filesize" class="small-text" type="text" name="log_filesize" value="<?php echo $rt_wp_nginx_helper->options[ 'log_filesize' ] ?>" /> Mb
|
259 |
+
<?php if ( $error_log_filesize ) { ?>
|
260 |
<span class="error fade" style="display : block"><p><strong><?php echo $error_log_filesize; ?></strong></p></span>
|
261 |
<?php } ?>
|
262 |
</td>
|
265 |
</table>
|
266 |
|
267 |
<br />
|
268 |
+
<?php } ?>
|
269 |
<?php } ?>
|
270 |
|
271 |
<p class="submit">
|
272 |
<input type="submit" name="smart_http_expire_save" class="button-primary" value="Save" />
|
273 |
</p>
|
274 |
</form>
|
275 |
+
|
276 |
</div>
|
277 |
<div id="rtads" class="metabox-holder align_left">
|
278 |
+
<?php $this->default_admin_sidebar(); ?>
|
279 |
</div>
|
280 |
</div>
|
281 |
<?php
|
321 |
}
|
322 |
|
323 |
}
|
324 |
+
?>
|
admin/assets/style.css
CHANGED
@@ -18,6 +18,14 @@ div#rtads{ width:30%}
|
|
18 |
.align_left, .alignleft {
|
19 |
float: left;
|
20 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
#social .inside a {
|
23 |
background: url(rtp-social-icons-32-32.png) no-repeat;
|
18 |
.align_left, .alignleft {
|
19 |
float: left;
|
20 |
}
|
21 |
+
form#purgeall .button-primary{
|
22 |
+
float: right;
|
23 |
+
margin-right: 100px;
|
24 |
+
height: 32px;
|
25 |
+
line-height: 32px;
|
26 |
+
font-weight: bold;
|
27 |
+
font-size: 16px;
|
28 |
+
}
|
29 |
|
30 |
#social .inside a {
|
31 |
background: url(rtp-social-icons-32-32.png) no-repeat;
|
nginx-helper.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name: Nginx Helper
|
4 |
-
Plugin URI: http://rtcamp.com/
|
5 |
-
Description: An nginx helper that serves various functions.
|
6 |
-
Version: 1.6.
|
7 |
-
Author: rtCamp
|
8 |
-
Author URI: http://rtcamp.com
|
9 |
-
Requires at least: 3.0
|
10 |
-
Tested up to: 3.4.2
|
11 |
*/
|
12 |
|
13 |
namespace rtCamp\WP\Nginx {
|
@@ -42,7 +42,7 @@ namespace rtCamp\WP\Nginx {
|
|
42 |
|
43 |
global $rt_wp_nginx_purger;
|
44 |
add_action( 'shutdown', array( &$this, 'add_timestamps' ), 99999 );
|
45 |
-
add_action( 'add_init', array(&$this, 'update_map') );
|
46 |
|
47 |
add_action( 'publish_post', array( &$rt_wp_nginx_purger, 'purgePost' ), 200, 1 );
|
48 |
add_action( 'publish_page', array( &$rt_wp_nginx_purger, 'purgePost' ), 200, 1 );
|
@@ -74,6 +74,7 @@ namespace rtCamp\WP\Nginx {
|
|
74 |
add_action( 'delete_term', array( &$rt_wp_nginx_purger, 'purge_on_term_taxonomy_edited' ), 20, 3 );
|
75 |
|
76 |
add_action( 'check_ajax_referer', array( &$rt_wp_nginx_purger, 'purge_on_check_ajax_referer' ), 20, 2 );
|
|
|
77 |
}
|
78 |
|
79 |
function activate() {
|
@@ -213,23 +214,23 @@ namespace rtCamp\WP\Nginx {
|
|
213 |
|
214 |
|
215 |
if ( $rt_all_blogs )
|
216 |
-
foreach ( $rt_all_blogs as $blog ){
|
217 |
-
if ( SUBDOMAIN_INSTALL == "yes" ){
|
218 |
-
$rt_nginx_map_array[$blog->domain] = $blog->blog_id;
|
219 |
-
}else{
|
220 |
-
if ( $blog->blog_id != 1 ){
|
221 |
-
$rt_nginx_map_array[$blog->path] = $blog->blog_id;
|
222 |
}
|
223 |
}
|
224 |
}
|
225 |
|
226 |
-
if ( $rt_domain_map_sites ){
|
227 |
-
foreach ( $rt_domain_map_sites as $site ){
|
228 |
-
$rt_nginx_map_array[$site->domain] = $site->blog_id;
|
229 |
}
|
230 |
}
|
231 |
|
232 |
-
foreach ( $rt_nginx_map_array as $domain
|
233 |
$rt_nginx_map .= "\t" . $domain . "\t" . $domain_id . ";\n";
|
234 |
}
|
235 |
|
@@ -265,6 +266,36 @@ namespace rtCamp\WP\Nginx {
|
|
265 |
echo $timestamps;
|
266 |
}
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
}
|
269 |
|
270 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: Nginx Helper
|
4 |
+
Plugin URI: http://rtcamp.com/
|
5 |
+
Description: An nginx helper that serves various functions.
|
6 |
+
Version: 1.6.6
|
7 |
+
Author: rtCamp
|
8 |
+
Author URI: http://rtcamp.com
|
9 |
+
Requires at least: 3.0
|
10 |
+
Tested up to: 3.4.2
|
11 |
*/
|
12 |
|
13 |
namespace rtCamp\WP\Nginx {
|
42 |
|
43 |
global $rt_wp_nginx_purger;
|
44 |
add_action( 'shutdown', array( &$this, 'add_timestamps' ), 99999 );
|
45 |
+
add_action( 'add_init', array( &$this, 'update_map' ) );
|
46 |
|
47 |
add_action( 'publish_post', array( &$rt_wp_nginx_purger, 'purgePost' ), 200, 1 );
|
48 |
add_action( 'publish_page', array( &$rt_wp_nginx_purger, 'purgePost' ), 200, 1 );
|
74 |
add_action( 'delete_term', array( &$rt_wp_nginx_purger, 'purge_on_term_taxonomy_edited' ), 20, 3 );
|
75 |
|
76 |
add_action( 'check_ajax_referer', array( &$rt_wp_nginx_purger, 'purge_on_check_ajax_referer' ), 20, 2 );
|
77 |
+
add_action( 'admin_init', array( &$this, 'purge_all' ) );
|
78 |
}
|
79 |
|
80 |
function activate() {
|
214 |
|
215 |
|
216 |
if ( $rt_all_blogs )
|
217 |
+
foreach ( $rt_all_blogs as $blog ) {
|
218 |
+
if ( SUBDOMAIN_INSTALL == "yes" ) {
|
219 |
+
$rt_nginx_map_array[ $blog->domain ] = $blog->blog_id;
|
220 |
+
} else {
|
221 |
+
if ( $blog->blog_id != 1 ) {
|
222 |
+
$rt_nginx_map_array[ $blog->path ] = $blog->blog_id;
|
223 |
}
|
224 |
}
|
225 |
}
|
226 |
|
227 |
+
if ( $rt_domain_map_sites ) {
|
228 |
+
foreach ( $rt_domain_map_sites as $site ) {
|
229 |
+
$rt_nginx_map_array[ $site->domain ] = $site->blog_id;
|
230 |
}
|
231 |
}
|
232 |
|
233 |
+
foreach ( $rt_nginx_map_array as $domain => $domain_id ) {
|
234 |
$rt_nginx_map .= "\t" . $domain . "\t" . $domain_id . ";\n";
|
235 |
}
|
236 |
|
266 |
echo $timestamps;
|
267 |
}
|
268 |
|
269 |
+
function show_notice() {
|
270 |
+
echo '<div class="updated"><p>Purge initiated</p></div>';
|
271 |
+
}
|
272 |
+
|
273 |
+
function purge_all() {
|
274 |
+
global $rt_wp_nginx_purger;
|
275 |
+
if ( ! isset( $_REQUEST[ 'nginx_helper_action' ] ) )
|
276 |
+
return;
|
277 |
+
|
278 |
+
if ( ! current_user_can( 'manage_options' ) )
|
279 |
+
wp_die( 'Sorry, you do not have the necessary privileges to edit these options.' );
|
280 |
+
|
281 |
+
$action = $_REQUEST[ 'nginx_helper_action' ];
|
282 |
+
|
283 |
+
if ( $action == 'done' ) {
|
284 |
+
add_action( 'admin_notices', array( &$this, 'show_notice' ) );
|
285 |
+
return;
|
286 |
+
}
|
287 |
+
|
288 |
+
check_admin_referer( 'nginx_helper-purge_all' );
|
289 |
+
|
290 |
+
switch ( $action ) {
|
291 |
+
case 'purge':
|
292 |
+
$rt_wp_nginx_purger->purge_them_all();
|
293 |
+
break;
|
294 |
+
}
|
295 |
+
|
296 |
+
wp_redirect( add_query_arg( array( 'nginx_helper_action' => 'done' ) ) );
|
297 |
+
}
|
298 |
+
|
299 |
}
|
300 |
|
301 |
}
|
purger.php
CHANGED
@@ -617,9 +617,9 @@ namespace rtCamp\WP\Nginx {
|
|
617 |
}
|
618 |
}
|
619 |
|
620 |
-
|
621 |
|
622 |
-
$this->log( __( "
|
623 |
|
624 |
$this->_purge_homepage();
|
625 |
|
@@ -631,6 +631,8 @@ namespace rtCamp\WP\Nginx {
|
|
631 |
|
632 |
$this->_purge_all_date_archives();
|
633 |
|
|
|
|
|
634 |
return true;
|
635 |
}
|
636 |
|
617 |
}
|
618 |
}
|
619 |
|
620 |
+
function purge_them_all() {
|
621 |
|
622 |
+
$this->log( __( "Let's purge everything!", "rt_wp_nginx_helper" ) );
|
623 |
|
624 |
$this->_purge_homepage();
|
625 |
|
631 |
|
632 |
$this->_purge_all_date_archives();
|
633 |
|
634 |
+
$this->log( __( "Everthing purged!", "rt_wp_nginx_helper" ) );
|
635 |
+
|
636 |
return true;
|
637 |
}
|
638 |
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Nginx ===
|
2 |
-
Contributors: rtcamp, rahul286, saurabhshukla
|
3 |
Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, rewrite, permalinks
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.4.2
|
6 |
-
Stable tag: 1.6.
|
7 |
License: GPLv2 or later (of-course)
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Donate Link: http://rtcamp.com/donate/
|
@@ -105,6 +105,9 @@ Its just that we are hyperactive on our own forum!
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
108 |
= 1.6.5 =
|
109 |
* Fixed typo that interfered with archive purge settings. Thanks to [Daan Kortenbach](http://profiles.wordpress.org/daankortenbach/) for pointing this out.
|
110 |
|
@@ -192,5 +195,5 @@ Its just that we are hyperactive on our own forum!
|
|
192 |
|
193 |
== Upgrade Notice ==
|
194 |
|
195 |
-
= 1.6.
|
196 |
-
|
1 |
=== Nginx ===
|
2 |
+
Contributors: rtcamp, rahul286, saurabhshukla, darren-slatten
|
3 |
Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, rewrite, permalinks
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.4.2
|
6 |
+
Stable tag: 1.6.6
|
7 |
License: GPLv2 or later (of-course)
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Donate Link: http://rtcamp.com/donate/
|
105 |
|
106 |
== Changelog ==
|
107 |
|
108 |
+
= 1.6.6 =
|
109 |
+
* Added Manual 'Purge all URLs' functionality (by [darren-slatten](http://profiles.wordpress.org/darren-slatten/)
|
110 |
+
|
111 |
= 1.6.5 =
|
112 |
* Fixed typo that interfered with archive purge settings. Thanks to [Daan Kortenbach](http://profiles.wordpress.org/daankortenbach/) for pointing this out.
|
113 |
|
195 |
|
196 |
== Upgrade Notice ==
|
197 |
|
198 |
+
= 1.6.6 =
|
199 |
+
Added manual 'purge all urls' feature
|