Companion Auto Update - Version 3.5.5

Version Description

(August 5, 2020) = * Fix: Added better multisite support * Better status log: We've added a bunch more checks and you can now see more passed checks. * Support for WordPress 5.5

Download this release

Release Info

Developer Papin
Plugin Icon 128x128 Companion Auto Update
Version 3.5.5
Comparing to
See all releases

Code changes from version 3.5.4.1 to 3.5.5

Files changed (4) hide show
  1. admin/status.php +90 -85
  2. cau_functions.php +49 -0
  3. companion-auto-update.php +22 -5
  4. readme.txt +7 -2
admin/status.php CHANGED
@@ -166,6 +166,21 @@
166
 
167
  $schedules = wp_get_schedules();
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  ?>
170
 
171
  <h2><?php _e('Status', 'companion-auto-update'); ?></h2>
@@ -244,103 +259,93 @@
244
 
245
  </table>
246
 
247
- <?php
248
-
249
- if( get_option( 'blog_public' ) == 0 ) { ?>
250
-
251
- <table class="cau_status_list widefat striped cau_status_warnings">
252
-
253
- <thead>
254
- <tr>
255
- <th class="cau_plugin_issue_name"><strong><?php _e( 'Search Engine Visibility' ); ?></strong></th>
256
- <th class="cau_plugin_issue_explain"> </th>
257
- <th class="cau_plugin_issue_fixit"><strong><?php _e( 'Fix it', 'companion-auto-update' ); ?></strong></th>
258
- </tr>
259
- </thead>
260
-
261
- <tbody id="the-list">
262
- <tr>
263
- <td class="cau_plugin_issue_name"><span class='cau_warning'><span class="dashicons dashicons-warning"></span> <?php _e( 'Warning', 'companion-auto-update' ); ?></span></td>
264
- <td class="cau_plugin_issue_explain">
265
- <?php _e( 'You’ve chosen to disscourage Search Engines from indexing your site. Auto-updating works best on sites with more traffic, consider enabling indexing for your site.', 'companion-auto-update' ); ?>
266
- </td>
267
- <td class="cau_plugin_issue_fixit">
268
- <a href="<?php echo admin_url( 'options-reading.php' ); ?>" class="button button-alt"><?php _e( 'Fix it', 'companion-auto-update' ); ?></a>
269
- </td>
270
- </tr>
271
- </tbody>
272
-
273
- </table>
274
-
275
- <?php }
276
 
277
- if( checkAutomaticUpdaterDisabled() ) { ?>
 
 
 
 
278
 
279
- <table class="cau_status_list widefat striped cau_status_warnings">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
 
281
- <thead>
282
- <tr>
283
- <th class="cau_plugin_issue_name"><strong><?php _e( 'Critical Error', 'companion-auto-update' ); ?></strong></th>
284
- <th class="cau_plugin_issue_explain"> </th>
285
- <th class="cau_plugin_issue_explain"> </th>
286
- <th class="cau_plugin_issue_fixit"><strong><?php _e( 'How to fix', 'companion-auto-update' ); ?></strong></th>
287
- </tr>
288
- </thead>
 
 
 
 
289
 
290
- <tbody id="the-list">
291
- <tr>
292
- <td class="cau_plugin_issue_name"><span class='cau_disabled'><span class="dashicons dashicons-no"></span> <?php _e( 'Critical Error', 'companion-auto-update' ); ?></span></td>
293
- <td class="cau_plugin_issue_explain">
294
- <?php _e( 'Updating is globally disabled.', 'companion-auto-update' ); ?>
295
- </td>
296
- <td class="cau_plugin_issue_explain">
297
- <code>AUTOMATIC_UPDATER_DISABLED true</code>
298
- </td>
299
- <td class="cau_plugin_issue_fixit">
300
  <form method="POST">
301
  <?php wp_nonce_field( 'cau_fixit' ); ?>
302
  <button type="submit" name="fixit" class="button button-primary"><?php _e( 'Fix it', 'companion-auto-update' ); ?></button>
303
- <a href="<?php echo cau_url( 'support' ); ?>" class="button"><?php _e( 'Contact for support', 'companion-auto-update' ); ?></a>
304
  </form>
305
  </td>
306
- </tr>
307
- </tbody>
308
-
309
- </table>
310
-
311
- <?php }
312
-
313
- if( checkCronjobsDisabled() ) { ?>
314
-
315
- <table class="cau_status_list widefat striped cau_status_warnings">
316
 
317
- <thead>
318
- <tr>
319
- <th class="cau_plugin_issue_name"><strong><?php _e( 'Warning', 'companion-auto-update' ); ?></strong></th>
320
- <th class="cau_plugin_issue_explain"> </th>
321
- <th class="cau_plugin_issue_explain"> </th>
322
- <th class="cau_plugin_issue_fixit"><strong><?php _e( 'How to fix', 'companion-auto-update' ); ?></strong></th>
323
- </tr>
324
- </thead>
325
 
326
- <tbody id="the-list">
327
- <tr>
328
- <td class="cau_plugin_issue_name"><span class='cau_warning'><span class="dashicons dashicons-warning"></span> <?php _e( 'Warning', 'companion-auto-update' ); ?></span></td>
329
- <td class="cau_plugin_issue_explain">
330
- <?php _e( 'Cronjobs are disabled.', 'companion-auto-update' ); ?>
331
- </td>
332
- <td class="cau_plugin_issue_explain">
333
- <code>DISABLE_WP_CRON true</code>
334
- </td>
335
- <td class="cau_plugin_issue_fixit">
336
- <a href="<?php echo cau_url( 'support' ); ?>" class="button"><?php _e( 'Contact for support', 'companion-auto-update' ); ?></a>
337
- </td>
338
- </tr>
339
- </tbody>
340
 
341
- </table>
342
 
343
- <?php }
344
 
