Companion Auto Update - Version 3.3.8

Version Description

(March 1, 2019) = * Fix: Show correct timestamp in log * Fix: Fixed a few typos * New: Filter the log for Plugins, Themes or All * New: Click on a plugins' name to show the changelog * Improvement: Added more checks to the status log * Improvement: Added better documentation when issues show up

Download this release

Release Info

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

Code changes from version 3.3.7 to 3.3.8

admin/log.php CHANGED
@@ -1,2 +1,19 @@
1
  <h2><?php _e( 'Update log', 'companion-auto-update' ); ?></h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  <?php cau_fetch_log( 'all', 'table' ); ?>
1
  <h2><?php _e( 'Update log', 'companion-auto-update' ); ?></h2>
2
+
3
+ <?php
4
+ if( isset( $_GET['filter'] ) ) {
5
+ $filter = $_GET['filter'];
6
+ } else {
7
+ $filter = 'all';
8
+ }
9
+ ?>
10
+
11
+ <ul class="subsubsub">
12
+ <li><a <?php if( $filter == 'all' ) { echo "class='current'"; } ?> href='<?php echo admin_url( 'tools.php?page=cau-settings&tab=log&cau_page=log&filter=all' ); ?>'><?php _e( 'View full changelog', 'companion-auto-update' ); ?></a></li> |
13
+ <li><a <?php if( $filter == 'plugins' ) { echo "class='current'"; } ?> href='<?php echo admin_url( 'tools.php?page=cau-settings&tab=log&cau_page=log&filter=plugins' ); ?>'><?php _e( 'Plugins', 'companion-auto-update' ); ?></a></li> |
14
+ <li><a <?php if( $filter == 'themes' ) { echo "class='current'"; } ?> href='<?php echo admin_url( 'tools.php?page=cau-settings&tab=log&cau_page=log&filter=themes' ); ?>'><?php _e( 'Themes', 'companion-auto-update' ); ?></a></li>
15
+ </ul>
16
+
17
+ <div class='cau_spacing'></div>
18
+
19
  <?php cau_fetch_log( 'all', 'table' ); ?>
admin/status.php CHANGED
@@ -227,6 +227,34 @@ if( checkAutomaticUpdaterDisabled() ) { ?>
227
 
228
  <?php }
