updated plugin `Companion Auto Update` version 3.8.5

This commit is contained in:
KawaiiPunk 2022-03-21 13:35:00 +00:00 committed by Gitium
parent 350836f064
commit 2bfae7880a
23 changed files with 3693 additions and 3693 deletions

View File

@ -197,7 +197,7 @@ if( isset( $_POST['submit'] ) ) {
if( isset( $_GET['welcome'] ) ) {
echo '<div class="welcome-to-cau welcome-bg welcome-panel" style="margin-bottom: 0px;">
echo '<div class="welcome-to-cau welcome-bg" style="margin-bottom: 0px;">
<div class="welcome-image">
</div><div class="welcome-content">
@ -222,7 +222,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
<form method="POST">
<div class="welcome-to-cau update-bg welcome-panel cau-dashboard-box">
<div class="welcome-to-cau update-bg cau-dashboard-box">
<h2 class="title"><?php _e('Auto Updater', 'companion-auto-update');?></h2>
@ -262,7 +262,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
</div>
<div class="welcome-to-cau email-bg welcome-panel cau-dashboard-box">
<div class="welcome-to-cau email-bg cau-dashboard-box">
<h2 class="title"><?php _e( 'Email Notifications', 'companion-auto-update' );?></h2>
@ -356,7 +356,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
</div>
<div class="welcome-to-cau interval-bg welcome-panel cau-dashboard-box" style="overflow: hidden;">
<div class="welcome-to-cau interval-bg cau-dashboard-box" style="overflow: hidden;">
<h2 class="title"><?php _e( 'Intervals', 'companion-auto-update' );?></h2>
@ -439,7 +439,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
</div>
<div class="welcome-to-cau advanced-bg welcome-panel cau-dashboard-box">
<div class="welcome-to-cau advanced-bg cau-dashboard-box">
<h2 class="title"><?php _e( 'Advanced settings', 'companion-auto-update' ); ?></h2>
@ -464,6 +464,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
<td>
<input type="number" min="0" max="31" name="update_delay_days" id="update_delay_days" class="regular-text" value="<?php echo cau_get_db_value( 'update_delay_days' ); ?>" />
<p><?php _e( 'For how many days should updates be put on hold?', 'companion-auto-update' ); ?></p>
<p><small><strong>Please note:</strong> Delaying updates does not work with WordPress updates yet.</small></p>
</td>
</tr>
</tbody>
@ -484,7 +485,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
</div><div class="cau-column-small">
<div class="welcome-to-cau help-bg welcome-panel cau-dashboard-box">
<div class="welcome-to-cau help-bg cau-dashboard-box">
<div class="welcome-column welcome-column.welcome-column-half">
<h3 class="support-sidebar-title"><?php _e( 'Help' ); ?></h3>
<ul class="support-sidebar-list">
@ -507,7 +508,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
</div>
</div>
<div class="welcome-to-cau support-bg welcome-panel cau-dashboard-box">
<div class="welcome-to-cau support-bg cau-dashboard-box">
<div class="welcome-column welcome-column">
<h3><?php _e('Support', 'companion-auto-update');?></h3>
<p><?php _e('Feel free to reach out to us if you have any questions or feedback.', 'companion-auto-update'); ?></p>
@ -516,7 +517,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
</div>
</div>
<div class="welcome-to-cau love-bg cau-show-love welcome-panel cau-dashboard-box">
<div class="welcome-to-cau love-bg cau-show-love cau-dashboard-box">
<h3><?php _e( 'Like our plugin?', 'companion-auto-update' ); ?></h3>
<p><?php _e('Companion Auto Update is free to use. It has required a great deal of time and effort to develop and you can help support this development by making a small donation.<br />You get useful software and we get to carry on making it better.', 'companion-auto-update'); ?></p>
<a href="https://wordpress.org/support/plugin/companion-auto-update/reviews/#new-post" target="_blank" class="button button-alt button-hero">
@ -528,7 +529,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
<p style="font-size: 12px; color: #BDBDBD;"><?php _e( 'Donations via PayPal. Amount can be changed.', 'companion-auto-update'); ?></p>
</div>
<div class="welcome-to-cau welcome-panel cau-dashboard-box">
<div class="welcome-to-cau cau-dashboard-box">
<h3><span style='background: #EBE3F7; color: #BCADD3; padding: 1px 5px; border-radius: 3px; font-size: .8em'>Plugin Promotion</span></h3>
<h3>Keep your site fast with our Revision Manager</h3>
<p>Post Revisions are great, but will also slow down your site. Take back control over revisions with Companion Revision Manager!</p>

View File

@ -1,5 +1,15 @@
<?php
// Define globals
global $wpdb;
// Define variables
$dateFormat = get_option( 'date_format' );
$dateFormat .= ' '.get_option( 'time_format' );
$table_name = $wpdb->prefix . "auto_updates";
$schedules = wp_get_schedules();
$interval_names = cau_wp_get_schedules();
// Update the database
if( isset( $_GET['run'] ) && $_GET['run'] == 'db_update' ) {
cau_manual_update();
@ -17,158 +27,125 @@
$allowedValues = array( 'seo', 'cron' );
if( !in_array( $report_to_ignore, $allowedValues ) ) {
wp_die( 'Trying to cheat eh?' );
} else {
global $wpdb;
$table_name = $wpdb->prefix . "auto_updates";
$wpdb->query( $wpdb->prepare( "UPDATE {$table_name} SET onoroff = %s WHERE name = 'ignore_$report_to_ignore'", 'yes' ) );
$__ignored = __( 'This report will now be ignored', 'companion-auto-update' );
echo "<div id='message' class='updated'><p><b>$__ignored</b></p></div>";
}
}
// Variables
$dateFormat = get_option( 'date_format' );
$dateFormat .= ' '.get_option( 'time_format' );
global $wpdb;
$table_name = $wpdb->prefix . "auto_updates";
$schedules = wp_get_schedules();
$interval_names = cau_wp_get_schedules();
}
?>
<div class="cau_status_page">
<table class="cau_status_list widefat striped">
<thead>
<tr>
<th class="cau_status_name"><strong><?php _e( 'Auto Updater', 'companion-auto-update' ); ?></strong></th>
<th class="cau_status_active_state"><strong><?php _e( 'Status', 'companion-auto-update' ); ?></strong></th>
<th class="cau_status_interval"><strong><?php _e( 'Interval', 'companion-auto-update' ); ?></strong></th>
<th class="cau_status_next"><strong><?php _e( 'Next', 'companion-auto-update' ); ?></strong></th>
</tr>
</thead>
<tbody id="the-list">
<?php
$auto_updaters = array(
$events = array(
0 => array(
'name' => __( 'Events', 'companion-auto-update' ),
'fields' => array(
'plugins' => __( 'Plugins', 'companion-auto-update' ),
'themes' => __( 'Themes', 'companion-auto-update' ),
'minor' => __( 'Core (Minor)', 'companion-auto-update' ),
'major' => __( 'Core (Major)', 'companion-auto-update' )
);
$eventNames = array(
'major' => __( 'Core (Major)', 'companion-auto-update' ),
'send' => __( 'Update available', 'companion-auto-update' ),
'sendupdate' => __( 'Successful update', 'companion-auto-update' ),
'wpemails' => __( 'Core notifications', 'companion-auto-update' ),
'update_delay' => __( 'Log updater', 'companion-auto-update' ),
),
'values' => array(
'plugins' => 'wp_update_plugins',
'themes' => 'wp_update_themes',
'minor' => 'wp_version_check',
'major' => 'wp_version_check'
);
foreach ( $auto_updaters as $key => $value ) {
if( cau_get_db_value( $key ) == 'on' ) {
$__status = 'enabled';
$__icon = 'yes-alt';
$__text = __( 'Enabled', 'companion-auto-update' );
$__interval = $interval_names[wp_get_schedule( $eventNames[$key] )];
$__next = date_i18n( $dateFormat, wp_next_scheduled( $eventNames[$key] ) );
} else {
$__status = 'disabled';
$__icon = 'marker';
$__text = __( 'Disabled', 'companion-auto-update' );
$__interval = '&dash;';
$__next = '&dash;';
}
$__nxt = __( 'Next', 'companion-auto-update' );
echo "<tr>
<td class='cau_status_name'>$value</td>
<td class='cau_status_active_state'><span class='cau_$__status'><span class='dashicons dashicons-$__icon'></span> $__text</span></td>
<td class='cau_status_interval'>$__interval</td>
<td class='cau_status_next'><span class='cau_mobile_prefix'>$__nxt: </span>$__next</td>
</tr>";
}
?>
</tbody>
</table>
<table class="cau_status_list widefat striped">
<thead>
<tr>
<th class="cau_status_name"><strong><?php _e( 'Email Notifications', 'companion-auto-update' ); ?></strong></th>
<th class="cau_status_active_state"><strong><?php _e( 'Status', 'companion-auto-update' ); ?></strong></th>
<th class="cau_status_interval"><strong><?php _e( 'Interval', 'companion-auto-update' ); ?></strong></th>
<th class="cau_status_next"><strong><?php _e( 'Next', 'companion-auto-update' ); ?></strong></th>
</tr>
</thead>
<tbody id="the-list">
<?php
$other_events = array(
'send' => __( 'Update available', 'companion-auto-update' ),
'sendupdate' => __( 'Successful update', 'companion-auto-update' ),
'wpemails' => __( 'Core notifications', 'companion-auto-update' )
);
$other_eventNames = array(
'major' => 'wp_version_check',
'send' => 'cau_set_schedule_mail',
'sendupdate' => 'cau_set_schedule_mail',
'wpemails' => 'cau_set_schedule_mail',
'update_delay' => 'cau_log_updater',
),
'explain' => array(
'plugins' => __('Auto update plugins?', 'companion-auto-update'),
'themes' => __('Auto update themes?', 'companion-auto-update'),
'minor' => __('Auto update minor core updates?', 'companion-auto-update'),
'major' => __('Auto update major core updates?', 'companion-auto-update'),
'send' => __( 'Will notify you of available updates.', 'companion-auto-update' ),
'sendupdate' => __( 'Will notify you after successful updates.', 'companion-auto-update' ),
'wpemails' => __( 'The default WordPress notifications.', 'companion-auto-update' ),
'update_delay' => __( 'Will keep track of the update log and make sure updates are delayed when needed.', 'companion-auto-update' ),
)
),
);
foreach ( $other_events as $key => $value ) {
$__sta = __( 'Status', 'companion-auto-update' );
$__int = __( 'Interval', 'companion-auto-update' );
$__nxt = __( 'Next', 'companion-auto-update' );
if( cau_get_db_value( $key ) == 'on' ) {
$__status = 'enabled';
$__icon = 'yes-alt';
$__text = __( 'Enabled', 'companion-auto-update' );
$__interval = $interval_names[wp_get_schedule( $other_eventNames[$key] )];
$__next = date_i18n( $dateFormat, wp_next_scheduled( $other_eventNames[$key] ) );
} else {
$__status = 'warning';
$__icon = 'marker';
$__text = __( 'Disabled', 'companion-auto-update' );
$__interval = '&dash;';
$__next = '&dash;';
}
foreach( $events as $event => $info ) {
echo "<table class='cau_status_list widefat striped'>
<thead>
<tr>
<th class='cau_status_name' colspan='2'><strong>{$info['name']}</strong></th>
<th class='cau_status_active_state'><strong>{$__sta}</strong></th>
<th class='cau_status_interval'><strong>{$__int}</strong></th>
<th class='cau_status_next'><strong>{$__nxt}</strong></th>
</tr>
</thead>
<tbody id='the-list'>";
foreach ( $info['fields'] as $key => $value ) {
$is_on = ( cau_get_db_value( $key ) == 'on' && wp_get_schedule( $info['values'][$key] ) ) ? true : false;
$__status = $is_on ? 'enabled' : 'warning';
$__icon = $is_on ? 'yes-alt' : 'marker';
$__text = $is_on ? __( 'Enabled', 'companion-auto-update' ) : __( 'Disabled', 'companion-auto-update' );
$__interval = $is_on ? $interval_names[wp_get_schedule( $info['values'][$key] )] : '&dash;';
$__next = $is_on ? date_i18n( $dateFormat, wp_next_scheduled( $info['values'][$key] ) ) : '&dash;';
$__exp = !empty( $info['explain'][$key] ) ? '<br /><small>'.$info['explain'][$key].'</small>' : '';
$__nxt = __( 'Next', 'companion-auto-update' );
echo "<tr>
<td class='cau_status_name'>$value</td>
<td class='cau_status_active_state'><span class='cau_$__status'><span class='dashicons dashicons-$__icon'></span> $__text</span></td>
<td class='cau_status_icon'><span class='dashicons dashicons-$__icon cau_$__status'></span></td>
<td class='cau_status_name'><strong>$value</strong>$__exp</td>
<td class='cau_status_active_state'><span class='cau_$__status'>$__text</span></td>
<td class='cau_status_interval'>$__interval</td>
<td class='cau_status_next'><span class='cau_mobile_prefix'>$__nxt: </span>$__next</td>
</tr>";
}
echo "</tbody>
</table>";
}
?>
</tbody>
</table>
<table class="cau_status_list widefat striped cau_status_warnings">
<thead>
<tr>
<th class="cau_plugin_issue_name" colspan="4"><strong><?php _e( 'Status' ); ?></strong></th>
<th class="cau_plugin_issue_name" colspan="5"><strong><?php _e( 'Status' ); ?></strong></th>
</tr>
</thead>
<tbody id="the-list">
<!-- checkAutomaticUpdaterDisabled -->
<tr>
<td class='cau_status_icon'><span class="dashicons dashicons-update"></span></td>
<td><?php _e( 'Auto updates', 'companion-auto-update' ); ?></td>
<?php if ( checkAutomaticUpdaterDisabled() ) { ?>
<td class="cau_status_active_state"><span class='cau_disabled'><span class="dashicons dashicons-no"></span> <?php _e( 'All automatic updates are disabled', 'companion-auto-update' ); ?></span></td>
@ -186,7 +163,9 @@
<td></td>
</tr>
<!-- Connection with WP.org -->
<tr>
<td class='cau_status_icon'><span class="dashicons dashicons-wordpress"></span></td>
<td><?php _e( 'Connection with WordPress.org', 'companion-auto-update' ); ?></td>
<?php if( wp_http_supports( array( 'ssl' ) ) == '1' ) {
$__text = __( 'No issues detected', 'companion-auto-update' );
@ -194,10 +173,13 @@
} else {
$__text = __( 'Disabled', 'companion-auto-update' );
echo "<td colspan='3' class='cau_status_active_state'><span class='cau_disabled'><span class='dashicons dashicons-no'></span> $__text</span></td>";
} ?>
}
?>
</tr>
<!-- ignore_seo check -->
<tr <?php if( cau_get_db_value( 'ignore_seo' ) == 'yes' ) { echo "class='report_hidden'"; } ?> >
<td class='cau_status_icon'><span class="dashicons dashicons-search"></span></td>
<td><?php _e( 'Search Engine Visibility', 'companion-auto-update' ); ?></td>
<?php if( get_option( 'blog_public' ) == 0 ) { ?>
<td colspan="2" class="cau_status_active_state">
@ -213,7 +195,9 @@
<?php } ?>
</tr>
<!-- ignore_cron check -->
<tr <?php if( cau_get_db_value( 'ignore_cron' ) == 'yes' ) { echo "class='report_hidden'"; } ?> >
<td class='cau_status_icon'><span class="dashicons dashicons-admin-generic"></span></td>
<td><?php _e( 'Cronjobs', 'companion-auto-update' ); ?></td>
<?php if( checkCronjobsDisabled() ) { ?>
<td class="cau_status_active_state"><span class='cau_warning'><span class="dashicons dashicons-warning"></span> <?php _e( 'Disabled', 'companion-auto-update' ); ?></span></td>
@ -227,7 +211,9 @@
<?php } ?>
</tr>
<!-- wp_version_check -->
<tr>
<td class='cau_status_icon'><span class="dashicons dashicons-wordpress-alt"></span></td>
<td>wp_version_check</td>
<?php if ( !has_filter( 'wp_version_check', 'wp_version_check' ) ) { ?>
<td colspan="2" class="cau_status_active_state"><span class='cau_disabled'><span class="dashicons dashicons-no"></span> <?php _e( 'A plugin has prevented updates by disabling wp_version_check', 'companion-auto-update' ); ?></span></td>
@ -237,7 +223,9 @@
<?php } ?>
</tr>
<!-- VCD -->
<tr>
<td class='cau_status_icon'><span class="dashicons dashicons-open-folder"></span></td>
<td>VCS</td>
<td colspan="3" 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>
</tr>
@ -247,48 +235,56 @@
</table>
<table class="autoupdate cau_status_list widefat striped cau_status_warnings">
<thead>
<tr>
<th colspan="4"><strong><?php _e( 'Systeminfo', 'companion-auto-update' ); ?></strong></th>
<th colspan="5"><strong><?php _e( 'Systeminfo', 'companion-auto-update' ); ?></strong></th>
</tr>
</thead>
<tbody id="the-list">
<tr>
<td class='cau_status_icon'><span class="dashicons dashicons-wordpress"></span></td>
<td>WordPress</td>
<td><?php echo get_bloginfo( 'version' ); ?></td>
<td></td>
<td></td>
</tr>
<tr>
<tr <?php if( version_compare( PHP_VERSION, '5.1.0', '<' ) ) { echo "class='inactive'"; } ?>>
<td class='cau_status_icon'><span class="dashicons dashicons-media-code"></span></td>
<td>PHP</td>
<td><?php echo phpversion(); ?></td>
<td><?php echo phpversion(); ?> <code>(Required: 5.1.0 or up)</code></td>
<td></td>
<td></td>
</tr>
<tr <?php if( cau_incorrectDatabaseVersion() ) { echo "class='inactive'"; } ?>>
<td class='cau_status_icon'><span class="dashicons dashicons-database"></span></td>
<td>Database</td>
<td><?php echo get_option( "cau_db_version" ); ?> <code>(Latest: <?php echo cau_db_version(); ?>)</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td class='cau_status_icon'><span class="dashicons dashicons-calendar"></span></td>
<td class="cau_status_name"><?php _e( 'Timezone' ); ?></td>
<td class="cau_status_active_state"><?php echo cau_get_proper_timezone(); ?> (GMT <?php echo get_option('gmt_offset'); ?>) - <?php echo date_default_timezone_get(); ?></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<?php
// If has incomptable plugins
if( cau_incompatiblePlugins() ) { ?>
<table class="cau_status_list no_column_width widefat striped cau_status_warnings">
<thead>
<tr>
<th class="cau_plugin_issue_name" colspan="4"><strong><?php _e( 'Possible plugin issues', 'companion-auto-update' ); ?></strong></th>
@ -297,6 +293,7 @@
<tbody id="the-list">
<?php
foreach ( cau_incompatiblePluginlist() as $key => $value ) {
if( is_plugin_active( $key ) ) {
echo '<tr>
@ -306,6 +303,7 @@
</tr>';
}
}
?>
</tbody>
@ -313,6 +311,7 @@
<?php } ?>
<!-- Advanced info -->
<table class="autoupdate cau_status_list widefat striped cau_status_warnings">
<thead>
@ -320,20 +319,17 @@
<th><strong><?php _e( 'Advanced info', 'companion-auto-update' ); ?></strong> &dash; <?php _e( 'For when you need our help fixing an issue.', 'companion-auto-update' ); ?></th>
</tr>
</thead>
<tbody id="the-list">
<tr>
<td>
<div class='button button-primary toggle_advanced_button'><?php _e( 'Toggle', 'companion-auto-update' ); ?></div>
<div class='toggle_advanced_content' style='display: none;'>
<?php
global $wpdb;
$autoupdates = $wpdb->prefix."auto_updates";
$cau_configs = $wpdb->get_results( "SELECT * FROM $autoupdates" );
$cau_configs = $wpdb->get_results( "SELECT * FROM $table_name" );
array_push( $cau_configs, "WordPress: ".get_bloginfo( 'version' ) );
array_push( $cau_configs, "PHP: ".phpversion() );
array_push( $cau_configs, "DB: ".get_option( "cau_db_version" ).' / '.cau_db_version() );
echo "<textarea style='width: 100%; height: 750px;'>";
print_r( $cau_configs );
echo "</textarea>";
@ -342,14 +338,50 @@
</td>
</tr>
</tbody>
</table>
<script>jQuery( '.toggle_advanced_button' ).click( function() { jQuery( '.toggle_advanced_content' ).toggle(); });</script>
<!-- Delay updates -->
<table class="autoupdate cau_status_list widefat striped cau_status_warnings">
<thead>
<tr>
<th><strong><?php _e( 'Delay updates', 'companion-auto-update' ); ?></strong> &dash; <?php echo ( cau_get_db_value( 'update_delay' ) == 'on' ) ? __( 'Enabled', 'companion-auto-update' ).' ('.sprintf( esc_html__( '%s days', 'companion-auto-update' ).')', cau_get_db_value( 'update_delay_days' ) ) : __( 'Disabled', 'companion-auto-update' ); ?></th>
<th><?php _e( 'Till', 'companion-auto-update' ); ?></th>
</tr>
</thead>
<tbody id="the-list">
<?php
$updateLog = "{$wpdb->prefix}update_log";
$put_on_hold = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$updateLog} WHERE put_on_hold <> '%s'", '0' ) );
foreach ( $put_on_hold as $plugin ) {
$__name = $plugin->slug;
$__poh = $plugin->put_on_hold;
$__udd = ( cau_get_db_value( 'update_delay_days' ) != '' ) ? cau_get_db_value( 'update_delay_days' ) : '2';
$__date = date_i18n( $dateFormat, strtotime( "+".$__udd." days", $__poh ) );
echo "<tr>
<td>{$__name}</td>
<td>{$__date}</td>
</tr>";
}
echo empty( $put_on_hold ) ? "<tr><td>".__( 'No plugins have been put on hold.', 'companion-auto-update' )."</td></tr>" : "";
?>
</tbody>
</table>
</div>
<?php
// Remove the line
if( isset( $_POST['fixit'] ) ) {
check_admin_referer( 'cau_fixit' );
@ -401,5 +433,3 @@ function cau_removeErrorLine() {
echo "<div id='message' class='$meldingS'><p><strong>$melding</strong></p></div>";
}
?>

View File

@ -165,7 +165,7 @@ select.schedule_interval {
}
.cau_content .button-hero {
font-weight: 500;
padding: 15px 30px!important;
padding: 2px 15px!important;
}
#message.cau {
background: #FFF;
@ -295,6 +295,13 @@ table.cau_status_list:not(.no_column_width) th, table.cau_status_list:not(.no_co
.cau_mobile_prefix {
display: none;
}
table.cau_status_list .cau_status_icon {
width: 50px!important;
}
table.cau_status_list .cau_status_icon .dashicons, table.cau_status_list .cau_status_icon .dashicons-before:before {
height: 25px;
font-size: 2em;
}
/* Rollback list */
table.rollbacklist {

View File

@ -143,15 +143,19 @@ function cau_pluginIssueCount() {
$count = 0;
if( get_option( 'blog_public' ) == 0 ) {
$count++;
}
if( checkAutomaticUpdaterDisabled() ) {
$count++;
}
if( checkCronjobsDisabled() ) {
$count++;
}
// blog_public check
if( get_option( 'blog_public' ) == 0 ) $count++;
// checkAutomaticUpdaterDisabled
if( checkAutomaticUpdaterDisabled() ) $count++;
// checkCronjobsDisabled
if( checkCronjobsDisabled() ) $count++;
// cau_incorrectDatabaseVersion
if( cau_incorrectDatabaseVersion() ) $count++;
// cau_incompatiblePlugins
if( cau_incompatiblePlugins() ) {
foreach ( cau_incompatiblePluginlist() as $key => $value ) {
if( is_plugin_active( $key ) ) {
@ -1392,8 +1396,7 @@ function cau_hold_updates() {
foreach ( (array)$plugins as $plugin_file => $plugin_data ) {
if( !in_array( $plugin_file, cau_delayed_updates() ) ) {
global $wpdb;
$updateDB = "update_log";
$updateLog = $wpdb->prefix.$updateDB;
$updateLog = "{$wpdb->prefix}update_log";
$wpdb->query( $wpdb->prepare( "UPDATE $updateLog SET put_on_hold = '%s' WHERE slug = '%s'", strtotime( "now" ), $plugin_file ) );
}
}
@ -1403,16 +1406,12 @@ function cau_hold_updates() {
// Remove plugins from "put on hold" after x days
function cau_unhold_updates() {
if( cau_get_db_value( 'update_delay_days' ) != '' ) {
$after_x_days = cau_get_db_value( 'update_delay_days' );
} else {
$after_x_days = '2';
}
global $wpdb;
$after_x_days = ( cau_get_db_value( 'update_delay_days' ) != '' ) ? cau_get_db_value( 'update_delay_days' ) : '2';
$today = strtotime( "now" );
$updateLog = $wpdb->prefix."update_log";
$updateLog = "{$wpdb->prefix}update_log";
$put_on_hold = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$updateLog} WHERE put_on_hold <> '%s'", '0' ) );
foreach ( $put_on_hold as $plugin ) {
@ -1432,7 +1431,7 @@ function cau_unhold_updates() {
// Remove all plugins from "put on hold" if option is disabled
function cau_unhold_all_updates() {
global $wpdb;
$updateLog = $wpdb->prefix."update_log";
$updateLog = "{$wpdb->prefix}update_log";
$put_on_hold = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$updateLog} WHERE put_on_hold <> '%s'", '0' ) );
foreach ( $put_on_hold as $plugin ) {
$plugin_file = $plugin->slug;

View File

@ -1,9 +1,10 @@
<?php
/*
* Plugin Name: Companion Auto Update
* Plugin URI: http://codeermeneer.nl/portfolio/companion-auto-update/
* Description: This plugin auto updates all plugins, all themes and the wordpress core.
* Version: 3.8.3
* Version: 3.8.5
* Author: Papin Schipper
* Author URI: http://codeermeneer.nl/
* Contributors: papin
@ -26,6 +27,7 @@ add_action( 'init', 'cau_init' );
// Set up the database and required schedules
function cau_install( $network_wide ) {
if ( is_multisite() && $network_wide ) {
global $wpdb;
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
@ -37,12 +39,14 @@ function cau_install( $network_wide ) {
} else {
cau_database_creation();
}
if (! wp_next_scheduled ( 'cau_set_schedule_mail' )) wp_schedule_event( time(), 'daily', 'cau_set_schedule_mail'); // Set schedule for basic notifcations
if (! wp_next_scheduled ( 'cau_custom_hooks_plugins' )) wp_schedule_event( time(), 'daily', 'cau_custom_hooks_plugins'); // Run custom hooks on plugin updates
if (! wp_next_scheduled ( 'cau_custom_hooks_themes' )) wp_schedule_event( time(), 'daily', 'cau_custom_hooks_themes'); // Run custom hooks on theme updates
if (! wp_next_scheduled ( 'cau_log_updater' )) wp_schedule_event( ( time() - 1800 ), 'daily', 'cau_log_updater'); // Keep the log up to date
if (! wp_next_scheduled ( 'cau_outdated_notifier' )) wp_schedule_event( time(), 'daily', 'cau_outdated_notifier'); // Set schedule for basic notifcations
}
add_action( 'cau_set_schedule_mail', 'cau_check_updates_mail' );
add_action( 'cau_outdated_notifier', 'cau_outdated_notifier_mail' );
add_action( 'wp_update_plugins', 'cau_run_custom_hooks_p' );
@ -62,6 +66,7 @@ function cau_pluginActivateWelcome() {
}
register_activation_hook(__FILE__, 'cau_pluginActivateWelcome');
// Redirect to welcome screen on activation of plugin
function cau_pluginRedirectWelcomeScreen() {
if ( get_option( 'cau_redirectToWelcomeScreen', false ) ) {
delete_option( 'cau_redirectToWelcomeScreen' );
@ -81,6 +86,7 @@ function cau_donateUrl() {
function cau_db_version() {
return '3.8.3';
}
function cau_database_creation() {
global $wpdb;
@ -94,22 +100,8 @@ function cau_database_creation() {
$charset_collate = $wpdb->get_charset_collate();
// DB table creation queries
$sql = "CREATE TABLE $autoupdates (
id INT(9) NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
onoroff TEXT NOT NULL,
UNIQUE KEY id (id)
) $charset_collate;";
$sql2 = "CREATE TABLE $updateLog (
id INT(9) NOT NULL AUTO_INCREMENT,
slug VARCHAR(255) NOT NULL,
oldVersion VARCHAR(10) NOT NULL,
newVersion VARCHAR(10) NOT NULL,
method VARCHAR(10) NOT NULL,
put_on_hold VARCHAR(100) DEFAULT '0',
UNIQUE KEY id (id)
) $charset_collate;";
$sql = "CREATE TABLE $autoupdates ( id INT(9) NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, onoroff TEXT NOT NULL, UNIQUE KEY id (id) ) $charset_collate;";
$sql2 = "CREATE TABLE $updateLog ( id INT(9) NOT NULL AUTO_INCREMENT, slug VARCHAR(255) NOT NULL, oldVersion VARCHAR(10) NOT NULL, newVersion VARCHAR(10) NOT NULL, method VARCHAR(10) NOT NULL, put_on_hold VARCHAR(100) DEFAULT '0', UNIQUE KEY id (id) ) $charset_collate;";
// Create DB tables
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
@ -121,23 +113,18 @@ function cau_database_creation() {
// Insert data
cau_install_data();
}
// Check if database table exists before creating
function cau_check_if_exists( $whattocheck, $id = 'name', $db_table = 'auto_updates' ) {
global $wpdb;
$table_name = $wpdb->prefix.$db_table;
$table_name = $wpdb->prefix.$db_table;
$rows = $wpdb->get_col( "SELECT COUNT(*) as num_rows FROM {$table_name} WHERE {$id} = '{$whattocheck}'" );
$check = $rows[0];
if( $check > 0 ) {
return true;
} else {
return false;
}
return ( $check > 0 ) ? true : false;
}
@ -145,6 +132,7 @@ function cau_check_if_exists( $whattocheck, $id = 'name', $db_table = 'auto_upda
function cau_install_data() {
global $wpdb;
$table_name = $wpdb->prefix . "auto_updates";
$toemail = get_option('admin_email');
@ -200,11 +188,12 @@ function cau_remove() {
wp_clear_scheduled_hook( 'cau_custom_hooks_themes' );
wp_clear_scheduled_hook( 'cau_log_updater' );
// Restore WordPress default update functionality
// Restore WordPress 5.5 default update functionality
add_filter( 'plugins_auto_update_enabled', '__return_true' );
add_filter( 'themes_auto_update_enabled', '__return_true' );
add_filter( 'auto_plugin_update_send_email', '__return_true' );
add_filter( 'auto_theme_update_send_email', '__return_true' );
}
register_deactivation_hook( __FILE__, 'cau_remove' );
@ -226,13 +215,13 @@ function cau_update_db_check() {
$db_charset = constant( 'DB_CHARSET' );
$wpdb->query( "ALTER TABLE $autoupdates CONVERT TO CHARACTER SET $db_charset" );
$wpdb->query( "ALTER TABLE $updateLog CONVERT TO CHARACTER SET $db_charset" );
}
update_option( "cau_db_version", $cau_db_version );
}
}
add_action( 'upgrader_process_complete', 'cau_update_db_check' );
// Manual update
@ -250,15 +239,11 @@ function register_cau_menu_page() {
add_action( 'admin_menu', 'register_cau_menu_page' );
// Settings page
function cau_frontend() { ?>
function cau_frontend() {
<div class='wrap cau_content_wrap cau_content'>
<h1 class="wp-heading-inline"><?php _e( 'Companion Auto Update', 'companion-auto-update' ); ?></h1>
<hr class="wp-header-end">
<?php
echo "<div class='wrap cau_content_wrap cau_content'>
<h1 class='wp-heading-inline'>".__( 'Companion Auto Update', 'companion-auto-update' )."</h1>
<hr class='wp-header-end'>";
// Make sure the correct timezone is used
date_default_timezone_set( cau_get_proper_timezone() );
@ -273,17 +258,13 @@ function cau_frontend() { ?>
// Show subtabs
echo "<h2 class='nav-tab-wrapper wp-clearfix'>";
foreach ( $allowedPages as $page => $title ) {
echo "<a href='".cau_url( $page )."' id='tab-".$page."' class='nav-tab "._active_tab( $page )."'>".$title;
if( $page == 'status' ) {
if( cau_pluginHasIssues() ) {
echo "<span class='cau_melding level-".cau_pluginIssueLevels()."'></span>";
} else {
echo "<span class='cau_melding level-okay'></span>";
}
}
if( $page == 'status' ) echo cau_pluginHasIssues() ? "<span class='cau_melding level-".cau_pluginIssueLevels()."'></span>" : "<span class='cau_melding level-okay'></span>"; // Show status icon
echo "</a>";
}
echo "</h2>";
// Show page content
@ -300,11 +281,9 @@ function cau_frontend() { ?>
wp_die( 'You\'re not allowed to view <strong>'.$requestedPage.'</strong>.' );
}
?>
echo '</div>';
</div>
<?php }
}
// Add a widget to the dashboard.
function cau_add_widget() {
@ -312,28 +291,18 @@ function cau_add_widget() {
}
add_action( 'wp_dashboard_setup', 'cau_add_widget' );
// Widget content
function cau_widget() {
echo '<style>table.autoupdatewidget { border: 0px solid transparent; border-bottom: 1px solid #EEEEEE; margin: 0 -12px; width: calc(100% + 24px); } table.autoupdatewidget tr td { border-top: 1px solid #EEEEEE; padding: 9px 12px 5px 12px; background: #FAFAFA; } .cau_divide { display: inline-block; color: #E7E0DF; padding: 0 2px; } </style>';
echo '<p>'.__('Below are the last 7 updates ran on this site. Includes plugins and themes, both automatically updated and manually updated.', 'companion-auto-update').'</p>';
cau_fetch_log( '7' );
echo '<p>
<a href="'.cau_url( 'log' ).'">'.__('View full changelog', 'companion-auto-update').'</a>
<span class="cau_divide">|</span>
<a href="'.cau_url( 'dashboard' ).'">'.__( 'Settings' ).'</a>
</p>';
echo '<p><a href="'.cau_url( 'log' ).'">'.__( 'View full changelog', 'companion-auto-update' ).'</a> <span class="cau_divide">|</span> <a href="'.cau_url( 'dashboard' ).'">'.__( 'Settings' ).'</a></p>';
}
// Load admin styles
function load_cau_global_styles( $hook ) {
// Plugin scripts
wp_enqueue_style( 'cau_admin_styles', plugins_url( 'backend/style.css' , __FILE__ ) );
// Check for issues
wp_enqueue_style( 'cau_warning_styles', plugins_url( 'backend/warningbar.css' , __FILE__ ) );
wp_enqueue_style( 'cau_admin_styles', plugins_url( 'backend/style.css' , __FILE__ ) ); // Plugin scripts
wp_enqueue_style( 'cau_warning_styles', plugins_url( 'backend/warningbar.css' , __FILE__ ) ); // Check for issues
}
add_action( 'admin_enqueue_scripts', 'load_cau_global_styles', 99 );
@ -347,7 +316,6 @@ function load_cau_page_styles( $hook ) {
wp_enqueue_style( 'thickbox' );
wp_enqueue_script( 'thickbox' );
wp_enqueue_script( 'plugin-install' );
}
add_action( 'admin_enqueue_scripts', 'load_cau_page_styles', 100 );
@ -374,11 +342,9 @@ add_filter( "plugin_action_links_$plugin", "cau_settings_link" );
// Auto Update Class
class CAU_auto_update {
public function __construct() {
// Enable Update filters
public function __construct() {
add_action( 'plugins_loaded', array( &$this, 'CAU_auto_update_filters' ), 1 );
}
public function CAU_auto_update_filters() {
@ -428,13 +394,9 @@ class CAU_auto_update {
// WP Email Config
$configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'wpemails'");
foreach ( $configs as $config ) {
if( $config->onoroff == 'on' ) {
add_filter( 'auto_core_update_send_email', '__return_true' ); // Core updates
} else {
add_filter( 'auto_core_update_send_email', '__return_false' ); // Core updates
if( $config->onoroff == 'on' ) add_filter( 'auto_core_update_send_email', '__return_true', 1 ); // Turn on
else add_filter( 'auto_core_update_send_email', '__return_false', 1 ); // Turn off
}
}
}
@ -443,25 +405,16 @@ new CAU_auto_update();
// Check for issues
function cau_checkForIssues( $admin_bar ) {
if( cau_pluginHasIssues() && is_admin() ) {
if( cau_pluginIssueLevels() == 'high' ) {
$cauWaningBarTitle = __( 'Companion Auto Update ran into a critical error. View the status log for more info.', 'companion-auto-update' );
if( cau_pluginHasIssues() && is_admin() && cau_pluginIssueLevels() == 'high' ) {
$admin_bar->add_menu( array(
'id' => 'cau-has-issues',
'title' => '<span class="ab-icon"></span><span class="cau-level-'.cau_pluginIssueLevels().'">'.cau_pluginIssueCount().'</span>',
'href' => cau_url( 'status' ),
'meta' => array(
'target' => '_self',
'title' => $cauWaningBarTitle,
'title' => __( 'Companion Auto Update ran into a critical error. View the status log for more info.', 'companion-auto-update' ),
),
));
}
}
}
add_action( 'admin_bar_menu', 'cau_checkForIssues', 150 );

View File

@ -5,7 +5,7 @@ Tags: auto, automatic, background, update, updates, updating, automatic updates,
Requires at least: 3.6.0
Tested up to: 5.9
Requires PHP: 5.1
Stable tag: 3.8.3
Stable tag: 3.8.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -81,6 +81,16 @@ So obviously, some of you wondered what the difference would be between the defa
== Changelog ==
= 3.8.5 (March 17, 2022) =
* New: Added more checks on the status page and added an explanation to some of them.
* New: Added an list of delayed updates on the status page to help with troubleshooting.
* Tweak: Made some improvements to the update delay feature.
* Tweak: Added a notice to explain that update delay does not work with WordPress update currently.
* Tweak: Improved code on the status page to be more reliable.
= 3.8.4 (February 2, 2022) =
* Tweak: Fixed a few styling errors with WP5.9
= 3.8.3 (December 9, 2021) =
* New: Plugin update e-mails now have an option to link to a few important pages
* Fix: Error: Undefined index: dbupdateemails