Version Description
- Feature Update. Add advanced options toggle, and options for VCS check disabling and debug email.
Download this release
Release Info
Developer | chipbennett |
Plugin | Update Control |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.3 to 1.2
- readme.txt +14 -1
- update-control.php +92 -16
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: georgestephanis, chipbennett
|
|
3 |
Tags: automatic updates, updates
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 3.7
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -60,13 +60,26 @@ Plugin/Theme/Translation Updates:
|
|
60 |
* If you disable updates, Plugin, Theme, and Translation updates will also be disabled
|
61 |
* Separately enable Plugin, Theme, and Translation updates via the appropriate checkboxes
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
Update Result Emails
|
64 |
|
65 |
* By default, WordPress sends an update result email for successful, failed, and critically failed updates
|
66 |
* Selectively disable emails for each result type via the appropriate checkboxes
|
67 |
|
|
|
|
|
|
|
|
|
68 |
== Changelog ==
|
69 |
|
|
|
|
|
|
|
70 |
= 1.1.3 =
|
71 |
* Bugfix. Declare static functions to eliminate e-strict PHP notice.
|
72 |
|
3 |
Tags: automatic updates, updates
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 3.7
|
6 |
+
Stable tag: 1.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
60 |
* If you disable updates, Plugin, Theme, and Translation updates will also be disabled
|
61 |
* Separately enable Plugin, Theme, and Translation updates via the appropriate checkboxes
|
62 |
|
63 |
+
= What are advanced options? =
|
64 |
+
|
65 |
+
Disable VCS Check
|
66 |
+
|
67 |
+
* By default, WordPress will check for the existence of VCS (version control system) files, and if any are found, will not perform automatic updates. Selecting "Disable VCS Check?" will force WordPress to bypass this check, and perform updates regardless of the existence of VCS files.
|
68 |
+
|
69 |
Update Result Emails
|
70 |
|
71 |
* By default, WordPress sends an update result email for successful, failed, and critically failed updates
|
72 |
* Selectively disable emails for each result type via the appropriate checkboxes
|
73 |
|
74 |
+
Debug Email
|
75 |
+
|
76 |
+
* Enable this option to enable the debug email. This email is sent after ever occurrence of an attempted update, for core, Plugins, Themes, and translation files; and whether the attempt succeeds, fails, or fails critically.
|
77 |
+
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 1.2 =
|
81 |
+
* Feature Update. Add advanced options toggle, and options for VCS check disabling and debug email.
|
82 |
+
|
83 |
= 1.1.3 =
|
84 |
* Bugfix. Declare static functions to eliminate e-strict PHP notice.
|
85 |
|
update-control.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: http://github.com/georgestephanis/update-control/
|
5 |
* Description: Adds a manual toggle to the WordPress Admin Interface for managing auto-updates.
|
6 |
* Author: George Stephanis
|
7 |
-
* Version: 1.
|
8 |
* Author URI: http://stephanis.info/
|
9 |
*/
|
10 |
|
@@ -24,7 +24,9 @@ class Stephanis_Update_Control {
|
|
24 |
// Do these at priority 1, so other folks can easily override it.
|
25 |
|
26 |
if ( 'no' == $options['active'] ) {
|
|
|
27 |
add_filter( 'auto_upgrader_disabled', '__return_true', 1 );
|
|
|
28 |
} else {
|
29 |
|
30 |
if ( in_array( $options['core'], array( 'dev', 'major', 'minor' ) ) ) {
|
@@ -43,12 +45,20 @@ class Stephanis_Update_Control {
|
|
43 |
add_filter( 'auto_update_translation', '__return_false', 1 );
|
44 |
}
|
45 |
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
if ( 'no' == $options['emailactive'] || ! ( $options['successemail'] || $options['failureemail'] || $options['criticalemail'] ) ) {
|
49 |
-
add_filter( 'auto_core_update_send_email', '__return_false', 1 );
|
50 |
-
} else {
|
51 |
-
add_filter( 'auto_core_update_send_email', array( __CLASS__, 'filter_email' ), 1, 2 );
|
52 |
}
|
53 |
|
54 |
}
|
@@ -75,10 +85,13 @@ class Stephanis_Update_Control {
|
|
75 |
'plugin' => false,
|
76 |
'theme' => false,
|
77 |
'translation' => true,
|
|
|
|
|
78 |
'emailactive' => 'yes',
|
79 |
'successemail' => true,
|
80 |
'failureemail' => true,
|
81 |
'criticalemail' => true,
|
|
|
82 |
);
|
83 |
$args = get_option( 'update_control_options', array() );
|
84 |
return wp_parse_args( $args, $defaults );
|
@@ -144,6 +157,22 @@ class Stephanis_Update_Control {
|
|
144 |
'update-control'
|
145 |
);
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
add_settings_field(
|
148 |
'update_control_email_active',
|
149 |
sprintf( '<label for="update_control_email_active">%1$s</label>', __( 'Update Emails Enabled?', 'update-control' ) ),
|
@@ -176,6 +205,14 @@ class Stephanis_Update_Control {
|
|
176 |
'update-control'
|
177 |
);
|
178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
register_setting( 'general', 'update_control_options', array( __CLASS__, 'sanitize_options' ) );
|
180 |
}
|
181 |
|
@@ -191,17 +228,32 @@ class Stephanis_Update_Control {
|
|
191 |
<script>
|
192 |
jQuery(document).ready(function($){
|
193 |
$('#update_control_active').change(function(){
|
194 |
-
if ( 'yes' != $(this).val() )
|
195 |
$('.update_control_dependency').attr( 'readonly', 'readonly' );
|
196 |
-
|
|
|
|
|
197 |
$('.update_control_dependency' ).removeAttr( 'readonly' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
}).trigger('change');
|
199 |
|
200 |
$('#update_control_email_active').change(function(){
|
201 |
-
if ( 'yes' != $(this).val() )
|
202 |
-
$('.update_control_email_dependency').attr( 'readonly', 'readonly' );
|
203 |
-
|
204 |
-
|
|
|
|
|
|
|
205 |
}).trigger('change');
|
206 |
});
|
207 |
</script>
|
@@ -251,9 +303,24 @@ class Stephanis_Update_Control {
|
|
251 |
<?php
|
252 |
}
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
public static function update_control_email_active_cb() {
|
255 |
?>
|
256 |
-
<select id="update_control_email_active" name="update_control_options[emailactive]">
|
257 |
<option <?php selected( 'yes' == self::get_option( 'emailactive' ) ); ?> value="yes"><?php _e( 'Yes', 'update-control' ); ?></option>
|
258 |
<option <?php selected( 'no' == self::get_option( 'emailactive' ) ); ?> value="no"><?php _e( 'No', 'update-control' ); ?></option>
|
259 |
</select>
|
@@ -262,19 +329,25 @@ class Stephanis_Update_Control {
|
|
262 |
|
263 |
public static function update_control_email_success_cb() {
|
264 |
?>
|
265 |
-
<input type="checkbox" class="update_control_email_dependency" id="update_control_email_success" name="update_control_options[successemail]" <?php checked( self::get_option( 'successemail' ) ); ?> />
|
266 |
<?php
|
267 |
}
|
268 |
|
269 |
public static function update_control_email_failure_cb() {
|
270 |
?>
|
271 |
-
<input type="checkbox" class="update_control_email_dependency" id="update_control_email_failure" name="update_control_options[failureemail]" <?php checked( self::get_option( 'failureemail' ) ); ?> />
|
272 |
<?php
|
273 |
}
|
274 |
|
275 |
public static function update_control_email_critical_cb() {
|
276 |
?>
|
277 |
-
<input type="checkbox" class="update_control_email_dependency" id="update_control_email_critical" name="update_control_options[criticalemail]" <?php checked( self::get_option( 'criticalemail' ) ); ?> />
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
<?php
|
279 |
}
|
280 |
|
@@ -286,10 +359,13 @@ class Stephanis_Update_Control {
|
|
286 |
$options['plugin'] = ! empty( $options['plugin'] );
|
287 |
$options['theme'] = ! empty( $options['theme'] );
|
288 |
$options['translation'] = ! empty( $options['translation'] );
|
|
|
|
|
289 |
$options['emailactive'] = ( in_array( $options['emailactive'], array( 'yes', 'no' ) ) ? $options['emailactive'] : 'yes' );
|
290 |
$options['successemail'] = ! empty( $options['successemail'] );
|
291 |
$options['failureemail'] = ! empty( $options['failureemail'] );
|
292 |
$options['criticalemail'] = ! empty( $options['criticalemail'] );
|
|
|
293 |
|
294 |
return $options;
|
295 |
}
|
4 |
* Plugin URI: http://github.com/georgestephanis/update-control/
|
5 |
* Description: Adds a manual toggle to the WordPress Admin Interface for managing auto-updates.
|
6 |
* Author: George Stephanis
|
7 |
+
* Version: 1.2
|
8 |
* Author URI: http://stephanis.info/
|
9 |
*/
|
10 |
|
24 |
// Do these at priority 1, so other folks can easily override it.
|
25 |
|
26 |
if ( 'no' == $options['active'] ) {
|
27 |
+
|
28 |
add_filter( 'auto_upgrader_disabled', '__return_true', 1 );
|
29 |
+
|
30 |
} else {
|
31 |
|
32 |
if ( in_array( $options['core'], array( 'dev', 'major', 'minor' ) ) ) {
|
45 |
add_filter( 'auto_update_translation', '__return_false', 1 );
|
46 |
}
|
47 |
|
48 |
+
if ( $options['vcscheck'] ) {
|
49 |
+
add_filter( 'automatic_updates_is_vcs_checkout', '__return_true', 1 );
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( 'no' == $options['emailactive'] || ! ( $options['successemail'] || $options['failureemail'] || $options['criticalemail'] ) ) {
|
53 |
+
add_filter( 'auto_core_update_send_email', '__return_false', 1 );
|
54 |
+
} else {
|
55 |
+
add_filter( 'auto_core_update_send_email', array( __CLASS__, 'filter_email' ), 1, 2 );
|
56 |
+
}
|
57 |
+
|
58 |
+
if ( $options['debugemail'] ) {
|
59 |
+
add_filter( 'automatic_updates_send_debug_email ', '__return_true', 1 );
|
60 |
+
}
|
61 |
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
|
64 |
}
|
85 |
'plugin' => false,
|
86 |
'theme' => false,
|
87 |
'translation' => true,
|
88 |
+
'toggleadvanced' => 'no',
|
89 |
+
'vcscheck' => true,
|
90 |
'emailactive' => 'yes',
|
91 |
'successemail' => true,
|
92 |
'failureemail' => true,
|
93 |
'criticalemail' => true,
|
94 |
+
'debugemail' => false,
|
95 |
);
|
96 |
$args = get_option( 'update_control_options', array() );
|
97 |
return wp_parse_args( $args, $defaults );
|
157 |
'update-control'
|
158 |
);
|
159 |
|
160 |
+
add_settings_field(
|
161 |
+
'update_control_toggleadvanced',
|
162 |
+
sprintf( '<label for="update_control_toggleadvanced">%1$s</label>', __( 'Configure Advanced Options?', 'update-control' ) ),
|
163 |
+
array( __CLASS__, 'update_control_toggleadvanced_cb' ),
|
164 |
+
'general',
|
165 |
+
'update-control'
|
166 |
+
);
|
167 |
+
|
168 |
+
add_settings_field(
|
169 |
+
'update_control_vcscheck',
|
170 |
+
sprintf( '<label for="update_control_vcscheck">%1$s</label>', __( 'Disable VCS Check?', 'update-control' ) ),
|
171 |
+
array( __CLASS__, 'update_control_vcscheck_cb' ),
|
172 |
+
'general',
|
173 |
+
'update-control'
|
174 |
+
);
|
175 |
+
|
176 |
add_settings_field(
|
177 |
'update_control_email_active',
|
178 |
sprintf( '<label for="update_control_email_active">%1$s</label>', __( 'Update Emails Enabled?', 'update-control' ) ),
|
205 |
'update-control'
|
206 |
);
|
207 |
|
208 |
+
add_settings_field(
|
209 |
+
'update_control_email_debug',
|
210 |
+
sprintf( '<label for="update_control_email_debug">%1$s</label>', __( 'Send Update Debug Emails?', 'update-control' ) ),
|
211 |
+
array( __CLASS__, 'update_control_email_debug_cb' ),
|
212 |
+
'general',
|
213 |
+
'update-control'
|
214 |
+
);
|
215 |
+
|
216 |
register_setting( 'general', 'update_control_options', array( __CLASS__, 'sanitize_options' ) );
|
217 |
}
|
218 |
|
228 |
<script>
|
229 |
jQuery(document).ready(function($){
|
230 |
$('#update_control_active').change(function(){
|
231 |
+
if ( 'yes' != $(this).val() ) {
|
232 |
$('.update_control_dependency').attr( 'readonly', 'readonly' );
|
233 |
+
$('#update_control_toggleadvanced').val('no');
|
234 |
+
$('.update_control_advanced' ).parent().parent().css( 'display', 'none' );
|
235 |
+
} else {
|
236 |
$('.update_control_dependency' ).removeAttr( 'readonly' );
|
237 |
+
}
|
238 |
+
}).trigger('change');
|
239 |
+
|
240 |
+
$('#update_control_toggleadvanced').change(function(){
|
241 |
+
if ( 'no' != $(this).val() ) {
|
242 |
+
$('.update_control_advanced').parent().parent().css( { 'display' : 'table-row' } );
|
243 |
+
$('.update_control_advanced').parent().siblings( 'th' ).css( { 'display' : 'block', 'padding-left' : '20px' } );
|
244 |
+
} else {
|
245 |
+
$('.update_control_advanced' ).parent().parent().css( 'display', 'none' );
|
246 |
+
}
|
247 |
}).trigger('change');
|
248 |
|
249 |
$('#update_control_email_active').change(function(){
|
250 |
+
if ( 'yes' != $(this).val() ) {
|
251 |
+
$('.update_control_email_dependency.update_control_advanced').attr( 'readonly', 'readonly' );
|
252 |
+
$('.update_control_email_dependency.update_control_advanced').parent().siblings( 'th' ).children().css( { 'padding-left' : '20px', 'display' : 'block' } );
|
253 |
+
} else {
|
254 |
+
$('.update_control_email_dependency.update_control_advanced' ).removeAttr( 'readonly' );
|
255 |
+
$('.update_control_email_dependency.update_control_advanced').parent().siblings( 'th' ).children().css( { 'padding-left' : '20px', 'display' : 'block' } );
|
256 |
+
}
|
257 |
}).trigger('change');
|
258 |
});
|
259 |
</script>
|
303 |
<?php
|
304 |
}
|
305 |
|
306 |
+
public static function update_control_toggleadvanced_cb() {
|
307 |
+
?>
|
308 |
+
<select class="update_control_dependency" id="update_control_toggleadvanced" name="update_control_options[toggleadvanced]">
|
309 |
+
<option <?php selected( 'yes' == self::get_option( 'toggleadvanced' ) ); ?> value="yes"><?php _e( 'Yes', 'update-control' ); ?></option>
|
310 |
+
<option <?php selected( 'no' == self::get_option( 'toggleadvanced' ) ); ?> value="no"><?php _e( 'No', 'update-control' ); ?></option>
|
311 |
+
</select>
|
312 |
+
<?php
|
313 |
+
}
|
314 |
+
|
315 |
+
public static function update_control_vcscheck_cb() {
|
316 |
+
?>
|
317 |
+
<input type="checkbox" class="update_control_advanced" id="update_control_vcscheck" name="update_control_options[vcscheck]" <?php checked( self::get_option( 'vcscheck' ) ); ?> />
|
318 |
+
<?php
|
319 |
+
}
|
320 |
+
|
321 |
public static function update_control_email_active_cb() {
|
322 |
?>
|
323 |
+
<select class="update_control_advanced" id="update_control_email_active" name="update_control_options[emailactive]">
|
324 |
<option <?php selected( 'yes' == self::get_option( 'emailactive' ) ); ?> value="yes"><?php _e( 'Yes', 'update-control' ); ?></option>
|
325 |
<option <?php selected( 'no' == self::get_option( 'emailactive' ) ); ?> value="no"><?php _e( 'No', 'update-control' ); ?></option>
|
326 |
</select>
|
329 |
|
330 |
public static function update_control_email_success_cb() {
|
331 |
?>
|
332 |
+
<input type="checkbox" class="update_control_email_dependency update_control_advanced" id="update_control_email_success" name="update_control_options[successemail]" <?php checked( self::get_option( 'successemail' ) ); ?> />
|
333 |
<?php
|
334 |
}
|
335 |
|
336 |
public static function update_control_email_failure_cb() {
|
337 |
?>
|
338 |
+
<input type="checkbox" class="update_control_email_dependency update_control_advanced" id="update_control_email_failure" name="update_control_options[failureemail]" <?php checked( self::get_option( 'failureemail' ) ); ?> />
|
339 |
<?php
|
340 |
}
|
341 |
|
342 |
public static function update_control_email_critical_cb() {
|
343 |
?>
|
344 |
+
<input type="checkbox" class="update_control_email_dependency update_control_advanced" id="update_control_email_critical" name="update_control_options[criticalemail]" <?php checked( self::get_option( 'criticalemail' ) ); ?> />
|
345 |
+
<?php
|
346 |
+
}
|
347 |
+
|
348 |
+
public static function update_control_email_debug_cb() {
|
349 |
+
?>
|
350 |
+
<input type="checkbox" class="update_control_advanced" id="update_control_email_debug" name="update_control_options[debugemail]" <?php checked( self::get_option( 'debugemail' ) ); ?> />
|
351 |
<?php
|
352 |
}
|
353 |
|
359 |
$options['plugin'] = ! empty( $options['plugin'] );
|
360 |
$options['theme'] = ! empty( $options['theme'] );
|
361 |
$options['translation'] = ! empty( $options['translation'] );
|
362 |
+
$options['toggleadvanced'] = 'no';
|
363 |
+
$options['vcscheck'] = ! empty( $options['vcscheck'] );
|
364 |
$options['emailactive'] = ( in_array( $options['emailactive'], array( 'yes', 'no' ) ) ? $options['emailactive'] : 'yes' );
|
365 |
$options['successemail'] = ! empty( $options['successemail'] );
|
366 |
$options['failureemail'] = ! empty( $options['failureemail'] );
|
367 |
$options['criticalemail'] = ! empty( $options['criticalemail'] );
|
368 |
+
$options['debugemail'] = ! empty( $options['debugemail'] );
|
369 |
|
370 |
return $options;
|
371 |
}
|