229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  // Remove the line
231
  if( isset( $_POST['fixit'] ) ) {
232
  cau_removeErrorLine();
@@ -295,7 +323,7 @@ if( cau_incompatiblePlugins() ) { ?>
295
  echo '<tr>
296
  <td class="cau_plugin_issue_name">'.$key.'</td>
297
  <td class="cau_plugin_issue_explain">'.$value.'</td>
298
- <td class="cau_plugin_issue_fixit"><a href="'.admin_url( cau_menloc().'?page=cau-settings&tab=support' ).'" class="button">'.__( 'Contact for support', 'companion-auto-update' ).'</a></td>
299
  </tr>';
300
 
301
  }
@@ -311,7 +339,7 @@ if( cau_incompatiblePlugins() ) { ?>
311
 
312
  <thead>
313
  <tr>
314
- <th colspan="2"><strong><?php _e( 'Systemifo', 'companion-auto-update' ); ?></strong></th>
315
  </tr>
316
  </thead>
317
 
227
 
228
  <?php }
229
 
230
+ if( checkCronjobsDisabled() ) { ?>
231
+
232
+ <table class="cau_status_list widefat striped cau_status_warnings">
233
+
234
+ <thead>
235
+ <tr>
236
+ <th class="cau_plugin_issue_name"><strong><?php _e( 'Critical Error', 'companion-auto-update' ); ?></strong></th>
237
+ <th class="cau_plugin_issue_explain"> </th>
238
+ <th class="cau_plugin_issue_fixit"><strong><?php _e( 'How to fix', 'companion-auto-update' ); ?></strong></th>
239
+ </tr>
240
+ </thead>
241
+
242
+ <tbody id="the-list">
243
+ <tr>
244
+ <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>
245
+ <td class="cau_plugin_issue_explain">
246
+ <?php _e( 'Cronjobs are disabled.', 'companion-auto-update' ); ?>
247
+ </td>
248
+ <td class="cau_plugin_issue_fixit">
249
+ <a href="<?php echo admin_url( cau_menloc().'?page=cau-settings&tab=support' ); ?>" class="button"><?php _e( 'Contact for support', 'companion-auto-update' ); ?></a>
250
+ </td>
251
+ </tr>
252
+ </tbody>
253
+
254
+ </table>
255
+
256
+ <?php }
257
+
258
  // Remove the line
259
  if( isset( $_POST['fixit'] ) ) {
260
  cau_removeErrorLine();
323
  echo '<tr>
324
  <td class="cau_plugin_issue_name">'.$key.'</td>
325
  <td class="cau_plugin_issue_explain">'.$value.'</td>
326
+ <td class="cau_plugin_issue_fixit"><a href="https://codeermeneer.nl/documentation/possible-plugin-issues-fixes/" target="_blank" class="button">'.__( 'How to fix', 'companion-auto-update' ).'</a></td>
327
  </tr>';
328
 
329
  }
339
 
340
  <thead>
341
  <tr>
342
+ <th colspan="2"><strong><?php _e( 'Systeminfo', 'companion-auto-update' ); ?></strong></th>
343
  </tr>
344
  </thead>
345
 
admin/support.php CHANGED
@@ -16,7 +16,7 @@
16
  </div><div class="welcome-column welcome-column welcome-column-third">
17
  <h3><?php _e( 'Developer?', 'companion-auto-update' ); ?></h3>
18
  <ul>
19
- <li><a href="https://codeermeneer.nl/stuffs/codex-auto-updater/" target="_blank"><?php _e( 'Documentation' ); ?></a></li>
20
  </ul>
21
  </div>
22
  </div>
16
  </div><div class="welcome-column welcome-column welcome-column-third">
17
  <h3><?php _e( 'Developer?', 'companion-auto-update' ); ?></h3>
18
  <ul>
19
+ <li><a href="https://codeermeneer.nl/documentation/auto-update/" target="_blank"><?php _e( 'Documentation' ); ?></a></li>
20
  </ul>
21
  </div>
22
  </div>
cau_emails.php CHANGED
@@ -5,7 +5,7 @@ function cau_check_updates_mail() {
5
 
6
  global $wpdb;
7
  $table_name = $wpdb->prefix . "auto_updates";
8
- $cau_configs = $wpdb->get_results( "SELECT * FROM $table_name" );
9
 
10
  if( $cau_configs[5]->onoroff == 'on' ) {
11
  cau_list_theme_updates(); // Check for theme updates
@@ -20,7 +20,7 @@ function cau_set_email() {
20
 
21
  global $wpdb;
22
  $table_name = $wpdb->prefix . "auto_updates";
23
- $cau_configs = $wpdb->get_results( "SELECT * FROM $table_name" );
24
  $emailArray = array();
25
 
26
  if( $cau_configs[4]->onoroff == '' ) {
@@ -40,11 +40,10 @@ function cau_set_email() {
40
  // Set the content for the emails about pending updates
41
  function cau_pending_message( $single, $plural ) {
42
 
43
- return sprintf( esc_html__(
44
- 'Hodwy! There are one or more %1$s updates waiting on your WordPress site at %2$s but we\'ve noticed that you\'ve disabled auto-updating for %3$.
45
 
46
- Outdated %3$ are a security risk so please consider manually updating them via your dashboard.', 'companion-auto-update'
47
- ), $single, get_site_url(), $plural );
48
 
49
  }
50
 
@@ -70,7 +69,7 @@ function cau_list_theme_updates() {
70
  global $wpdb;
71
  $table_name = $wpdb->prefix . "auto_updates";
72
 
73
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'themes'");
74
  foreach ( $configs as $config ) {
75
 
76
  if( $config->onoroff != 'on' ) {
@@ -105,7 +104,7 @@ function cau_list_plugin_updates() {
105
  global $wpdb;
106
  $table_name = $wpdb->prefix . "auto_updates";
107
 
108
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
109
  foreach ( $configs as $config ) {
110
 
111
  if( $config->onoroff != 'on' ) {
5
 
6
  global $wpdb;
7
  $table_name = $wpdb->prefix . "auto_updates";
8
+ $cau_configs = $wpdb->get_results( "SELECT * FROM {$table_name}" );
9
 
10
  if( $cau_configs[5]->onoroff == 'on' ) {
11
  cau_list_theme_updates(); // Check for theme updates
20
 
21
  global $wpdb;
22
  $table_name = $wpdb->prefix . "auto_updates";
23
+ $cau_configs = $wpdb->get_results( "SELECT * FROM {$table_name}" );
24
  $emailArray = array();
25
 
26
  if( $cau_configs[4]->onoroff == '' ) {
40
  // Set the content for the emails about pending updates
41
  function cau_pending_message( $single, $plural ) {
42
 
43
+ return sprintf(
44
+ esc_html__( 'Howdy! There are one or more %1$s updates waiting on your WordPress site at %2$s but we noticed that you disabled auto-updating for %3$s.
45
 
46
+ Outdated %3$s are a security risk so please consider manually updating them via your dashboard.', 'companion-auto-update' ), $single, get_site_url(), $plural );
 
47
 
48
  }
49
 
69
  global $wpdb;
70
  $table_name = $wpdb->prefix . "auto_updates";
71
 
72
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'themes'");
73
  foreach ( $configs as $config ) {
74
 
75
  if( $config->onoroff != 'on' ) {
104
  global $wpdb;
105
  $table_name = $wpdb->prefix . "auto_updates";
106
 
107
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'plugins'");
108
  foreach ( $configs as $config ) {
109
 
110
  if( $config->onoroff != 'on' ) {
cau_functions.php CHANGED
@@ -39,6 +39,10 @@ function cau_pluginHasIssues() {
39
  $return = true;
40
  }
41
 
 
 
 
 
42
  return $return;
43
  }
44
  function cau_pluginIssueLevels() {
@@ -47,7 +51,7 @@ function cau_pluginIssueLevels() {
47
  $level = 'low';
48
  }
49
 
50
- if( checkAutomaticUpdaterDisabled() ) {
51
  $level = 'high';
52
  }
53
 
@@ -63,6 +67,9 @@ function cau_pluginIssueCount() {
63
  if( checkAutomaticUpdaterDisabled() ) {
64
  $count++;
65
  }
 
 
 
66
  if( cau_incompatiblePlugins() ) {
67
  foreach ( cau_incompatiblePluginlist() as $key => $value ) {
68
  if( is_plugin_active( $key ) ) {
@@ -199,6 +206,31 @@ function checkAutomaticUpdaterDisabled() {
199
 
200
  }
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  // Menu location
203
  function cau_menloc() {
204
  return 'tools.php';
@@ -239,7 +271,7 @@ function donotupdatelist() {
239
 
240
  global $wpdb;
241
  $table_name = $wpdb->prefix . "auto_updates";
242
- $config = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'notUpdateList'");
243
 
244
  $list = $config[0]->onoroff;
245
  $list = explode( ", ", $list );
@@ -254,104 +286,156 @@ function donotupdatelist() {
254
  // Show the update log
255
  function cau_fetch_log( $limit, $format = 'simple' ) {
256
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  // Create arrays
258
  $pluginNames = array();
259
  $pluginVersion = array();
260
  $pluginDates = array();
261
  $pluginDatesF = array();
 
262
  $type = array();
263
 
264
- // Where to look for plugins
265
- $plugdir = plugin_dir_path( __DIR__ );
266
- $allPlugins = get_plugins();
267
-
268
  // Date format
269
  $dateFormat = get_option( 'date_format' );
270
 
271
- // Loop trough all plugins
272
- foreach ( $allPlugins as $key => $value) {
273
 
274
- // Get plugin data
275
- $fullPath = $plugdir.'/'.$key;
276
- $getFile = $path_parts = pathinfo( $fullPath );
277
- $pluginData = get_plugin_data( $fullPath );
278
 
279
- // Get plugin name
280
- foreach ( $pluginData as $dataKey => $dataValue ) {
281
- if( $dataKey == 'Name') {
282
- array_push( $pluginNames , $dataValue );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  }
284
- if( $dataKey == 'Version') {
285
- array_push( $pluginVersion , $dataValue );
 
 
 
 
 
 
286
  }
287
- }
 
 
288
 
289
- // Get last update date
290
- $fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
291
- if( $format == 'table' ) {
292
- $fileDateF = date_i18n ( $dateFormat, filemtime( $fullPath ) );
293
- $fileDateF .= ' &dash; '.date ( 'H:i', filemtime( $fullPath ) );
294
- } else {
295
- $fileDateF = date_i18n ( $dateFormat, filemtime( $fullPath ) );
296
  }
297
- array_push( $pluginDates, $fileDate );
298
- array_push( $pluginDatesF, $fileDateF );
299
- array_push( $type, 'Plugin' );
300
 
301
  }
302
 
303
- // Where to look for themes
304
- $themedir = get_theme_root();
305
- $allThemes = wp_get_themes();
306
 
307
- // Loop trough all themes
308
- foreach ( $allThemes as $key => $value) {
 
309
 
310
- // Get theme data
311
- $fullPath = $themedir.'/'.$key;
312
- $getFile = $path_parts = pathinfo( $fullPath );
313
 
314
- // Get theme name
315
- $theme_data = wp_get_theme( $path_parts['filename'] );
316
- $themeName = $theme_data->get( 'Name' );
317
- $themeVersion = $theme_data->get( 'Version' );
318
- array_push( $pluginNames , $themeName );
319
- array_push( $pluginVersion , $themeVersion );
320
 
 
 
 
 
 
 
321
 
322
- // Get last update date
323
- $fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
324
 
325
- if( $format == 'table' ) {
326
- $fileDateF = date_i18n ( $dateFormat, filemtime( $fullPath ) );
327
- $fileDateF .= ' &dash; '.date ( 'H:i', filemtime( $fullPath ) );
328
- } else {
329
- $fileDateF = date_i18n ( $dateFormat, filemtime( $fullPath ) );
330
- }
331
 
332
- array_push( $pluginDates, $fileDate );
333
- array_push( $pluginDatesF, $fileDateF );
334
- array_push( $type, 'Theme' );
 
 
 
335
 
336
- }
 
 
 
 
 
337
 
338
- // Core
339
- // There is no way (at this time) to check if someone changed this link, so therefore it won't work when it's changed, sorry
340
- $coreFile = get_home_path().'wp-admin/about.php';
341
- if( file_exists( $coreFile ) ) {
342
- $coreDate = date ( 'YmdHi', filemtime( $coreFile ) );
343
- $coreDateF = date_i18n ( $dateFormat, filemtime( $coreFile ) );
344
- $coreDateF .= ' &dash; '.date ( 'H:i', filemtime( $coreFile ) );
345
- } else {
346
- $coreDate = date('YmdHi');
347
- $coreDateF = 'Could not read core date.';
348
  }
349
 
350
- array_push( $pluginNames, 'WordPress' );
351
- array_push( $type, 'WordPress' );
352
- array_push( $pluginVersion, get_bloginfo( 'version' ) );
353
- array_push( $pluginDates, $coreDate );
354
- array_push( $pluginDatesF, $coreDateF );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
 
356
  // Sort array by date
357
  arsort( $pluginDates );
@@ -376,8 +460,8 @@ function cau_fetch_log( $limit, $format = 'simple' ) {
376
  echo '<thead>
377
  <tr>
378
  <th><strong>'.__( 'Name', 'companion-auto-update' ).'</strong></th>
379
- <th><strong>'.__( 'Type', 'companion-auto-update' ).'</strong></th>
380
  <th><strong>'.__( 'To', 'companion-auto-update' ).'</strong></th>
 
381
  <th><strong>'.__( 'Last updated on', 'companion-auto-update' ).'</strong></th>
382
  </tr>
383
  </thead>';
@@ -403,7 +487,7 @@ function cau_fetch_log( $limit, $format = 'simple' ) {
403
  }
404
  }
405
 
406
- echo '<td class="column-updatetitle"><p><strong title="'. $pluginNames[$key] .'">'. $pluginName .'</strong></p></td>';
407
 
408
  if( $format == 'table' ) {
409
 
@@ -415,8 +499,8 @@ function cau_fetch_log( $limit, $format = 'simple' ) {
415
  $thisType = $type[$key];
416
  }
417
 
418
- echo '<td class="cau_hide_on_mobile column-description"><p>'. $thisType .'</p></td>';
419
  echo '<td class="cau_hide_on_mobile column-version" style="min-width: 100px;"><p>'. $pluginVersion[$key] .'</p></td>';
 
420
 
421
  }
422
 
@@ -434,6 +518,29 @@ function cau_fetch_log( $limit, $format = 'simple' ) {
434
 
435
  }
436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
  // Only update plugins which are enabled
438
  function cau_dont_update( $update, $item ) {
439
 
@@ -456,7 +563,7 @@ function cau_plugin_info( $slug, $what ) {
456
  $cau_transient_name = 'cau' . $slug;
457
  $cau_info = get_transient( $cau_transient_name );
458
 
459
- require_once( plugin_dir_path( __FILE__ ) . 'wp-admin/includes/plugin-install.php' );
460
  $cau_info = plugins_api( 'plugin_information', array( 'slug' => $slug ) );
461
 
462
  if ( ! $cau_info or is_wp_error( $cau_info ) ) {
@@ -465,9 +572,20 @@ function cau_plugin_info( $slug, $what ) {
465
 
466
  set_transient( $cau_transient_name, $cau_info, 3600 );
467
 
468
- if( $what == 'versions' ) return $cau_info->versions;
469
- if( $what == 'version' ) return $cau_info->version;
470
- if( $what == 'name' ) return $cau_info->name;
 
 
 
 
 
 
 
 
 
 
 
471
 
472
  }
473
 
@@ -493,7 +611,7 @@ function cau_hideUpdateNag() {
493
 
494
  global $wpdb;
495
  $table_name = $wpdb->prefix . "auto_updates";
496
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'major'");
497
  foreach ( $configs as $config ) {
498
  if( $config->onoroff != 'on' ) {
499
  remove_action( 'admin_notices', 'update_nag', 3 );
39
  $return = true;
40
  }
41
 
42
+ if( checkCronjobsDisabled() ) {
43
+ $return = true;
44
+ }
45
+
46
  return $return;
47
  }
48
  function cau_pluginIssueLevels() {
51
  $level = 'low';
52
  }
53
 
54
+ if( checkAutomaticUpdaterDisabled() OR checkCronjobsDisabled() ) {
55
  $level = 'high';
56
  }
57
 
67
  if( checkAutomaticUpdaterDisabled() ) {
68
  $count++;
69
  }
70
+ if( checkCronjobsDisabled() ) {
71
+ $count++;
72
+ }
73
  if( cau_incompatiblePlugins() ) {
74
  foreach ( cau_incompatiblePluginlist() as $key => $value ) {
75
  if( is_plugin_active( $key ) ) {
206
 
207
  }
208
 
209
+ // Check if cronjobs are disabled
210
+ function checkCronjobsDisabled() {
211
+
212
+ // I mean, I know this can be done waaaay better but I's quite late and I need to push a fix so take it or leave it untill I decide to fix this :)
213
+
214
+ if ( defined( 'disable_wp_cron' ) ) {
215
+ if( constant( 'disable_wp_cron' ) == 'true' ) {
216
+ return true;
217
+ } else {
218
+ return false;
219
+ }
220
+
221
+ } else if ( defined( 'DISABLE_WP_CRON' ) ) {
222
+ if( constant( 'DISABLE_WP_CRON' ) == 'true' ) {
223
+ return true;
224
+ } else {
225
+ return false;
226
+ }
227
+
228
+ } else {
229
+ return false;
230
+ }
231
+
232
+ }
233
+
234
  // Menu location
235
  function cau_menloc() {
236
  return 'tools.php';
271
 
272
  global $wpdb;
273
  $table_name = $wpdb->prefix . "auto_updates";
274
+ $config = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'notUpdateList'");
275
 
276
  $list = $config[0]->onoroff;
277
  $list = explode( ", ", $list );
286
  // Show the update log
287
  function cau_fetch_log( $limit, $format = 'simple' ) {
288
 
289
+ // Filter log
290
+ if( isset( $_GET['filter'] ) ) {
291
+ $filter = $_GET['filter'];
292
+ } else {
293
+ $filter = 'all';
294
+ }
295
+
296
+ switch( $filter ) {
297
+
298
+ case 'plugins':
299
+ $plugins = true;
300
+ $themes = false;
301
+ $core = false;
302
+ break;
303
+
304
+ case 'themes':
305
+ $plugins = false;
306
+ $themes = true;
307
+ $core = false;
308
+ break;
309
+
310
+ default:
311
+ $plugins = true;
312
+ $themes = true;
313
+ $core = true;
314
+ break;
315
+ }
316
+
317
  // Create arrays
318
  $pluginNames = array();
319
  $pluginVersion = array();
320
  $pluginDates = array();
321
  $pluginDatesF = array();
322
+ $plugslug = array();
323
  $type = array();
324
 
 
 
 
 
325
  // Date format
326
  $dateFormat = get_option( 'date_format' );
327
 
328
+ // Make sure it shows the correct time
329
+ date_default_timezone_set( get_option('timezone_string') );
330
 
331
+ // PLUGINS
332
+ if( $plugins ) {
 
 
333
 
334
+ // Where to look for plugins
335
+ $plugdir = plugin_dir_path( __DIR__ );
336
+ $allPlugins = get_plugins();
337
+
338
+ // Loop trough all plugins
339
+ foreach ( $allPlugins as $key => $value) {
340
+
341
+ // Get plugin data
342
+ $fullPath = $plugdir.'/'.$key;
343
+ $getFile = $path_parts = pathinfo( $fullPath );
344
+ $pluginData = get_plugin_data( $fullPath );
345
+ $pluginSlug = explode( "/", plugin_basename( $key ) );
346
+ $pluginSlug = $pluginSlug[0];
347
+
348
+ array_push( $plugslug , $pluginSlug );
349
+
350
+ // Get plugin name
351
+ foreach ( $pluginData as $dataKey => $dataValue ) {
352
+ if( $dataKey == 'Name') {
353
+ array_push( $pluginNames , $dataValue );
354
+ }
355
+ if( $dataKey == 'Version') {
356
+ array_push( $pluginVersion , $dataValue );
357
+ }
358
  }
359
+
360
+ // Get last update date
361
+ $fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
362
+ if( $format == 'table' ) {
363
+ $fileDateF = date_i18n( $dateFormat, filemtime( $fullPath ) );
364
+ $fileDateF .= ' &dash; '.date( 'H:i', filemtime( $fullPath ) );
365
+ } else {
366
+ $fileDateF = date_i18n( $dateFormat, filemtime( $fullPath ) );
367
  }
368
+ array_push( $pluginDates, $fileDate );
369
+ array_push( $pluginDatesF, $fileDateF );
370
+ array_push( $type, 'Plugin' );
371
 
 
 
 
 
 
 
 
372
  }
 
 
 
373
 
374
  }
375
 
376
+ // THEMES
377
+ if( $themes ) {
 
378
 
379
+ // Where to look for themes
380
+ $themedir = get_theme_root();
381
+ $allThemes = wp_get_themes();
382
 
383
+ // Loop trough all themes
384
+ foreach ( $allThemes as $key => $value) {
 
385
 
386
+ // Get theme data
387
+ $fullPath = $themedir.'/'.$key;
388
+ $getFile = $path_parts = pathinfo( $fullPath );
 
 
 
389
 
390
+ // Get theme name
391
+ $theme_data = wp_get_theme( $path_parts['filename'] );
392
+ $themeName = $theme_data->get( 'Name' );
393
+ $themeVersion = $theme_data->get( 'Version' );
394
+ array_push( $pluginNames , $themeName );
395
+ array_push( $pluginVersion , $themeVersion );
396
 
 
 
397
 
398
+ // Get last update date
399
+ $fileDate = date( 'YmdHi', filemtime( $fullPath ) );
 
 
 
 
400
 
401
+ if( $format == 'table' ) {
402
+ $fileDateF = date_i18n( $dateFormat, filemtime( $fullPath ) );
403
+ $fileDateF .= ' &dash; '.date ( 'H:i', filemtime( $fullPath ) );
404
+ } else {
405
+ $fileDateF = date_i18n( $dateFormat, filemtime( $fullPath ) );
406
+ }
407
 
408
+ array_push( $pluginDates, $fileDate );
409
+ array_push( $pluginDatesF, $fileDateF );
410
+ array_push( $type, 'Theme' );
411
+ array_push( $plugslug , '' );
412
+
413
+ }
414
 
 
 
 
 
 
 
 
 
 
 
415
  }
416
 
417
+ // CORE
418
+ if( $core ) {
419
+
420
+ // There is no way (at this time) to check if someone changed this link, so therefore it won't work when it's changed, sorry
421
+ $coreFile = get_home_path().'wp-admin/about.php';
422
+ if( file_exists( $coreFile ) ) {
423
+ $coreDate = date( 'YmdHi', filemtime( $coreFile ) );
424
+ $coreDateF = date_i18n( $dateFormat, filemtime( $coreFile ) );
425
+ $coreDateF .= ' &dash; '.date( 'H:i', filemtime( $coreFile ) );
426
+ } else {
427
+ $coreDate = date('YmdHi');
428
+ $coreDateF = 'Could not read core date.';
429
+ }
430
+
431
+ array_push( $pluginNames, 'WordPress' );
432
+ array_push( $type, 'WordPress' );
433
+ array_push( $pluginVersion, get_bloginfo( 'version' ) );
434
+ array_push( $pluginDates, $coreDate );
435
+ array_push( $pluginDatesF, $coreDateF );
436
+ array_push( $plugslug , '' );
437
+
438
+ }
439
 
440
  // Sort array by date
441
  arsort( $pluginDates );
460
  echo '<thead>
461
  <tr>
462
  <th><strong>'.__( 'Name', 'companion-auto-update' ).'</strong></th>
 
463
  <th><strong>'.__( 'To', 'companion-auto-update' ).'</strong></th>
464
+ <th><strong>'.__( 'Type', 'companion-auto-update' ).'</strong></th>
465
  <th><strong>'.__( 'Last updated on', 'companion-auto-update' ).'</strong></th>
466
  </tr>
467
  </thead>';
487
  }
488
  }
489
 
490
+ echo '<td class="column-updatetitle"><p><strong title="'. $pluginNames[$key] .'">'.cau_getChangelogUrl( $type[$key], $pluginNames[$key], $plugslug[$key] ).'</strong></p></td>';
491
 
492
  if( $format == 'table' ) {
493
 
499
  $thisType = $type[$key];
500
  }
501
 
 
502
  echo '<td class="cau_hide_on_mobile column-version" style="min-width: 100px;"><p>'. $pluginVersion[$key] .'</p></td>';
503
+ echo '<td class="cau_hide_on_mobile column-description"><p>'. $thisType .'</p></td>';
504
 
505
  }
506
 
518
 
519
  }
520
 
521
+ // Get the proper changelog URL
522
+ function cau_getChangelogUrl( $type, $name, $plugslug ) {
523
+
524
+ switch( $type ) {
525
+ case 'WordPress':
526
+ $url = '';
527
+ break;
528
+ case 'Plugin':
529
+ $url = admin_url( 'plugin-install.php?tab=plugin-information&plugin='.$plugslug.'&section=changelog&TB_iframe=true&width=772&height=772' );
530
+ break;
531
+ case 'Theme':
532
+ $url = '';
533
+ break;
534
+ }
535
+
536
+ if( !empty( $url ) ) {
537
+ return '<a href="'.$url.'" class="thickbox open-plugin-details-modal" aria-label="More information about '.$name.'" data-title="'.$name.'">'.$name.'</a>';
538
+ } else {
539
+ return $name;
540
+ }
541
+
542
+ }
543
+
544
  // Only update plugins which are enabled
545
  function cau_dont_update( $update, $item ) {
546
 
563
  $cau_transient_name = 'cau' . $slug;
564
  $cau_info = get_transient( $cau_transient_name );
565
 
566
+ require_once( ABSPATH.'wp-admin/includes/plugin-install.php' );
567
  $cau_info = plugins_api( 'plugin_information', array( 'slug' => $slug ) );
568
 
569
  if ( ! $cau_info or is_wp_error( $cau_info ) ) {
572
 
573
  set_transient( $cau_transient_name, $cau_info, 3600 );
574
 
575
+ switch ( $what ) {
576
+ case 'versions':
577
+ return $cau_info->versions;
578
+ break;
579
+ case 'version':
580
+ return $cau_info->version;
581
+ break;
582
+ case 'name':
583
+ return $cau_info->name;
584
+ break;
585
+ case 'slug':
586
+ return $cau_info->slug;
587
+ break;
588
+ }
589
 
590
  }
591
 
611
 
612
  global $wpdb;
613
  $table_name = $wpdb->prefix . "auto_updates";
614
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'major'");
615
  foreach ( $configs as $config ) {
616
  if( $config->onoroff != 'on' ) {
617
  remove_action( 'admin_notices', 'update_nag', 3 );
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.3.7
7
  * Author: Papin Schipper
8
  * Author URI: http://codeermeneer.nl/
9
  * Contributors: papin
@@ -60,7 +60,7 @@ function cau_database_creation() {
60
  global $wpdb;
61
  global $cau_db_version;
62
 
63
- $cau_db_version = '1.4.4';
64
 
65
  // Create db table
66
  $table_name = $wpdb->prefix . "auto_updates";
@@ -68,7 +68,7 @@ function cau_database_creation() {
68
  $sql = "CREATE TABLE $table_name (
69
  id INT(9) NOT NULL AUTO_INCREMENT,
70
  name VARCHAR(255) NOT NULL,
71
- onoroff VARCHAR(99999) NOT NULL,
72
  UNIQUE KEY id (id)
73
  )";
74
 
@@ -93,7 +93,7 @@ function cau_check_if_exists( $whattocheck ) {
93
  global $wpdb;
94
  $table_name = $wpdb->prefix . "auto_updates";
95
 
96
- $rows = $wpdb->get_col( "SELECT COUNT(*) as num_rows FROM $table_name WHERE name = '$whattocheck'" );
97
  $check = $rows[0];
98
 
99
  if( $check > 0) {
@@ -224,9 +224,17 @@ function cau_widget() {
224
  // Load admin styles
225
  function load_cau_sytyles( $hook ) {
226
 
 
227
  if( $hook != 'tools_page_cau-settings' && $hook != 'index_page_cau-settings' ) return;
 
 
228
  wp_enqueue_style( 'cau_admin_styles', plugins_url( 'backend/style.css' , __FILE__ ) );
229
 
 
 
 
 
 
230
  }
231
  add_action( 'admin_enqueue_scripts', 'load_cau_sytyles', 100 );
232
 
@@ -266,7 +274,7 @@ class CAU_auto_update {
266
  $table_name = $wpdb->prefix . "auto_updates";
267
 
268
  // Enable for major updates
269
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'major'");
270
  foreach ( $configs as $config ) {
271
 
272
  if( $config->onoroff == 'on' ) add_filter( 'allow_major_auto_core_updates', '__return_true', 1 ); // Turn on
@@ -275,7 +283,7 @@ class CAU_auto_update {
275
  }
276
 
277
  // Enable for minor updates
278
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'minor'");
279
  foreach ( $configs as $config ) {
280
 
281
  if( $config->onoroff == 'on' ) add_filter( 'allow_minor_auto_core_updates', '__return_true', 1 ); // Turn on
@@ -284,7 +292,7 @@ class CAU_auto_update {
284
  }
285
 
286
  // Enable for plugins
287
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
288
  foreach ( $configs as $config ) {
289
 
290
  if( $config->onoroff == 'on' ) add_filter( 'auto_update_plugin', 'cau_dont_update', 10, 2 ); // Turn on
@@ -293,21 +301,21 @@ class CAU_auto_update {
293
  }
294
 
295
  // Enable for themes
296
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'themes'");
297
  foreach ( $configs as $config ) {
298
  if( $config->onoroff == 'on' ) add_filter( 'auto_update_theme', '__return_true', 1 ); // Turn on
299
  if( $config->onoroff != 'on' ) add_filter( 'auto_update_theme', '__return_false', 1 ); // Turn off
300
  }
301
 
302
  // Enable for translation files
303
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'translations'");
304
  foreach ( $configs as $config ) {
305
  if( $config->onoroff == 'on' ) add_filter( 'auto_update_translation', '__return_true', 1 ); // Turn on
306
  if( $config->onoroff != 'on' ) add_filter( 'auto_update_translation', '__return_false', 1 ); // Turn off
307
  }
308
 
309
  // WP Email Config
310
- $configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'wpemails'");
311
  foreach ( $configs as $config ) {
312
  if( $config->onoroff == 'on' ) add_filter( 'auto_core_update_send_email', '__return_true' ); // Turn on
313
  if( $config->onoroff != 'on' ) add_filter( 'auto_core_update_send_email', '__return_false' ); // Turn off
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.3.8
7
  * Author: Papin Schipper
8
  * Author URI: http://codeermeneer.nl/
9
  * Contributors: papin
60
  global $wpdb;
61
  global $cau_db_version;
62
 
63
+ $cau_db_version = '1.4.5';
64
 
65
  // Create db table
66
  $table_name = $wpdb->prefix . "auto_updates";
68
  $sql = "CREATE TABLE $table_name (
69
  id INT(9) NOT NULL AUTO_INCREMENT,
70
  name VARCHAR(255) NOT NULL,
71
+ onoroff VARCHAR(255) NOT NULL,
72
  UNIQUE KEY id (id)
73
  )";
74
 
93
  global $wpdb;
94
  $table_name = $wpdb->prefix . "auto_updates";
95
 
96
+ $rows = $wpdb->get_col( "SELECT COUNT(*) as num_rows FROM {$table_name} WHERE name = '$whattocheck'" );
97
  $check = $rows[0];
98
 
99
  if( $check > 0) {
224
  // Load admin styles
225
  function load_cau_sytyles( $hook ) {
226
 
227
+ // Only load on plugins' pages
228
  if( $hook != 'tools_page_cau-settings' && $hook != 'index_page_cau-settings' ) return;
229
+
230
+ // Plugin scripts
231
  wp_enqueue_style( 'cau_admin_styles', plugins_url( 'backend/style.css' , __FILE__ ) );
232
 
233
+ // WordPress scripts we need
234
+ wp_enqueue_style( 'thickbox' );
235
+ wp_enqueue_script( 'thickbox' );
236
+ wp_enqueue_script( 'plugin-install' );
237
+
238
  }
239
  add_action( 'admin_enqueue_scripts', 'load_cau_sytyles', 100 );
240
 
274
  $table_name = $wpdb->prefix . "auto_updates";
275
 
276
  // Enable for major updates
277
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'major'");
278
  foreach ( $configs as $config ) {
279
 
280
  if( $config->onoroff == 'on' ) add_filter( 'allow_major_auto_core_updates', '__return_true', 1 ); // Turn on
283
  }
284
 
285
  // Enable for minor updates
286
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'minor'");
287
  foreach ( $configs as $config ) {
288
 
289
  if( $config->onoroff == 'on' ) add_filter( 'allow_minor_auto_core_updates', '__return_true', 1 ); // Turn on
292
  }
293
 
294
  // Enable for plugins
295
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'plugins'");
296
  foreach ( $configs as $config ) {
297
 
298
  if( $config->onoroff == 'on' ) add_filter( 'auto_update_plugin', 'cau_dont_update', 10, 2 ); // Turn on
301
  }
302
 
303
  // Enable for themes
304
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'themes'");
305
  foreach ( $configs as $config ) {
306
  if( $config->onoroff == 'on' ) add_filter( 'auto_update_theme', '__return_true', 1 ); // Turn on
307
  if( $config->onoroff != 'on' ) add_filter( 'auto_update_theme', '__return_false', 1 ); // Turn off
308
  }
309
 
310
  // Enable for translation files
311
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'translations'");
312
  foreach ( $configs as $config ) {
313
  if( $config->onoroff == 'on' ) add_filter( 'auto_update_translation', '__return_true', 1 ); // Turn on
314
  if( $config->onoroff != 'on' ) add_filter( 'auto_update_translation', '__return_false', 1 ); // Turn off
315
  }
316
 
317
  // WP Email Config
318
+ $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'wpemails'");
319
  foreach ( $configs as $config ) {
320
  if( $config->onoroff == 'on' ) add_filter( 'auto_core_update_send_email', '__return_true' ); // Turn on
321
  if( $config->onoroff != 'on' ) add_filter( 'auto_core_update_send_email', '__return_false' ); // Turn off
readme.txt CHANGED
@@ -4,7 +4,8 @@ Donate link: https://www.paypal.me/dakel/5/
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.5.0
6
  Tested up to: 5.1
7
- Stable tag: 3.3.7
 
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -71,6 +72,14 @@ For some reason this plugin seems to have trouble with updating themes by Elegan
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
 
 
 
74
  = 3.3.7 (February 2, 2019) =
75
  * Fix: In some rare cases various errors showed up when saving settings, this is fixed now
76
 
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.5.0
6
  Tested up to: 5.1
7
+ Requires PHP: 5.1
8
+ Stable tag: 3.3.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
72
 
73
  == Changelog ==
74
 
75
+ = 3.3.8 (March 1, 2019) =
76
+ * Fix: Show correct timestamp in log
77
+ * Fix: Fixed a few typos
78
+ * New: Filter the log for Plugins, Themes or All
79
+ * New: Click on a plugins' name to show the changelog
80
+ * Improvement: Added more checks to the status log
81
+ * Improvement: Added better documentation when issues show up
82
+
83
  = 3.3.7 (February 2, 2019) =
84
  * Fix: In some rare cases various errors showed up when saving settings, this is fixed now
85