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

@ -26,10 +26,10 @@ if( isset( $_POST['submit'] ) ) {
$table_name = $wpdb->prefix . "auto_updates"; $table_name = $wpdb->prefix . "auto_updates";
// Auto updater // Auto updater
$plugins = isset( $_POST['plugins'] ) ? sanitize_text_field( $_POST['plugins'] ) : ''; $plugins = isset( $_POST['plugins'] ) ? sanitize_text_field( $_POST['plugins'] ) : '';
$themes = isset( $_POST['themes'] ) ? sanitize_text_field( $_POST['themes'] ) : ''; $themes = isset( $_POST['themes'] ) ? sanitize_text_field( $_POST['themes'] ) : '';
$minor = isset( $_POST['minor'] ) ? sanitize_text_field( $_POST['minor'] ) : ''; $minor = isset( $_POST['minor'] ) ? sanitize_text_field( $_POST['minor'] ) : '';
$major = isset( $_POST['major'] ) ? sanitize_text_field( $_POST['major'] ) : ''; $major = isset( $_POST['major'] ) ? sanitize_text_field( $_POST['major'] ) : '';
$translations = isset( $_POST['translations'] ) ? sanitize_text_field( $_POST['translations'] ) : ''; $translations = isset( $_POST['translations'] ) ? sanitize_text_field( $_POST['translations'] ) : '';
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'plugins'", $plugins ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'plugins'", $plugins ) );
@ -39,11 +39,11 @@ if( isset( $_POST['submit'] ) ) {
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'translations'", $translations ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'translations'", $translations ) );
// Emails // Emails
$send = isset( $_POST['cau_send'] ) ? sanitize_text_field( $_POST['cau_send'] ) : ''; $send = isset( $_POST['cau_send'] ) ? sanitize_text_field( $_POST['cau_send'] ) : '';
$sendupdate = isset( $_POST['cau_send_update'] ) ? sanitize_text_field( $_POST['cau_send_update'] ) : ''; $sendupdate = isset( $_POST['cau_send_update'] ) ? sanitize_text_field( $_POST['cau_send_update'] ) : '';
$sendoutdated = isset( $_POST['cau_send_outdated'] ) ? sanitize_text_field( $_POST['cau_send_outdated'] ) : ''; $sendoutdated = isset( $_POST['cau_send_outdated'] ) ? sanitize_text_field( $_POST['cau_send_outdated'] ) : '';
$wpemails = isset( $_POST['wpemails'] ) ? sanitize_text_field( $_POST['wpemails'] ) : ''; $wpemails = isset( $_POST['wpemails'] ) ? sanitize_text_field( $_POST['wpemails'] ) : '';
$email = isset( $_POST['cau_email'] ) ? sanitize_text_field( $_POST['cau_email'] ) : ''; $email = isset( $_POST['cau_email'] ) ? sanitize_text_field( $_POST['cau_email'] ) : '';
$html_or_text = isset( $_POST['html_or_text'] ) ? sanitize_text_field( $_POST['html_or_text'] ) : 'html'; $html_or_text = isset( $_POST['html_or_text'] ) ? sanitize_text_field( $_POST['html_or_text'] ) : 'html';
$dbupdateemails = isset( $_POST['dbupdateemails'] ) ? sanitize_text_field( $_POST['dbupdateemails'] ) : ''; $dbupdateemails = isset( $_POST['dbupdateemails'] ) ? sanitize_text_field( $_POST['dbupdateemails'] ) : '';
@ -56,8 +56,8 @@ if( isset( $_POST['submit'] ) ) {
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'dbupdateemails'", $dbupdateemails ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'dbupdateemails'", $dbupdateemails ) );
// Advanced // Advanced
$allow_editor = isset( $_POST['allow_editor'] ) ? sanitize_text_field( $_POST['allow_editor'] ) : ''; $allow_editor = isset( $_POST['allow_editor'] ) ? sanitize_text_field( $_POST['allow_editor'] ) : '';
$allow_author = isset( $_POST['allow_author'] ) ? sanitize_text_field( $_POST['allow_author'] ) : ''; $allow_author = isset( $_POST['allow_author'] ) ? sanitize_text_field( $_POST['allow_author'] ) : '';
$advanced_info_emails = isset( $_POST['advanced_info_emails'] ) ? sanitize_text_field( $_POST['advanced_info_emails'] ) : ''; $advanced_info_emails = isset( $_POST['advanced_info_emails'] ) ? sanitize_text_field( $_POST['advanced_info_emails'] ) : '';
$plugin_links_emails = isset( $_POST['plugin_links_emails'] ) ? sanitize_text_field( $_POST['plugin_links_emails'] ) : ''; $plugin_links_emails = isset( $_POST['plugin_links_emails'] ) ? sanitize_text_field( $_POST['plugin_links_emails'] ) : '';
@ -67,8 +67,8 @@ if( isset( $_POST['submit'] ) ) {
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'plugin_links_emails'", $plugin_links_emails ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'plugin_links_emails'", $plugin_links_emails ) );
// Delay // Delay
$update_delay = isset( $_POST['update_delay'] ) ? sanitize_text_field( $_POST['update_delay'] ) : ''; $update_delay = isset( $_POST['update_delay'] ) ? sanitize_text_field( $_POST['update_delay'] ) : '';
$update_delay_days = isset( $_POST['update_delay_days'] ) ? sanitize_text_field( $_POST['update_delay_days'] ) : ''; $update_delay_days = isset( $_POST['update_delay_days'] ) ? sanitize_text_field( $_POST['update_delay_days'] ) : '';
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'update_delay'", $update_delay ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'update_delay'", $update_delay ) );
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'update_delay_days'", $update_delay_days ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'update_delay_days'", $update_delay_days ) );
@ -76,9 +76,9 @@ if( isset( $_POST['submit'] ) ) {
// Intervals // Intervals
// Set variables // Set variables
$plugin_sc = sanitize_text_field( $_POST['plugin_schedule'] ); $plugin_sc = sanitize_text_field( $_POST['plugin_schedule'] );
$theme_sc = sanitize_text_field( $_POST['theme_schedule'] ); $theme_sc = sanitize_text_field( $_POST['theme_schedule'] );
$core_sc = sanitize_text_field( $_POST['core_schedule'] ); $core_sc = sanitize_text_field( $_POST['core_schedule'] );
$schedule_mail = sanitize_text_field( $_POST['update_notifications'] ); $schedule_mail = sanitize_text_field( $_POST['update_notifications'] );
$outdated_notifier = sanitize_text_field( $_POST['outdated_notifier'] ); $outdated_notifier = sanitize_text_field( $_POST['outdated_notifier'] );
@ -97,11 +97,11 @@ if( isset( $_POST['submit'] ) ) {
// Plugins // Plugins
if( $plugin_sc == 'daily' ) { if( $plugin_sc == 'daily' ) {
$date = date( 'Y-m-d' ); $date = date( 'Y-m-d' );
$hours = sanitize_text_field( $_POST['plugin_schedule-sethour'] ); $hours = sanitize_text_field( $_POST['plugin_schedule-sethour'] );
$minutes = sanitize_text_field( $_POST['plugin_schedule-setminutes'] ); $minutes = sanitize_text_field( $_POST['plugin_schedule-setminutes'] );
$seconds = date( 's' ); $seconds = date( 's' );
$fullDate = $date.' '.$hours.':'.$minutes.':'.$seconds; $fullDate = $date.' '.$hours.':'.$minutes.':'.$seconds;
$pluginSetTime = strtotime( $fullDate ); $pluginSetTime = strtotime( $fullDate );
wp_schedule_event( $pluginSetTime, $plugin_sc, 'wp_update_plugins' ); wp_schedule_event( $pluginSetTime, $plugin_sc, 'wp_update_plugins' );
@ -119,11 +119,11 @@ if( isset( $_POST['submit'] ) ) {
// Themes // Themes
if( $theme_sc == 'daily' ) { if( $theme_sc == 'daily' ) {
$dateT = date( 'Y-m-d' ); $dateT = date( 'Y-m-d' );
$hoursT = sanitize_text_field( $_POST['theme_schedule-sethour'] ); $hoursT = sanitize_text_field( $_POST['theme_schedule-sethour'] );
$minutesT = sanitize_text_field( $_POST['theme_schedule-setminutes'] ); $minutesT = sanitize_text_field( $_POST['theme_schedule-setminutes'] );
$secondsT = date( 's' ); $secondsT = date( 's' );
$fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT; $fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT;
$themeSetTime = strtotime( $fullDateT ); $themeSetTime = strtotime( $fullDateT );
wp_schedule_event( $themeSetTime, $theme_sc, 'wp_update_themes' ); wp_schedule_event( $themeSetTime, $theme_sc, 'wp_update_themes' );
@ -139,11 +139,11 @@ if( isset( $_POST['submit'] ) ) {
// Core // Core
if( $core_sc == 'daily' ) { if( $core_sc == 'daily' ) {
$dateC = date( 'Y-m-d' ); $dateC = date( 'Y-m-d' );
$hoursC = sanitize_text_field( $_POST['core_schedule-sethour'] ); $hoursC = sanitize_text_field( $_POST['core_schedule-sethour'] );
$minutesC = sanitize_text_field( $_POST['core_schedule-setminutes'] ); $minutesC = sanitize_text_field( $_POST['core_schedule-setminutes'] );
$secondsC = date( 's' ); $secondsC = date( 's' );
$fullDateC = $dateC.' '.$hoursC.':'.$minutesC.':'.$secondsC; $fullDateC = $dateC.' '.$hoursC.':'.$minutesC.':'.$secondsC;
$coreSetTime = strtotime( $fullDateC ); $coreSetTime = strtotime( $fullDateC );
wp_schedule_event( $coreSetTime, $core_sc, 'wp_version_check' ); wp_schedule_event( $coreSetTime, $core_sc, 'wp_version_check' );
@ -157,11 +157,11 @@ if( isset( $_POST['submit'] ) ) {
// Update notifications // Update notifications
if( $schedule_mail == 'daily' ) { if( $schedule_mail == 'daily' ) {
$dateT = date( 'Y-m-d' ); $dateT = date( 'Y-m-d' );
$hoursT = sanitize_text_field( $_POST['update_notifications-sethour'] ); $hoursT = sanitize_text_field( $_POST['update_notifications-sethour'] );
$minutesT = sanitize_text_field( $_POST['update_notifications-setminutes'] ); $minutesT = sanitize_text_field( $_POST['update_notifications-setminutes'] );
$secondsT = date( 's' ); $secondsT = date( 's' );
$fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT; $fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT;
$emailSetTime = strtotime( $fullDateT ); $emailSetTime = strtotime( $fullDateT );
wp_schedule_event( $emailSetTime, $schedule_mail, 'cau_set_schedule_mail' ); wp_schedule_event( $emailSetTime, $schedule_mail, 'cau_set_schedule_mail' );
@ -175,11 +175,11 @@ if( isset( $_POST['submit'] ) ) {
// Outdated notifications // Outdated notifications
if( $outdated_notifier == 'daily' ) { if( $outdated_notifier == 'daily' ) {
$dateT = date( 'Y-m-d' ); $dateT = date( 'Y-m-d' );
$hoursT = sanitize_text_field( $_POST['outdated_notifier-sethour'] ); $hoursT = sanitize_text_field( $_POST['outdated_notifier-sethour'] );
$minutesT = sanitize_text_field( $_POST['outdated_notifier-setminutes'] ); $minutesT = sanitize_text_field( $_POST['outdated_notifier-setminutes'] );
$secondsT = date( 's' ); $secondsT = date( 's' );
$fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT; $fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT;
$emailSetTime = strtotime( $fullDateT ); $emailSetTime = strtotime( $fullDateT );
wp_schedule_event( $emailSetTime, $outdated_notifier, 'cau_outdated_notifier' ); wp_schedule_event( $emailSetTime, $outdated_notifier, 'cau_outdated_notifier' );
@ -197,7 +197,7 @@ if( isset( $_POST['submit'] ) ) {
if( isset( $_GET['welcome'] ) ) { 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 class="welcome-image">
</div><div class="welcome-content"> </div><div class="welcome-content">
@ -222,7 +222,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
<form method="POST"> <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> <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>
<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> <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>
<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> <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>
<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> <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> <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' ); ?>" /> <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><?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> </td>
</tr> </tr>
</tbody> </tbody>
@ -484,7 +485,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
</div><div class="cau-column-small"> </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"> <div class="welcome-column welcome-column.welcome-column-half">
<h3 class="support-sidebar-title"><?php _e( 'Help' ); ?></h3> <h3 class="support-sidebar-title"><?php _e( 'Help' ); ?></h3>
<ul class="support-sidebar-list"> <ul class="support-sidebar-list">
@ -507,7 +508,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
</div> </div>
</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"> <div class="welcome-column welcome-column">
<h3><?php _e('Support', 'companion-auto-update');?></h3> <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> <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> </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> <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> <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"> <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> <p style="font-size: 12px; color: #BDBDBD;"><?php _e( 'Donations via PayPal. Amount can be changed.', 'companion-auto-update'); ?></p>
</div> </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><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> <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> <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 <?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 // Update the database
if( isset( $_GET['run'] ) && $_GET['run'] == 'db_update' ) { if( isset( $_GET['run'] ) && $_GET['run'] == 'db_update' ) {
cau_manual_update(); cau_manual_update();
@ -17,158 +27,125 @@
$allowedValues = array( 'seo', 'cron' ); $allowedValues = array( 'seo', 'cron' );
if( !in_array( $report_to_ignore, $allowedValues ) ) { if( !in_array( $report_to_ignore, $allowedValues ) ) {
wp_die( 'Trying to cheat eh?' ); wp_die( 'Trying to cheat eh?' );
} else { } else {
global $wpdb;
$table_name = $wpdb->prefix . "auto_updates"; $table_name = $wpdb->prefix . "auto_updates";
$wpdb->query( $wpdb->prepare( "UPDATE {$table_name} SET onoroff = %s WHERE name = 'ignore_$report_to_ignore'", 'yes' ) ); $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' ); $__ignored = __( 'This report will now be ignored', 'companion-auto-update' );
echo "<div id='message' class='updated'><p><b>$__ignored</b></p></div>"; 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"> <div class="cau_status_page">
<table class="cau_status_list widefat striped"> <?php
<thead> $events = array(
<tr> 0 => array(
<th class="cau_status_name"><strong><?php _e( 'Auto Updater', 'companion-auto-update' ); ?></strong></th> 'name' => __( 'Events', 'companion-auto-update' ),
<th class="cau_status_active_state"><strong><?php _e( 'Status', 'companion-auto-update' ); ?></strong></th> 'fields' => array(
<th class="cau_status_interval"><strong><?php _e( 'Interval', 'companion-auto-update' ); ?></strong></th> 'plugins' => __( 'Plugins', 'companion-auto-update' ),
<th class="cau_status_next"><strong><?php _e( 'Next', 'companion-auto-update' ); ?></strong></th> 'themes' => __( 'Themes', 'companion-auto-update' ),
</tr> 'minor' => __( 'Core (Minor)', 'companion-auto-update' ),
</thead> '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',
'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' ),
)
),
);
<tbody id="the-list"> $__sta = __( 'Status', 'companion-auto-update' );
<?php $__int = __( 'Interval', 'companion-auto-update' );
$__nxt = __( 'Next', 'companion-auto-update' );
$auto_updaters = array( foreach( $events as $event => $info ) {
'plugins' => __( 'Plugins', 'companion-auto-update' ),
'themes' => __( 'Themes', 'companion-auto-update' ),
'minor' => __( 'Core (Minor)', 'companion-auto-update' ),
'major' => __( 'Core (Major)', 'companion-auto-update' )
);
$eventNames = array( echo "<table class='cau_status_list widefat striped'>
'plugins' => 'wp_update_plugins',
'themes' => 'wp_update_themes',
'minor' => 'wp_version_check',
'major' => 'wp_version_check'
);
foreach ( $auto_updaters as $key => $value ) { <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_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>";
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 "</tbody>
echo "<tr> </table>";
<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(
'send' => 'cau_set_schedule_mail',
'sendupdate' => 'cau_set_schedule_mail',
'wpemails' => 'cau_set_schedule_mail',
);
foreach ( $other_events 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( $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;';
}
$__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 cau_status_warnings"> <table class="cau_status_list widefat striped cau_status_warnings">
<thead> <thead>
<tr> <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> </tr>
</thead> </thead>
<tbody id="the-list"> <tbody id="the-list">
<!-- checkAutomaticUpdaterDisabled -->
<tr> <tr>
<td class='cau_status_icon'><span class="dashicons dashicons-update"></span></td>
<td><?php _e( 'Auto updates', 'companion-auto-update' ); ?></td> <td><?php _e( 'Auto updates', 'companion-auto-update' ); ?></td>
<?php if ( checkAutomaticUpdaterDisabled() ) { ?> <?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> <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> <td></td>
</tr> </tr>
<!-- Connection with WP.org -->
<tr> <tr>
<td class='cau_status_icon'><span class="dashicons dashicons-wordpress"></span></td>
<td><?php _e( 'Connection with WordPress.org', 'companion-auto-update' ); ?></td> <td><?php _e( 'Connection with WordPress.org', 'companion-auto-update' ); ?></td>
<?php if( wp_http_supports( array( 'ssl' ) ) == '1' ) { <?php if( wp_http_supports( array( 'ssl' ) ) == '1' ) {
$__text = __( 'No issues detected', 'companion-auto-update' ); $__text = __( 'No issues detected', 'companion-auto-update' );
@ -194,10 +173,13 @@
} else { } else {
$__text = __( 'Disabled', 'companion-auto-update' ); $__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>"; echo "<td colspan='3' class='cau_status_active_state'><span class='cau_disabled'><span class='dashicons dashicons-no'></span> $__text</span></td>";
} ?> }
?>
</tr> </tr>
<!-- ignore_seo check -->
<tr <?php if( cau_get_db_value( 'ignore_seo' ) == 'yes' ) { echo "class='report_hidden'"; } ?> > <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> <td><?php _e( 'Search Engine Visibility', 'companion-auto-update' ); ?></td>
<?php if( get_option( 'blog_public' ) == 0 ) { ?> <?php if( get_option( 'blog_public' ) == 0 ) { ?>
<td colspan="2" class="cau_status_active_state"> <td colspan="2" class="cau_status_active_state">
@ -213,7 +195,9 @@
<?php } ?> <?php } ?>
</tr> </tr>
<!-- ignore_cron check -->
<tr <?php if( cau_get_db_value( 'ignore_cron' ) == 'yes' ) { echo "class='report_hidden'"; } ?> > <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> <td><?php _e( 'Cronjobs', 'companion-auto-update' ); ?></td>
<?php if( checkCronjobsDisabled() ) { ?> <?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> <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 } ?> <?php } ?>
</tr> </tr>
<!-- wp_version_check -->
<tr> <tr>
<td class='cau_status_icon'><span class="dashicons dashicons-wordpress-alt"></span></td>
<td>wp_version_check</td> <td>wp_version_check</td>
<?php if ( !has_filter( 'wp_version_check', 'wp_version_check' ) ) { ?> <?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> <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 } ?> <?php } ?>
</tr> </tr>
<!-- VCD -->
<tr> <tr>
<td class='cau_status_icon'><span class="dashicons dashicons-open-folder"></span></td>
<td>VCS</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> <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> </tr>
@ -247,48 +235,56 @@
</table> </table>
<table class="autoupdate cau_status_list widefat striped cau_status_warnings"> <table class="autoupdate cau_status_list widefat striped cau_status_warnings">
<thead> <thead>
<tr> <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> </tr>
</thead> </thead>
<tbody id="the-list"> <tbody id="the-list">
<tr> <tr>
<td class='cau_status_icon'><span class="dashicons dashicons-wordpress"></span></td>
<td>WordPress</td> <td>WordPress</td>
<td><?php echo get_bloginfo( 'version' ); ?></td> <td><?php echo get_bloginfo( 'version' ); ?></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </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</td>
<td><?php echo phpversion(); ?></td> <td><?php echo phpversion(); ?> <code>(Required: 5.1.0 or up)</code></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
<tr <?php if( cau_incorrectDatabaseVersion() ) { echo "class='inactive'"; } ?>> <tr <?php if( cau_incorrectDatabaseVersion() ) { echo "class='inactive'"; } ?>>
<td class='cau_status_icon'><span class="dashicons dashicons-database"></span></td>
<td>Database</td> <td>Database</td>
<td><?php echo get_option( "cau_db_version" ); ?> <code>(Latest: <?php echo cau_db_version(); ?>)</code></td> <td><?php echo get_option( "cau_db_version" ); ?> <code>(Latest: <?php echo cau_db_version(); ?>)</code></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
<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_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 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>
<td></td> <td></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<?php <?php
// If has incomptable plugins // If has incomptable plugins
if( cau_incompatiblePlugins() ) { ?> if( cau_incompatiblePlugins() ) { ?>
<table class="cau_status_list no_column_width widefat striped cau_status_warnings"> <table class="cau_status_list no_column_width widefat striped cau_status_warnings">
<thead> <thead>
<tr> <tr>
<th class="cau_plugin_issue_name" colspan="4"><strong><?php _e( 'Possible plugin issues', 'companion-auto-update' ); ?></strong></th> <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"> <tbody id="the-list">
<?php <?php
foreach ( cau_incompatiblePluginlist() as $key => $value ) { foreach ( cau_incompatiblePluginlist() as $key => $value ) {
if( is_plugin_active( $key ) ) { if( is_plugin_active( $key ) ) {
echo '<tr> echo '<tr>
@ -306,6 +303,7 @@
</tr>'; </tr>';
} }
} }
?> ?>
</tbody> </tbody>
@ -313,6 +311,7 @@
<?php } ?> <?php } ?>
<!-- Advanced info -->
<table class="autoupdate cau_status_list widefat striped cau_status_warnings"> <table class="autoupdate cau_status_list widefat striped cau_status_warnings">
<thead> <thead>
@ -320,36 +319,69 @@
<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> <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> </tr>
</thead> </thead>
<tbody id="the-list"> <tbody id="the-list">
<tr> <tr>
<td> <td>
<div class='button button-primary toggle_advanced_button'><?php _e( 'Toggle', 'companion-auto-update' ); ?></div> <div class='button button-primary toggle_advanced_button'><?php _e( 'Toggle', 'companion-auto-update' ); ?></div>
<div class='toggle_advanced_content' style='display: none;'> <div class='toggle_advanced_content' style='display: none;'>
<?php <?php
global $wpdb; $cau_configs = $wpdb->get_results( "SELECT * FROM $table_name" );
$autoupdates = $wpdb->prefix."auto_updates";
$cau_configs = $wpdb->get_results( "SELECT * FROM $autoupdates" );
array_push( $cau_configs, "WordPress: ".get_bloginfo( 'version' ) ); array_push( $cau_configs, "WordPress: ".get_bloginfo( 'version' ) );
array_push( $cau_configs, "PHP: ".phpversion() ); array_push( $cau_configs, "PHP: ".phpversion() );
array_push( $cau_configs, "DB: ".get_option( "cau_db_version" ).' / '.cau_db_version() ); array_push( $cau_configs, "DB: ".get_option( "cau_db_version" ).' / '.cau_db_version() );
echo "<textarea style='width: 100%; height: 750px;'>"; echo "<textarea style='width: 100%; height: 750px;'>";
print_r( $cau_configs ); print_r( $cau_configs );
echo "</textarea>"; echo "</textarea>";
?> ?>
</div> </div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<script>jQuery( '.toggle_advanced_button' ).click( function() { jQuery( '.toggle_advanced_content' ).toggle(); });</script> <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> </div>
<?php <?php
// Remove the line // Remove the line
if( isset( $_POST['fixit'] ) ) { if( isset( $_POST['fixit'] ) ) {
check_admin_referer( 'cau_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>"; 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 { .cau_content .button-hero {
font-weight: 500; font-weight: 500;
padding: 15px 30px!important; padding: 2px 15px!important;
} }
#message.cau { #message.cau {
background: #FFF; 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 { .cau_mobile_prefix {
display: none; 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 */ /* Rollback list */
table.rollbacklist { table.rollbacklist {

View File

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

View File

@ -1,9 +1,10 @@
<?php <?php
/* /*
* Plugin Name: Companion Auto Update * Plugin Name: Companion Auto Update
* Plugin URI: http://codeermeneer.nl/portfolio/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. * 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: Papin Schipper
* Author URI: http://codeermeneer.nl/ * Author URI: http://codeermeneer.nl/
* Contributors: papin * Contributors: papin
@ -26,6 +27,7 @@ add_action( 'init', 'cau_init' );
// Set up the database and required schedules // Set up the database and required schedules
function cau_install( $network_wide ) { function cau_install( $network_wide ) {
if ( is_multisite() && $network_wide ) { if ( is_multisite() && $network_wide ) {
global $wpdb; global $wpdb;
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
@ -37,12 +39,14 @@ function cau_install( $network_wide ) {
} else { } else {
cau_database_creation(); 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_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_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_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_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 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_set_schedule_mail', 'cau_check_updates_mail' );
add_action( 'cau_outdated_notifier', 'cau_outdated_notifier_mail' ); add_action( 'cau_outdated_notifier', 'cau_outdated_notifier_mail' );
add_action( 'wp_update_plugins', 'cau_run_custom_hooks_p' ); add_action( 'wp_update_plugins', 'cau_run_custom_hooks_p' );
@ -62,6 +66,7 @@ function cau_pluginActivateWelcome() {
} }
register_activation_hook(__FILE__, 'cau_pluginActivateWelcome'); register_activation_hook(__FILE__, 'cau_pluginActivateWelcome');
// Redirect to welcome screen on activation of plugin
function cau_pluginRedirectWelcomeScreen() { function cau_pluginRedirectWelcomeScreen() {
if ( get_option( 'cau_redirectToWelcomeScreen', false ) ) { if ( get_option( 'cau_redirectToWelcomeScreen', false ) ) {
delete_option( 'cau_redirectToWelcomeScreen' ); delete_option( 'cau_redirectToWelcomeScreen' );
@ -81,35 +86,22 @@ function cau_donateUrl() {
function cau_db_version() { function cau_db_version() {
return '3.8.3'; return '3.8.3';
} }
function cau_database_creation() { function cau_database_creation() {
global $wpdb; global $wpdb;
// Plugin db info // Plugin db info
$cau_db_version = cau_db_version(); $cau_db_version = cau_db_version();
$autoupdates = $wpdb->prefix."auto_updates"; $autoupdates = $wpdb->prefix."auto_updates";
$updateLog = $wpdb->prefix."update_log"; $updateLog = $wpdb->prefix."update_log";
// WordPress db info // WordPress db info
$charset_collate = $wpdb->get_charset_collate(); $charset_collate = $wpdb->get_charset_collate();
// DB table creation queries // DB table creation queries
$sql = "CREATE TABLE $autoupdates ( $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;";
id INT(9) NOT NULL AUTO_INCREMENT, $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;";
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 // Create DB tables
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
@ -121,23 +113,18 @@ function cau_database_creation() {
// Insert data // Insert data
cau_install_data(); cau_install_data();
} }
// Check if database table exists before creating // Check if database table exists before creating
function cau_check_if_exists( $whattocheck, $id = 'name', $db_table = 'auto_updates' ) { function cau_check_if_exists( $whattocheck, $id = 'name', $db_table = 'auto_updates' ) {
global $wpdb; 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];
$rows = $wpdb->get_col( "SELECT COUNT(*) as num_rows FROM {$table_name} WHERE {$id} = '{$whattocheck}'" ); return ( $check > 0 ) ? true : false;
$check = $rows[0];
if( $check > 0 ) {
return true;
} else {
return false;
}
} }
@ -145,6 +132,7 @@ function cau_check_if_exists( $whattocheck, $id = 'name', $db_table = 'auto_upda
function cau_install_data() { function cau_install_data() {
global $wpdb; global $wpdb;
$table_name = $wpdb->prefix . "auto_updates"; $table_name = $wpdb->prefix . "auto_updates";
$toemail = get_option('admin_email'); $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_custom_hooks_themes' );
wp_clear_scheduled_hook( 'cau_log_updater' ); 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( 'plugins_auto_update_enabled', '__return_true' );
add_filter( 'themes_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_plugin_update_send_email', '__return_true' );
add_filter( 'auto_theme_update_send_email', '__return_true' ); add_filter( 'auto_theme_update_send_email', '__return_true' );
} }
register_deactivation_hook( __FILE__, 'cau_remove' ); register_deactivation_hook( __FILE__, 'cau_remove' );
@ -226,13 +215,13 @@ function cau_update_db_check() {
$db_charset = constant( 'DB_CHARSET' ); $db_charset = constant( 'DB_CHARSET' );
$wpdb->query( "ALTER TABLE $autoupdates CONVERT TO CHARACTER SET $db_charset" ); $wpdb->query( "ALTER TABLE $autoupdates CONVERT TO CHARACTER SET $db_charset" );
$wpdb->query( "ALTER TABLE $updateLog 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 ); update_option( "cau_db_version", $cau_db_version );
} }
} }
add_action( 'upgrader_process_complete', 'cau_update_db_check' ); add_action( 'upgrader_process_complete', 'cau_update_db_check' );
// Manual update // Manual update
@ -250,15 +239,11 @@ function register_cau_menu_page() {
add_action( 'admin_menu', 'register_cau_menu_page' ); add_action( 'admin_menu', 'register_cau_menu_page' );
// Settings page // Settings page
function cau_frontend() { ?> function cau_frontend() {
<div class='wrap cau_content_wrap cau_content'> echo "<div class='wrap cau_content_wrap cau_content'>
<h1 class='wp-heading-inline'>".__( 'Companion Auto Update', 'companion-auto-update' )."</h1>
<h1 class="wp-heading-inline"><?php _e( 'Companion Auto Update', 'companion-auto-update' ); ?></h1> <hr class='wp-header-end'>";
<hr class="wp-header-end">
<?php
// Make sure the correct timezone is used // Make sure the correct timezone is used
date_default_timezone_set( cau_get_proper_timezone() ); date_default_timezone_set( cau_get_proper_timezone() );
@ -273,17 +258,13 @@ function cau_frontend() { ?>
// Show subtabs // Show subtabs
echo "<h2 class='nav-tab-wrapper wp-clearfix'>"; echo "<h2 class='nav-tab-wrapper wp-clearfix'>";
foreach ( $allowedPages as $page => $title ) { foreach ( $allowedPages as $page => $title ) {
echo "<a href='".cau_url( $page )."' id='tab-".$page."' class='nav-tab "._active_tab( $page )."'>".$title; echo "<a href='".cau_url( $page )."' id='tab-".$page."' class='nav-tab "._active_tab( $page )."'>".$title;
if( $page == 'status' ) { if( $page == 'status' ) echo cau_pluginHasIssues() ? "<span class='cau_melding level-".cau_pluginIssueLevels()."'></span>" : "<span class='cau_melding level-okay'></span>"; // Show status icon
if( cau_pluginHasIssues() ) {
echo "<span class='cau_melding level-".cau_pluginIssueLevels()."'></span>";
} else {
echo "<span class='cau_melding level-okay'></span>";
}
}
echo "</a>"; echo "</a>";
} }
echo "</h2>"; echo "</h2>";
// Show page content // Show page content
@ -300,11 +281,9 @@ function cau_frontend() { ?>
wp_die( 'You\'re not allowed to view <strong>'.$requestedPage.'</strong>.' ); wp_die( 'You\'re not allowed to view <strong>'.$requestedPage.'</strong>.' );
} }
?> echo '</div>';
</div> }
<?php }
// Add a widget to the dashboard. // Add a widget to the dashboard.
function cau_add_widget() { function cau_add_widget() {
@ -312,28 +291,18 @@ function cau_add_widget() {
} }
add_action( 'wp_dashboard_setup', 'cau_add_widget' ); add_action( 'wp_dashboard_setup', 'cau_add_widget' );
// Widget content
function cau_widget() { 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 '<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>'; 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' ); cau_fetch_log( '7' );
echo '<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>';
<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 // Load admin styles
function load_cau_global_styles( $hook ) { function load_cau_global_styles( $hook ) {
wp_enqueue_style( 'cau_admin_styles', plugins_url( 'backend/style.css' , __FILE__ ) ); // Plugin scripts
// Plugin scripts wp_enqueue_style( 'cau_warning_styles', plugins_url( 'backend/warningbar.css' , __FILE__ ) ); // Check for issues
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__ ) );
} }
add_action( 'admin_enqueue_scripts', 'load_cau_global_styles', 99 ); 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_style( 'thickbox' );
wp_enqueue_script( 'thickbox' ); wp_enqueue_script( 'thickbox' );
wp_enqueue_script( 'plugin-install' ); wp_enqueue_script( 'plugin-install' );
} }
add_action( 'admin_enqueue_scripts', 'load_cau_page_styles', 100 ); 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 // Auto Update Class
class CAU_auto_update { class CAU_auto_update {
// Enable Update filters
public function __construct() { public function __construct() {
// Enable Update filters
add_action( 'plugins_loaded', array( &$this, 'CAU_auto_update_filters' ), 1 ); add_action( 'plugins_loaded', array( &$this, 'CAU_auto_update_filters' ), 1 );
} }
public function CAU_auto_update_filters() { public function CAU_auto_update_filters() {
@ -428,14 +394,10 @@ class CAU_auto_update {
// WP Email Config // WP Email Config
$configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'wpemails'"); $configs = $wpdb->get_results( "SELECT * FROM {$table_name} WHERE name = 'wpemails'");
foreach ( $configs as $config ) { foreach ( $configs as $config ) {
if( $config->onoroff == 'on' ) { if( $config->onoroff == 'on' ) add_filter( 'auto_core_update_send_email', '__return_true', 1 ); // Turn on
add_filter( 'auto_core_update_send_email', '__return_true' ); // Core updates else add_filter( 'auto_core_update_send_email', '__return_false', 1 ); // Turn off
} else {
add_filter( 'auto_core_update_send_email', '__return_false' ); // Core updates
}
} }
} }
} }
@ -443,25 +405,16 @@ new CAU_auto_update();
// Check for issues // Check for issues
function cau_checkForIssues( $admin_bar ) { function cau_checkForIssues( $admin_bar ) {
if( cau_pluginHasIssues() && is_admin() && cau_pluginIssueLevels() == 'high' ) {
if( cau_pluginHasIssues() && is_admin() ) { $admin_bar->add_menu( array(
'id' => 'cau-has-issues',
if( cau_pluginIssueLevels() == 'high' ) { 'title' => '<span class="ab-icon"></span><span class="cau-level-'.cau_pluginIssueLevels().'">'.cau_pluginIssueCount().'</span>',
$cauWaningBarTitle = __( 'Companion Auto Update ran into a critical error. View the status log for more info.', 'companion-auto-update' ); 'href' => cau_url( 'status' ),
'meta' => array(
$admin_bar->add_menu( array( 'target' => '_self',
'id' => 'cau-has-issues', 'title' => __( 'Companion Auto Update ran into a critical error. View the status log for more info.', 'companion-auto-update' ),
'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,
),
));
}
} }
} }
add_action( 'admin_bar_menu', 'cau_checkForIssues', 150 ); 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 Requires at least: 3.6.0
Tested up to: 5.9 Tested up to: 5.9
Requires PHP: 5.1 Requires PHP: 5.1
Stable tag: 3.8.3 Stable tag: 3.8.5
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html 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 == == 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) = = 3.8.3 (December 9, 2021) =
* New: Plugin update e-mails now have an option to link to a few important pages * New: Plugin update e-mails now have an option to link to a few important pages
* Fix: Error: Undefined index: dbupdateemails * Fix: Error: Undefined index: dbupdateemails