345
  // Remove the line
346
  if( isset( $_POST['fixit'] ) ) {
@@ -435,7 +440,7 @@ if( cau_incompatiblePlugins() ) { ?>
435
 
436
  <tbody id="the-list">
437
  <tr>
438
- <td width="200">WordPress</td>
439
  <td><?php echo get_bloginfo( 'version' ); ?></td>
440
  </tr>
441
  <tr>
166
 
167
  $schedules = wp_get_schedules();
168
 
169
+ $support = wp_http_supports( array( 'ssl' ) );
170
+ switch ($support) {
171
+ case '1':
172
+ $wpORGStatus = 'enabled';
173
+ $wpORGIcon = 'yes-alt';
174
+ $wpORGText = __( 'Enabled', 'companion-auto-update' );;
175
+ break;
176
+ default:
177
+ $wpORGStatus = 'disabled';
178
+ $wpORGIcon = 'no';
179
+ $wpORGText = __( 'Disabled', 'companion-auto-update' );;
180
+ break;
181
+ }
182
+
183
+
184
  ?>
185
 
186
  <h2><?php _e('Status', 'companion-auto-update'); ?></h2>
259
 
260
  </table>
261
 
262
+ <table class="cau_status_list widefat striped cau_status_warnings">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
 
264
+ <thead>
265
+ <tr>
266
+ <th class="cau_plugin_issue_name" colspan="4"><strong><?php _e( 'Status' ); ?></strong></th>
267
+ </tr>
268
+ </thead>
269
 
270
+ <tbody id="the-list">
271
+
272
+ <tr>
273
+ <td width="300"><?php _e( 'Connection with WordPress.org', 'companion-auto-update' ); ?></td>
274
+ <td class="cau_status_active_state"><span class='cau_<?php echo $wpORGStatus; ?>'><span class="dashicons dashicons-<?php echo $wpORGIcon; ?>"></span> <?php echo $wpORGText; ?></span></td>
275
+ <td></td>
276
+ <td></td>
277
+ </tr>
278
+
279
+ <tr>
280
+ <td><?php _e( 'Search Engine Visibility', 'companion-auto-update' ); ?></td>
281
+ <?php if( get_option( 'blog_public' ) == 0 ) { ?>
282
+ <td class="cau_status_active_state"><span class='cau_disabled'><span class="dashicons dashicons-warning"></span> <?php _e( 'Disabled', 'companion-auto-update' ); ?></span></td>
283
+ <td><?php _e( 'You’ve chosen to disscourage Search Engines from indexing your site. Auto-updating works best on sites with more traffic, consider enabling indexing for your site.', 'companion-auto-update' ); ?></td>
284
+ <td><a href="<?php echo admin_url( 'options-reading.php' ); ?>" class="button button-alt"><?php _e( 'Fix it', 'companion-auto-update' ); ?></a></td>
285
+ <?php } else { ?>
286
+ <td class="cau_status_active_state"><span class='cau_enabled'><span class="dashicons dashicons-yes-alt"></span> <?php _e( 'Enabled', 'companion-auto-update' ); ?></span></td>
287
+ <td></td>
288
+ <td></td>
289
+ <?php } ?>
290
+ </tr>
291
+
292
+ <tr>
293
+ <td><?php _e( 'Cronjobs', 'companion-auto-update' ); ?></td>
294
+ <?php if( checkCronjobsDisabled() ) { ?>
295
+ <td class="cau_status_active_state"><span class='cau_disabled'><span class="dashicons dashicons-warning"></span> <?php _e( 'Disabled', 'companion-auto-update' ); ?></span></td>
296
+ <td><code>DISABLE_WP_CRON true</code></td>
297
+ <td><a href="https://codeermeneer.nl/contact/" class="button"><?php _e( 'Contact for support', 'companion-auto-update' ); ?></a></td>
298
+ <?php } else { ?>
299
+ <td class="cau_status_active_state"><span class='cau_enabled'><span class="dashicons dashicons-yes-alt"></span> <?php _e( 'Enabled', 'companion-auto-update' ); ?></span></td>
300
+ <td></td>
301
+ <td></td>
302
+ <?php } ?>
303
+ </tr>
304
 
305
+ <tr>
306
+ <td>wp_version_check</td>
307
+ <?php if ( !has_filter( 'wp_version_check', 'wp_version_check' ) ) { ?>
308
+ <td class="cau_status_active_state"><span class='cau_disabled'><span class="dashicons dashicons-no"></span> <?php _e( 'Disabled', 'companion-auto-update' ); ?></span></td>
309
+ <td><?php sprintf( __( 'A plugin has prevented updates by disabling <code>%s</code>.', 'companion-auto-update' ), 'wp_version_check()' ); ?></td>
310
+ <td><a href="https://codeermeneer.nl/contact/" class="button"><?php _e( 'Contact for support', 'companion-auto-update' ); ?></a></td>
311
+ <?php } else { ?>
312
+ <td class="cau_status_active_state"><span class='cau_enabled'><span class="dashicons dashicons-yes-alt"></span> <?php _e( 'No issues detected' , 'companion-auto-update' ); ?></span></td>
313
+ <td></td>
314
+ <td></td>
315
+ <?php } ?>
316
+ </tr>
317
 
318
+ <tr>
319
+ <td><?php _e( 'Auto updates', 'companion-auto-update' ); ?></td>
320
+ <?php if ( checkAutomaticUpdaterDisabled() ) { ?>
321
+ <td class="cau_status_active_state"><span class='cau_disabled'><span class="dashicons dashicons-no"></span> <?php _e( 'Disabled', 'companion-auto-update' ); ?></span></td>
322
+ <td><?php _e( 'Updating is globally disabled.', 'companion-auto-update' ); ?></td>
323
+ <td>
 
 
 
 
324
  <form method="POST">
325
  <?php wp_nonce_field( 'cau_fixit' ); ?>
326
  <button type="submit" name="fixit" class="button button-primary"><?php _e( 'Fix it', 'companion-auto-update' ); ?></button>
327
+ <a href="https://codeermeneer.nl/contact/" class="button"><?php _e( 'Contact for support', 'companion-auto-update' ); ?></a>
328
  </form>
329
  </td>
330
+ <?php } else { ?>
331
+ <td class="cau_status_active_state"><span class='cau_enabled'><span class="dashicons dashicons-yes-alt"></span> <?php _e( 'Enabled', 'companion-auto-update' ); ?></span></td>
332
+ <td></td>
333
+ <td></td>
334
+ <?php } ?>
335
+ </tr>
 
 
 
 
336
 
337
+ <tr>
338
+ <td>VCS</td>
339
+ <td class="cau_status_active_state"><span class='cau_<?php echo cau_test_is_vcs_checkout( ABSPATH )['status']; ?>'><span class="dashicons dashicons-<?php echo cau_test_is_vcs_checkout( ABSPATH )['icon']; ?>"></span> <?php echo cau_test_is_vcs_checkout( ABSPATH )['description']; ?></span></td>
340
+ <td></td>
341
+ <td></td>
342
+ </tr>
 
 
343
 
344
+ </tbody>
 
 
 
 
 
 
 
 
 
 
 
 
 
345
 
346
+ </table>
347
 
348
+ <?php
349
 
350
  // Remove the line
351
  if( isset( $_POST['fixit'] ) ) {
440
 
441
  <tbody id="the-list">
442
  <tr>
443
+ <td width="300">WordPress</td>
444
  <td><?php echo get_bloginfo( 'version' ); ?></td>
445
  </tr>
446
  <tr>
cau_functions.php CHANGED
@@ -1085,4 +1085,53 @@ function cau_cronjobs_test() {
1085
  $result['actions'] .= cau_siteHealthSignature();
1086
 
1087
  return $result;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1088
  }
1085
  $result['actions'] .= cau_siteHealthSignature();
1086
 
1087
  return $result;
1088
+ }
1089
+
1090
+ // Check for version control
1091
+ function cau_test_is_vcs_checkout( $context ) {
1092
+
1093
+ $context_dirs = array( ABSPATH );
1094
+ $vcs_dirs = array( '.svn', '.git', '.hg', '.bzr' );
1095
+ $check_dirs = array();
1096
+ $result = array();
1097
+
1098
+ foreach ( $context_dirs as $context_dir ) {
1099
+ // Walk up from $context_dir to the root.
1100
+ do {
1101
+ $check_dirs[] = $context_dir;
1102
+
1103
+ // Once we've hit '/' or 'C:\', we need to stop. dirname will keep returning the input here.
1104
+ if ( $context_dir == dirname( $context_dir ) )
1105
+ break;
1106
+
1107
+ // Continue one level at a time.
1108
+ } while ( $context_dir = dirname( $context_dir ) );
1109
+ }
1110
+
1111
+ $check_dirs = array_unique( $check_dirs );
1112
+
1113
+ // Search all directories we've found for evidence of version control.
1114
+ foreach ( $vcs_dirs as $vcs_dir ) {
1115
+ foreach ( $check_dirs as $check_dir ) {
1116
+ if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) {
1117
+ break 2;
1118
+ }
1119
+ }
1120
+ }
1121
+
1122
+ if ( $checkout && ! apply_filters( 'automatic_updates_is_vcs_checkout', true, $context ) ) {
1123
+ $result['description'] = sprintf( __( 'The folder %s was detected as being under version control (%s), but the %s filter is allowing updates' , 'companion-auto-update' ), "<code>$check_dir</code>", "<code>automatic_updates_is_vcs_checkout</code>" );
1124
+ $result['icon'] = 'warning';
1125
+ $result['status'] = 'info';
1126
+ } else if ( $checkout ) {
1127
+ $result['description'] = sprintf( __( 'The folder %s was detected as being under version control (%s)' , 'companion-auto-update' ), "<code>$check_dir</code>", "<code>$vcs_dir</code>" );
1128
+ $result['icon'] = 'no';
1129
+ $result['status'] = 'disabled';
1130
+ } else {
1131
+ $result['description'] = __( 'No issues detected' , 'companion-auto-update' );
1132
+ $result['icon'] = 'yes-alt';
1133
+ $result['status'] = 'enabled';
1134
+ }
1135
+
1136
+ return $result;
1137
  }
companion-auto-update.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Companion Auto Update
4
  * Plugin URI: http://codeermeneer.nl/portfolio/companion-auto-update/
5
  * Description: This plugin auto updates all plugins, all themes and the wordpress core.
6
- * Version: 3.5.4.1
7
  * Author: Papin Schipper
8
  * Author URI: http://codeermeneer.nl/
9
  * Contributors: papin
@@ -23,8 +23,18 @@ function cau_load_translations() {
23
  add_action( 'init', 'cau_load_translations' );
24
 
25
  // Set up the database and required schedules
26
- function cau_install() {
27
- cau_database_creation(); // Db handle
 
 
 
 
 
 
 
 
 
 
28
  if (! wp_next_scheduled ( 'cau_set_schedule_mail' )) wp_schedule_event( time(), 'daily', 'cau_set_schedule_mail'); // Set schedule for mail etc.
29
  if (! wp_next_scheduled ( 'cau_custom_hooks_plugins' )) wp_schedule_event( time(), 'daily', 'cau_custom_hooks_plugins'); // Run custom hooks on plugin updates
30
  if (! wp_next_scheduled ( 'cau_custom_hooks_themes' )) wp_schedule_event( time(), 'daily', 'cau_custom_hooks_themes'); // Run custom hooks on theme updates
@@ -348,8 +358,15 @@ class CAU_auto_update {
348
  // WP Email Config
349
  $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'wpemails'");
350
  foreach ( $configs as $config ) {
351
- if( $config->onoroff == 'on' ) add_filter( 'auto_core_update_send_email', '__return_true' ); // Turn on
352
- else add_filter( 'auto_core_update_send_email', '__return_false' ); // Turn off
 
 
 
 
 
 
 
353
  }
354
 
355
 
3
  * Plugin Name: Companion Auto Update
4
  * Plugin URI: http://codeermeneer.nl/portfolio/companion-auto-update/
5
  * Description: This plugin auto updates all plugins, all themes and the wordpress core.
6
+ * Version: 3.5.5
7
  * Author: Papin Schipper
8
  * Author URI: http://codeermeneer.nl/
9
  * Contributors: papin
23
  add_action( 'init', 'cau_load_translations' );
24
 
25
  // Set up the database and required schedules
26
+ function cau_install( $network_wide ) {
27
+ if ( is_multisite() && $network_wide ) {
28
+ global $wpdb;
29
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
30
+ foreach ( $blog_ids as $blog_id ) {
31
+ switch_to_blog( $blog_id );
32
+ cau_database_creation();
33
+ restore_current_blog();
34
+ }
35
+ } else {
36
+ cau_database_creation();
37
+ }
38
  if (! wp_next_scheduled ( 'cau_set_schedule_mail' )) wp_schedule_event( time(), 'daily', 'cau_set_schedule_mail'); // Set schedule for mail etc.
39
  if (! wp_next_scheduled ( 'cau_custom_hooks_plugins' )) wp_schedule_event( time(), 'daily', 'cau_custom_hooks_plugins'); // Run custom hooks on plugin updates
40
  if (! wp_next_scheduled ( 'cau_custom_hooks_themes' )) wp_schedule_event( time(), 'daily', 'cau_custom_hooks_themes'); // Run custom hooks on theme updates
358
  // WP Email Config
359
  $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'wpemails'");
360
  foreach ( $configs as $config ) {
361
+ if( $config->onoroff == 'on' ) {
362
+ add_filter( 'auto_core_update_send_email', '__return_true' ); // Core updates
363
+ add_filter( 'auto_plugin_update_send_email', '__return_true' ); // Plugin updates
364
+ add_filter( 'auto_theme_update_send_email', '__return_true' ); // Theme updates
365
+ } else {
366
+ add_filter( 'auto_core_update_send_email', '__return_false' ); // Core updates
367
+ add_filter( 'auto_plugin_update_send_email', '__return_false' ); // Plugin updates
368
+ add_filter( 'auto_theme_update_send_email', '__return_false' ); // Theme updates
369
+ }
370
  }
371
 
372
 
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: Papin, qweb
3
  Donate link: https://www.paypal.me/dakel/10/
4
  Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
5
  Requires at least: 3.6.0
6
- Tested up to: 5.4
7
  Requires PHP: 5.1
8
- Stable tag: 3.5.4.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -68,6 +68,11 @@ Your feedback is what made this plugin what is and what it’ll become so keep t
68
 
69
  == Changelog ==
70
 
 
 
 
 
 
71
  = 3.5.4.1 (June 20, 2020) =
72
  * Fix: Sometimes the hour settings for intervals wouldn't show up
73
 
3
  Donate link: https://www.paypal.me/dakel/10/
4
  Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
5
  Requires at least: 3.6.0
6
+ Tested up to: 5.5
7
  Requires PHP: 5.1
8
+ Stable tag: 3.5.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
68
 
69
  == Changelog ==
70
 
71
+ = 3.5.5 (August 5, 2020) =
72
+ * Fix: Added better multisite support
73
+ * Better status log: We've added a bunch more checks and you can now see more passed checks.
74
+ * Support for WordPress 5.5
75
+
76
  = 3.5.4.1 (June 20, 2020) =
77
  * Fix: Sometimes the hour settings for intervals wouldn't show up
78