updated plugin Companion Auto Update
version 3.8.0
This commit is contained in:
parent
8a03c72181
commit
93745b9ce4
@ -73,7 +73,8 @@ if( isset( $_POST['submit'] ) ) {
|
|||||||
$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['schedule_mail'] );
|
$schedule_mail = sanitize_text_field( $_POST['update_notifications'] );
|
||||||
|
$outdated_notifier = sanitize_text_field( $_POST['outdated_notifier'] );
|
||||||
$html_or_text = sanitize_text_field( $_POST['html_or_text'] );
|
$html_or_text = sanitize_text_field( $_POST['html_or_text'] );
|
||||||
|
|
||||||
// First clear schedules
|
// First clear schedules
|
||||||
@ -84,6 +85,7 @@ if( isset( $_POST['submit'] ) ) {
|
|||||||
wp_clear_scheduled_hook('cau_custom_hooks_plugins');
|
wp_clear_scheduled_hook('cau_custom_hooks_plugins');
|
||||||
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');
|
||||||
|
wp_clear_scheduled_hook('cau_outdated_notifier');
|
||||||
|
|
||||||
// Then set the new times
|
// Then set the new times
|
||||||
|
|
||||||
@ -91,8 +93,8 @@ if( isset( $_POST['submit'] ) ) {
|
|||||||
if( $plugin_sc == 'daily' ) {
|
if( $plugin_sc == 'daily' ) {
|
||||||
|
|
||||||
$date = date( 'Y-m-d' );
|
$date = date( 'Y-m-d' );
|
||||||
$hours = sanitize_text_field( $_POST['pluginScheduleTimeH'] );
|
$hours = sanitize_text_field( $_POST['plugin_schedule-sethour'] );
|
||||||
$minutes = sanitize_text_field( $_POST['pluginScheduleTimeM'] );
|
$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 );
|
||||||
@ -113,8 +115,8 @@ if( isset( $_POST['submit'] ) ) {
|
|||||||
if( $theme_sc == 'daily' ) {
|
if( $theme_sc == 'daily' ) {
|
||||||
|
|
||||||
$dateT = date( 'Y-m-d' );
|
$dateT = date( 'Y-m-d' );
|
||||||
$hoursT = sanitize_text_field( $_POST['ThemeScheduleTimeH'] );
|
$hoursT = sanitize_text_field( $_POST['theme_schedule-sethour'] );
|
||||||
$minutesT = sanitize_text_field( $_POST['ThemeScheduleTimeM'] );
|
$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 );
|
||||||
@ -133,8 +135,8 @@ if( isset( $_POST['submit'] ) ) {
|
|||||||
if( $core_sc == 'daily' ) {
|
if( $core_sc == 'daily' ) {
|
||||||
|
|
||||||
$dateC = date( 'Y-m-d' );
|
$dateC = date( 'Y-m-d' );
|
||||||
$hoursC = sanitize_text_field( $_POST['CoreScheduleTimeH'] );
|
$hoursC = sanitize_text_field( $_POST['core_schedule-sethour'] );
|
||||||
$minutesC = sanitize_text_field( $_POST['CoreScheduleTimeM'] );
|
$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 );
|
||||||
@ -147,12 +149,12 @@ if( isset( $_POST['submit'] ) ) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emails
|
// 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['timeScheduleEmailTimeH'] );
|
$hoursT = sanitize_text_field( $_POST['update_notifications-sethour'] );
|
||||||
$minutesT = sanitize_text_field( $_POST['timeScheduleEmailTimeM'] );
|
$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 );
|
||||||
@ -165,6 +167,25 @@ if( isset( $_POST['submit'] ) ) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Outdated notifications
|
||||||
|
if( $outdated_notifier == 'daily' ) {
|
||||||
|
|
||||||
|
$dateT = date( 'Y-m-d' );
|
||||||
|
$hoursT = sanitize_text_field( $_POST['outdated_notifier-sethour'] );
|
||||||
|
$minutesT = sanitize_text_field( $_POST['outdated_notifier-setminutes'] );
|
||||||
|
$secondsT = date( 's' );
|
||||||
|
$fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT;
|
||||||
|
$emailSetTime = strtotime( $fullDateT );
|
||||||
|
|
||||||
|
wp_schedule_event( $emailSetTime, $outdated_notifier, 'cau_outdated_notifier' );
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
wp_schedule_event( time(), $outdated_notifier, 'cau_outdated_notifier' );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '<div id="message" class="updated"><p><b>'.__( 'Settings saved.' ).'</b></p></div>';
|
echo '<div id="message" class="updated"><p><b>'.__( 'Settings saved.' ).'</b></p></div>';
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -191,6 +212,7 @@ $plugin_schedule = wp_get_schedule( 'wp_update_plugins' );
|
|||||||
$theme_schedule = wp_get_schedule( 'wp_update_themes' );
|
$theme_schedule = wp_get_schedule( 'wp_update_themes' );
|
||||||
$core_schedule = wp_get_schedule( 'wp_version_check' );
|
$core_schedule = wp_get_schedule( 'wp_version_check' );
|
||||||
$schedule_mail = wp_get_schedule( 'cau_set_schedule_mail' );
|
$schedule_mail = wp_get_schedule( 'cau_set_schedule_mail' );
|
||||||
|
$outdated_notifier = wp_get_schedule( 'cau_outdated_notifier' );
|
||||||
$cs_hooks_p = wp_get_schedule( 'cau_custom_hooks_plugins' );
|
$cs_hooks_p = wp_get_schedule( 'cau_custom_hooks_plugins' );
|
||||||
$cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
|
$cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
|
||||||
$availableIntervals = cau_wp_get_schedules();
|
$availableIntervals = cau_wp_get_schedules();
|
||||||
@ -252,21 +274,16 @@ $availableIntervals = cau_wp_get_schedules();
|
|||||||
|
|
||||||
<table class="form-table">
|
<table class="form-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><?php _e( 'Update available', 'companion-auto-update' );?></th>
|
<th scope="row"><?php _e( 'Update notifications', 'companion-auto-update' );?></th>
|
||||||
<td>
|
|
||||||
<p>
|
|
||||||
<input id="cau_send" name="cau_send" type="checkbox" <?php if( cau_get_db_value( 'send' ) == 'on' ) { echo 'checked'; } ?> />
|
|
||||||
<label for="cau_send"><?php _e('Send me emails when an update is available.', 'companion-auto-update');?></label>
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row"><?php _e( 'Successful update', 'companion-auto-update' );?></th>
|
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<input id="cau_send_update" name="cau_send_update" type="checkbox" <?php if( cau_get_db_value( 'sendupdate' ) == 'on' ) { echo 'checked'; } ?> />
|
<input id="cau_send_update" name="cau_send_update" type="checkbox" <?php if( cau_get_db_value( 'sendupdate' ) == 'on' ) { echo 'checked'; } ?> />
|
||||||
<label for="cau_send_update"><?php _e( 'Send me emails when something has been updated.', 'companion-auto-update' );?></label>
|
<label for="cau_send_update"><?php _e( 'Send me emails when something has been updated.', 'companion-auto-update' );?></label>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<input id="cau_send" name="cau_send" type="checkbox" <?php if( cau_get_db_value( 'send' ) == 'on' ) { echo 'checked'; } ?> />
|
||||||
|
<label for="cau_send"><?php _e('Send me emails when an update is available.', 'companion-auto-update');?></label>
|
||||||
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -274,12 +291,12 @@ $availableIntervals = cau_wp_get_schedules();
|
|||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<input id="cau_send_outdated" name="cau_send_outdated" type="checkbox" <?php if( cau_get_db_value( 'sendoutdated' ) == 'on' ) { echo 'checked'; } ?> />
|
<input id="cau_send_outdated" name="cau_send_outdated" type="checkbox" <?php if( cau_get_db_value( 'sendoutdated' ) == 'on' ) { echo 'checked'; } ?> />
|
||||||
<label for="cau_send_outdated"><?php _e( 'Be notified of plugins that have not been tested with your current version of WordPress.', 'companion-auto-update' );?></label>
|
<label for="cau_send_outdated"><?php _e( 'Be notified of plugins that have not been tested with the 3 latest major versions of WordPress.', 'companion-auto-update' );?></label>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><?php _e( 'Email Address' );?></th>
|
<th scope="row"><?php _e( 'Email Address', 'companion-auto-update' );?></th>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<label for="cau_email"><?php _e( 'To', 'companion-auto-update' ); ?>:</label>
|
<label for="cau_email"><?php _e( 'To', 'companion-auto-update' ); ?>:</label>
|
||||||
@ -330,142 +347,83 @@ $availableIntervals = cau_wp_get_schedules();
|
|||||||
|
|
||||||
<div class="welcome-to-cau interval-bg welcome-panel cau-dashboard-box" style="overflow: hidden;">
|
<div class="welcome-to-cau interval-bg welcome-panel 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>
|
||||||
|
|
||||||
<div class="welcome-column welcome-column-quarter">
|
<?php
|
||||||
|
|
||||||
|
function cau_show_interval_selection( $identiefier, $schedule ) {
|
||||||
|
|
||||||
|
// Get the info
|
||||||
|
$setValue = wp_get_schedule( $schedule );
|
||||||
|
$setTime = wp_next_scheduled( $schedule );
|
||||||
|
$setHour = date( 'H' , $setTime );
|
||||||
|
$setMinutes = date( 'i' , $setTime );
|
||||||
|
|
||||||
|
// Show interval selection
|
||||||
|
echo "<p>";
|
||||||
|
echo "<select name='$identiefier' id='$identiefier' class='schedule_interval wide interval_scheduler' data-timeblock='$identiefier'>";
|
||||||
|
foreach ( cau_wp_get_schedules() as $key => $value ) {
|
||||||
|
echo "<option "; if( $setValue == $key ) { echo "selected "; } echo "value='".$key."'>".$value."</option>";
|
||||||
|
}
|
||||||
|
echo "</select>";
|
||||||
|
echo "</p>";
|
||||||
|
|
||||||
|
// Set the time when daily is selected
|
||||||
|
echo "<div class='timeblock-$identiefier' style='display: none;'>";
|
||||||
|
|
||||||
|
echo "<div class='cau_schedule_input'>
|
||||||
|
<input type='number' min='0' max='23' name='".$identiefier."-sethour' value='$setHour' maxlength='2' >
|
||||||
|
</div><div class='cau_schedule_input_div'>
|
||||||
|
:
|
||||||
|
</div><div class='cau_schedule_input'>
|
||||||
|
<input type='number' min='0' max='59' name='".$identiefier."-setminutes' value='$setMinutes' maxlength='2' >
|
||||||
|
</div><div class='cau_shedule_notation'>
|
||||||
|
<span class='cau_tooltip'><span class='dashicons dashicons-editor-help'></span>
|
||||||
|
<span class='cau_tooltip_text'>".__( 'At what time should the updater run? Only works when set to <u>daily</u>.', 'companion-auto-update' )." - ".__( 'Time notation: 24H', 'companion-auto-update' )."</span>
|
||||||
|
</span>
|
||||||
|
</div>";
|
||||||
|
|
||||||
|
echo "</div>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="welcome-column">
|
||||||
|
|
||||||
<h4><?php _e( 'Plugin update interval', 'companion-auto-update' );?></h4>
|
<h4><?php _e( 'Plugin update interval', 'companion-auto-update' );?></h4>
|
||||||
<p>
|
<?php cau_show_interval_selection( 'plugin_schedule', 'wp_update_plugins' ); ?>
|
||||||
<select name='plugin_schedule' id='plugin_schedule' class='schedule_interval wide'>
|
|
||||||
<?php foreach ( $availableIntervals as $key => $value ) {
|
|
||||||
echo "<option "; if( $plugin_schedule == $key ) { echo "selected "; } echo "value='".$key."'>".$value."</option>";
|
|
||||||
} ?>
|
|
||||||
</select>
|
|
||||||
</p>
|
|
||||||
<div class='timeSchedulePlugins' <?php if( $plugin_schedule != 'daily' ) { echo "style='display: none;'"; } ?> >
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$setTimePlugins = wp_next_scheduled( 'wp_update_plugins' );
|
|
||||||
$setTimePluginsHour = date( 'H' , $setTimePlugins );
|
|
||||||
$setTimePluginsMin = date( 'i' , $setTimePlugins );
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class='cau_schedule_input'>
|
|
||||||
<input type='number' min='0' max='23' name='pluginScheduleTimeH' value='<?php echo $setTimePluginsHour; ?>' maxlength='2' >
|
|
||||||
</div><div class='cau_schedule_input_div'>
|
|
||||||
:
|
|
||||||
</div><div class='cau_schedule_input'>
|
|
||||||
<input type='number' min='0' max='59' name='pluginScheduleTimeM' value='<?php echo $setTimePluginsMin; ?>' maxlength='2' >
|
|
||||||
</div><div class='cau_shedule_notation'>
|
|
||||||
<span class='cau_tooltip'><span class="dashicons dashicons-editor-help"></span>
|
|
||||||
<span class='cau_tooltip_text'><?php _e('At what time should the updater run? Only works when set to <u>daily</u>.', 'companion-auto-update'); ?> - <?php _e( 'Time notation: 24H', 'companion-auto-update'); ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div><div class="welcome-column welcome-column-quarter">
|
<div class="welcome-column">
|
||||||
|
|
||||||
<h4><?php _e( 'Theme update interval', 'companion-auto-update' );?></h4>
|
<h4><?php _e( 'Theme update interval', 'companion-auto-update' );?></h4>
|
||||||
<p>
|
<?php cau_show_interval_selection( 'theme_schedule', 'wp_update_themes' ); ?>
|
||||||
<select name='theme_schedule' id='theme_schedule' class='schedule_interval wide'>
|
|
||||||
<?php foreach ( $availableIntervals as $key => $value ) {
|
|
||||||
echo "<option "; if( $theme_schedule == $key ) { echo "selected "; } echo "value='".$key."'>".$value."</option>";
|
|
||||||
} ?>
|
|
||||||
</select>
|
|
||||||
</p>
|
|
||||||
<div class='timeScheduleThemes' <?php if( $theme_schedule != 'daily' ) { echo "style='display: none;'"; } ?> >
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$setTimeThemes = wp_next_scheduled( 'wp_update_themes' );
|
|
||||||
$setTimeThemesHour = date( 'H' , $setTimeThemes );
|
|
||||||
$setTimeThemesMins = date( 'i' , $setTimeThemes );
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class='cau_schedule_input'>
|
|
||||||
<input type='number' min='0' max='23' name='ThemeScheduleTimeH' value='<?php echo $setTimeThemesHour; ?>' maxlength='2' >
|
|
||||||
</div><div class='cau_schedule_input_div'>
|
|
||||||
:
|
|
||||||
</div><div class='cau_schedule_input'>
|
|
||||||
<input type='number' min='0' max='59' name='ThemeScheduleTimeM' value='<?php echo $setTimeThemesMins; ?>' maxlength='2' >
|
|
||||||
</div><div class='cau_shedule_notation'>
|
|
||||||
<span class='cau_tooltip'><span class="dashicons dashicons-editor-help"></span>
|
|
||||||
<span class='cau_tooltip_text'><?php _e('At what time should the updater run? Only works when set to <u>daily</u>.', 'companion-auto-update'); ?> - <?php _e( 'Time notation: 24H', 'companion-auto-update'); ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div><div class="welcome-column welcome-column-quarter">
|
<div class="welcome-column">
|
||||||
|
|
||||||
<h4><?php _e( 'Core update interval', 'companion-auto-update' );?></h4>
|
<h4><?php _e( 'Core update interval', 'companion-auto-update' );?></h4>
|
||||||
<p>
|
<?php cau_show_interval_selection( 'core_schedule', 'wp_version_check' ); ?>
|
||||||
<select name='core_schedule' id='core_schedule' class='schedule_interval wide'>
|
|
||||||
<?php foreach ( $availableIntervals as $key => $value ) {
|
|
||||||
echo "<option "; if( $core_schedule == $key ) { echo "selected "; } echo "value='".$key."'>".$value."</option>";
|
|
||||||
} ?>
|
|
||||||
</select>
|
|
||||||
</p>
|
|
||||||
<div class='timeScheduleCore' <?php if( $core_schedule != 'daily' ) { echo "style='display: none;'"; } ?> >
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$setTimeCore = wp_next_scheduled( 'wp_version_check' );
|
|
||||||
$setTimeCoreHour = date( 'H' , $setTimeCore );
|
|
||||||
$setTimeCoreMins = date( 'i' , $setTimeCore );
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class='cau_schedule_input'>
|
|
||||||
<input type='number' min='0' max='23' name='CoreScheduleTimeH' value='<?php echo $setTimeCoreHour; ?>' maxlength='2' >
|
|
||||||
</div><div class='cau_schedule_input_div'>
|
|
||||||
:
|
|
||||||
</div><div class='cau_schedule_input'>
|
|
||||||
<input type='number' min='0' max='59' name='CoreScheduleTimeM' value='<?php echo $setTimeCoreMins; ?>' maxlength='2' >
|
|
||||||
</div><div class='cau_shedule_notation'>
|
|
||||||
<span class='cau_tooltip'><span class="dashicons dashicons-editor-help"></span>
|
|
||||||
<span class='cau_tooltip_text'><?php _e('At what time should the updater run? Only works when set to <u>daily</u>.', 'companion-auto-update'); ?> - <?php _e( 'Time notation: 24H', 'companion-auto-update'); ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div><div class="welcome-column welcome-column-quarter">
|
|
||||||
|
|
||||||
<h4><?php _e( 'Email Notifications', 'companion-auto-update' );?></h4>
|
|
||||||
<p>
|
|
||||||
<select id='schedule_mail' name='schedule_mail' class='schedule_interval wide'>
|
|
||||||
<?php foreach ( $availableIntervals as $key => $value ) {
|
|
||||||
echo "<option "; if( $schedule_mail == $key ) { echo "selected "; } echo "value='".$key."'>".$value."</option>";
|
|
||||||
} ?>
|
|
||||||
</select>
|
|
||||||
</p>
|
|
||||||
<div class='timeScheduleEmail' <?php if( $schedule_mail != 'daily' ) { echo "style='display: none;'"; } ?> >
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$setTimeEmails = wp_next_scheduled( 'cau_set_schedule_mail' );
|
|
||||||
$setTimeEmailHour = date( 'H' , $setTimeEmails );
|
|
||||||
$setTimeEmailMins = date( 'i' , $setTimeEmails );
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class='cau_schedule_input'>
|
|
||||||
<input type='number' min='0' max='23' name='timeScheduleEmailTimeH' value='<?php echo $setTimeEmailHour; ?>' maxlength='2' >
|
|
||||||
</div><div class='cau_schedule_input_div'>
|
|
||||||
:
|
|
||||||
</div><div class='cau_schedule_input'>
|
|
||||||
<input type='number' min='0' max='59' name='timeScheduleEmailTimeM' value='<?php echo $setTimeEmailMins; ?>' maxlength='2' >
|
|
||||||
</div><div class='cau_shedule_notation'>
|
|
||||||
<span class='cau_tooltip'><span class="dashicons dashicons-editor-help"></span>
|
|
||||||
<span class='cau_tooltip_text'><?php _e( 'Time notation: 24H', 'companion-auto-update'); ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="welcome-column">
|
||||||
|
|
||||||
|
<h4><?php _e( 'Update notifications', 'companion-auto-update' );?></h4>
|
||||||
|
<?php cau_show_interval_selection( 'update_notifications', 'cau_set_schedule_mail' ); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="welcome-column">
|
||||||
|
|
||||||
|
<h4><?php _e( 'Outdated software', 'companion-auto-update' );?></h4>
|
||||||
|
<?php cau_show_interval_selection( 'outdated_notifier', 'cau_outdated_notifier' ); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="welcome-to-cau advanced-bg welcome-panel cau-dashboard-box">
|
<div class="welcome-to-cau advanced-bg welcome-panel cau-dashboard-box">
|
||||||
@ -477,15 +435,15 @@ $availableIntervals = cau_wp_get_schedules();
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label><?php _e( 'Allow access to:', 'companion-auto-update' ); ?></label></th>
|
<th scope="row"><label><?php _e( 'Allow access to:', 'companion-auto-update' ); ?></label></th>
|
||||||
<td>
|
<td>
|
||||||
<p><label for="allow_administrator"><input name="allow_administrator" type="checkbox" id="allow_administrator" disabled="" checked=""><?php _e( 'Administrator' ); ?></label></p>
|
<p><label for="allow_administrator"><input name="allow_administrator" type="checkbox" id="allow_administrator" disabled="" checked=""><?php _e( 'Administrator', 'companion-auto-update' ); ?></label></p>
|
||||||
<p><label for="allow_editor"><input name="allow_editor" type="checkbox" id="allow_editor" <?php if( cau_get_db_value( 'allow_editor' ) == 'on' ) { echo "CHECKED"; } ?>><?php _e( 'Editor' ); ?></label></p>
|
<p><label for="allow_editor"><input name="allow_editor" type="checkbox" id="allow_editor" <?php if( cau_get_db_value( 'allow_editor' ) == 'on' ) { echo "CHECKED"; } ?>><?php _e( 'Editor', 'companion-auto-update' ); ?></label></p>
|
||||||
<p><label for="allow_author"><input name="allow_author" type="checkbox" id="allow_author" <?php if( cau_get_db_value( 'allow_author' ) == 'on' ) { echo "CHECKED"; } ?>><?php _e( 'Author' ); ?></label></p>
|
<p><label for="allow_author"><input name="allow_author" type="checkbox" id="allow_author" <?php if( cau_get_db_value( 'allow_author' ) == 'on' ) { echo "CHECKED"; } ?>><?php _e( 'Author', 'companion-auto-update' ); ?></label></p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label><?php _e( 'Delay updates', 'companion-auto-update' ); ?></label></th>
|
<th scope="row"><label><?php _e( 'Delay updates', 'companion-auto-update' ); ?></label></th>
|
||||||
<td>
|
<td>
|
||||||
<p><label for="update_delay"><input name="update_delay" type="checkbox" id="update_delay" <?php if( cau_get_db_value( 'update_delay' ) == 'on' ) { echo "CHECKED"; } ?>><?php _e( 'Delay updates' ); ?></label></p>
|
<p><label for="update_delay"><input name="update_delay" type="checkbox" id="update_delay" <?php if( cau_get_db_value( 'update_delay' ) == 'on' ) { echo "CHECKED"; } ?>><?php _e( 'Delay updates', 'companion-auto-update' ); ?></label></p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id='update_delay_days_block' <?php if( cau_get_db_value( 'update_delay' ) != 'on' ) { echo "class='disabled_option'"; } ?>>
|
<tr id='update_delay_days_block' <?php if( cau_get_db_value( 'update_delay' ) != 'on' ) { echo "class='disabled_option'"; } ?>>
|
||||||
@ -548,7 +506,14 @@ $availableIntervals = cau_wp_get_schedules();
|
|||||||
<a href="<?php echo cau_donateUrl(); ?>" target="_blank" class="button button-primary button-hero">
|
<a href="<?php echo cau_donateUrl(); ?>" target="_blank" class="button button-primary button-hero">
|
||||||
<?php _e('Donate to help development', 'companion-auto-update'); ?>
|
<?php _e('Donate to help development', 'companion-auto-update'); ?>
|
||||||
</a>
|
</a>
|
||||||
<p style="font-size: 12px; color: #BDBDBD;">Donations via PayPal. Amount can be changed.</p>
|
<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">
|
||||||
|
<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>
|
||||||
|
<a href="https://codeermeneer.nl/portfolio/plugin/companion-revision-manager/" target="_blank" class="button button-alt">Read more</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -565,50 +530,28 @@ $availableIntervals = cau_wp_get_schedules();
|
|||||||
jQuery( '#update_delay_days_block' ).toggleClass( 'disabled_option' );
|
jQuery( '#update_delay_days_block' ).toggleClass( 'disabled_option' );
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery( '#plugin_schedule' ).change( function() {
|
jQuery( '.interval_scheduler' ).change( function() {
|
||||||
|
|
||||||
var selected = jQuery(this).val();
|
var selected = jQuery(this).val(); // Selected value
|
||||||
|
var timeblock = jQuery(this).data( 'timeblock' ); // Corresponding time block
|
||||||
|
|
||||||
if( selected == 'daily' ) {
|
if( selected == 'daily' ) {
|
||||||
jQuery('.timeSchedulePlugins').show();
|
jQuery( '.timeblock-'+timeblock ).show();
|
||||||
} else {
|
} else {
|
||||||
jQuery('.timeSchedulePlugins').hide();
|
jQuery( '.timeblock-'+timeblock ).hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery( '#theme_schedule' ).change( function() {
|
jQuery( '.interval_scheduler' ).each( function() {
|
||||||
|
|
||||||
var selected = jQuery(this).val();
|
var selected = jQuery(this).val(); // Selected value
|
||||||
|
var timeblock = jQuery(this).data( 'timeblock' ); // Corresponding time block
|
||||||
|
|
||||||
if( selected == 'daily' ) {
|
if( selected == 'daily' ) {
|
||||||
jQuery('.timeScheduleThemes').show();
|
jQuery( '.timeblock-'+timeblock ).show();
|
||||||
} else {
|
} else {
|
||||||
jQuery('.timeScheduleThemes').hide();
|
jQuery( '.timeblock-'+timeblock ).hide();
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
jQuery( '#core_schedule' ).change( function() {
|
|
||||||
|
|
||||||
var selected = jQuery(this).val();
|
|
||||||
|
|
||||||
if( selected == 'daily' ) {
|
|
||||||
jQuery('.timeScheduleCore').show();
|
|
||||||
} else {
|
|
||||||
jQuery('.timeScheduleCore').hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
jQuery( '#schedule_mail' ).change( function() {
|
|
||||||
|
|
||||||
var selected = jQuery(this).val();
|
|
||||||
|
|
||||||
if( selected == 'daily' ) {
|
|
||||||
jQuery('.timeScheduleEmail').show();
|
|
||||||
} else {
|
|
||||||
jQuery('.timeScheduleEmail').hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
global $wpdb;
|
global $wpdb;
|
||||||
$table_name = $wpdb->prefix . "auto_updates";
|
$table_name = $wpdb->prefix . "auto_updates";
|
||||||
$schedules = wp_get_schedules();
|
$schedules = wp_get_schedules();
|
||||||
|
$interval_names = cau_wp_get_schedules();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -75,7 +76,7 @@
|
|||||||
$__status = 'enabled';
|
$__status = 'enabled';
|
||||||
$__icon = 'yes-alt';
|
$__icon = 'yes-alt';
|
||||||
$__text = __( 'Enabled', 'companion-auto-update' );
|
$__text = __( 'Enabled', 'companion-auto-update' );
|
||||||
$__interval = wp_get_schedule( $eventNames[$key] );
|
$__interval = $interval_names[wp_get_schedule( $eventNames[$key] )];
|
||||||
$__next = date_i18n( $dateFormat, wp_next_scheduled( $eventNames[$key] ) );
|
$__next = date_i18n( $dateFormat, wp_next_scheduled( $eventNames[$key] ) );
|
||||||
} else {
|
} else {
|
||||||
$__status = 'disabled';
|
$__status = 'disabled';
|
||||||
@ -132,7 +133,7 @@
|
|||||||
$__status = 'enabled';
|
$__status = 'enabled';
|
||||||
$__icon = 'yes-alt';
|
$__icon = 'yes-alt';
|
||||||
$__text = __( 'Enabled', 'companion-auto-update' );
|
$__text = __( 'Enabled', 'companion-auto-update' );
|
||||||
$__interval = wp_get_schedule( $other_eventNames[$key] );
|
$__interval = $interval_names[wp_get_schedule( $other_eventNames[$key] )];
|
||||||
$__next = date_i18n( $dateFormat, wp_next_scheduled( $other_eventNames[$key] ) );
|
$__next = date_i18n( $dateFormat, wp_next_scheduled( $other_eventNames[$key] ) );
|
||||||
} else {
|
} else {
|
||||||
$__status = 'warning';
|
$__status = 'warning';
|
||||||
@ -322,7 +323,7 @@
|
|||||||
<tbody id="the-list">
|
<tbody id="the-list">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class='button button-primary toggle_advanced_button'>Toggle</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
|
||||||
|
@ -110,7 +110,8 @@
|
|||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
select.schedule_interval {
|
select.schedule_interval {
|
||||||
width: 90%;
|
max-width: 90%;
|
||||||
|
width: 225px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Overwrite core UI */
|
/* Overwrite core UI */
|
||||||
|
@ -3,14 +3,24 @@
|
|||||||
// Check if emails should be send or not
|
// Check if emails should be send or not
|
||||||
function cau_check_updates_mail() {
|
function cau_check_updates_mail() {
|
||||||
|
|
||||||
|
// Notify of pending updates
|
||||||
if( cau_get_db_value( 'send' ) == 'on' ) {
|
if( cau_get_db_value( 'send' ) == 'on' ) {
|
||||||
cau_list_theme_updates(); // Check for theme updates
|
cau_list_theme_updates(); // Check for theme updates
|
||||||
cau_list_plugin_updates(); // Check for plugin updates
|
cau_list_plugin_updates(); // Check for plugin updates
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cau_get_db_value( 'sendupdate' ) == 'on' && cau_get_db_value( 'plugins' ) == 'on' ) cau_plugin_updated(); // Check for updated plugins
|
// Notify of completed updates
|
||||||
|
if( cau_get_db_value( 'sendupdate' ) == 'on' && cau_get_db_value( 'plugins' ) == 'on' ) {
|
||||||
|
cau_plugin_updated(); // Check for updated plugins
|
||||||
|
}
|
||||||
|
|
||||||
if( cau_get_db_value( 'sendoutdated' ) == 'on' ) cau_list_outdated_software(); // Check for oudated plugins
|
}
|
||||||
|
|
||||||
|
// Notify of out of date software
|
||||||
|
function cau_outdated_notifier_mail() {
|
||||||
|
if( cau_get_db_value( 'sendoutdated' ) == 'on' ) {
|
||||||
|
cau_list_outdated_software(); // Check for oudated plugins
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ge the emailadresses it should be send to
|
// Ge the emailadresses it should be send to
|
||||||
@ -31,6 +41,7 @@ function cau_set_email() {
|
|||||||
return $emailArray;
|
return $emailArray;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mail format
|
// Mail format
|
||||||
function cau_is_html() {
|
function cau_is_html() {
|
||||||
|
|
||||||
@ -65,6 +76,7 @@ function cau_outdated_message( $single, $plural, $list ) {
|
|||||||
$text .= "\n";
|
$text .= "\n";
|
||||||
|
|
||||||
foreach ( $list as $plugin => $version ) {
|
foreach ( $list as $plugin => $version ) {
|
||||||
|
if( $version == '' ) $version = __( "Unknown", "companion-auto-update" );
|
||||||
$text .= "- ".sprintf( esc_html__( "%s tested up to: %s", "companion-auto-update" ), $plugin, $version )."\n";
|
$text .= "- ".sprintf( esc_html__( "%s tested up to: %s", "companion-auto-update" ), $plugin, $version )."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +318,7 @@ function cau_plugin_updated() {
|
|||||||
|
|
||||||
$dateFormat = get_option( 'date_format' );
|
$dateFormat = get_option( 'date_format' );
|
||||||
$timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) );
|
$timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) );
|
||||||
$timestamp .= ' ‐ '.date( 'H:i', filemtime( $fullPath ) );
|
$timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) );
|
||||||
|
|
||||||
if( $fileDate >= $lastday ) {
|
if( $fileDate >= $lastday ) {
|
||||||
|
|
||||||
@ -348,7 +360,7 @@ function cau_plugin_updated() {
|
|||||||
|
|
||||||
$dateFormat = get_option( 'date_format' );
|
$dateFormat = get_option( 'date_format' );
|
||||||
$timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) );
|
$timestamp = date_i18n( $dateFormat, filemtime( $fullPath ) );
|
||||||
$timestamp .= ' ‐ '.date( 'H:i', filemtime( $fullPath ) );
|
$timestamp .= ' - '.date( 'H:i', filemtime( $fullPath ) );
|
||||||
|
|
||||||
if( $fileDate >= $lastday ) {
|
if( $fileDate >= $lastday ) {
|
||||||
array_push( $themeNames, $path_parts['filename'] );
|
array_push( $themeNames, $path_parts['filename'] );
|
||||||
|
@ -173,6 +173,11 @@ function cau_incorrectDatabaseVersion() {
|
|||||||
// Run custom hooks on plugin update
|
// Run custom hooks on plugin update
|
||||||
function cau_run_custom_hooks_p() {
|
function cau_run_custom_hooks_p() {
|
||||||
|
|
||||||
|
// Check if function exists
|
||||||
|
if ( ! function_exists( 'get_plugins' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||||
|
}
|
||||||
|
|
||||||
// Create array
|
// Create array
|
||||||
$allDates = array();
|
$allDates = array();
|
||||||
|
|
||||||
@ -553,6 +558,11 @@ function cau_fetch_log( $limit, $format = 'simple' ) {
|
|||||||
// PLUGINS
|
// PLUGINS
|
||||||
if( $plugins ) {
|
if( $plugins ) {
|
||||||
|
|
||||||
|
// Check if function exists
|
||||||
|
if ( ! function_exists( 'get_plugins' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||||
|
}
|
||||||
|
|
||||||
// Where to look for plugins
|
// Where to look for plugins
|
||||||
$plugdir = plugin_dir_path( __DIR__ );
|
$plugdir = plugin_dir_path( __DIR__ );
|
||||||
$allPlugins = get_plugins();
|
$allPlugins = get_plugins();
|
||||||
@ -1012,6 +1022,11 @@ function cau_list_outdated() {
|
|||||||
|
|
||||||
$outdatedList = array();
|
$outdatedList = array();
|
||||||
|
|
||||||
|
// Check if function exists
|
||||||
|
if ( ! function_exists( 'get_plugins' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ( get_plugins() as $key => $value) {
|
foreach ( get_plugins() as $key => $value) {
|
||||||
|
|
||||||
$slug = $key;
|
$slug = $key;
|
||||||
@ -1052,6 +1067,11 @@ function cau_version_compare( $ver1, $ver2, $operator = null ) {
|
|||||||
// Get plugin information of currently installed plugins
|
// Get plugin information of currently installed plugins
|
||||||
function cau_active_plugin_info( $slug, $what ) {
|
function cau_active_plugin_info( $slug, $what ) {
|
||||||
|
|
||||||
|
// Check if function exists
|
||||||
|
if ( ! function_exists( 'get_plugins' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||||
|
}
|
||||||
|
|
||||||
$allPlugins = get_plugins();
|
$allPlugins = get_plugins();
|
||||||
|
|
||||||
foreach ($allPlugins as $key => $value) {
|
foreach ($allPlugins as $key => $value) {
|
||||||
@ -1081,19 +1101,19 @@ function cau_addMoreIntervals( $schedules ) {
|
|||||||
// Add a weekly interval.
|
// Add a weekly interval.
|
||||||
$schedules['weekly'] = array(
|
$schedules['weekly'] = array(
|
||||||
'interval' => 604800,
|
'interval' => 604800,
|
||||||
'display' => __( 'Once Weekly', 'companion-auto-update' ),
|
'display' => __( 'Every week', 'companion-auto-update' ),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add a twice montly interval.
|
// Add a twice montly interval.
|
||||||
$schedules['twice_monthly'] = array(
|
$schedules['twice_monthly'] = array(
|
||||||
'interval' => 1317600,
|
'interval' => 1209600,
|
||||||
'display' => __( 'Twice a month', 'companion-auto-update' ),
|
'display' => __( 'Every 2 weeks', 'companion-auto-update' ),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add a montly interval.
|
// Add a montly interval.
|
||||||
$schedules['once_monthly'] = array(
|
$schedules['once_monthly'] = array(
|
||||||
'interval' => 2635200,
|
'interval' => 2419200,
|
||||||
'display' => __( 'Once a month', 'companion-auto-update' ),
|
'display' => __( 'Every 4 weeks', 'companion-auto-update' ),
|
||||||
);
|
);
|
||||||
|
|
||||||
return $schedules;
|
return $schedules;
|
||||||
@ -1118,19 +1138,48 @@ function cau_wp_get_schedules() {
|
|||||||
// Do a bunch of checks to format them the right way
|
// Do a bunch of checks to format them the right way
|
||||||
foreach ( $value as $display => $interval ) {
|
foreach ( $value as $display => $interval ) {
|
||||||
|
|
||||||
if( $display == 'display' ) {
|
if( $display == 'interval' ) {
|
||||||
$intervalNames[$counter] = $interval; // Add the display name (i.e. "Once a month" or "Once Daily")
|
|
||||||
$counter++; // Make sure the next interval gets a new "key" value
|
if( $interval == '86400' ) $key = 'daily'; // Force the daily interval to be called daily, required by a bunch of handles of this plugin
|
||||||
} else {
|
|
||||||
if( $interval == '86400' ) $key = 'daily'; // Force the daily interval to be called daily, requires by a bunch of handles of this plugin
|
|
||||||
$intervalTimes[$counter] = $key; // Add the backend name (i.e. "once_monthly" or "daily")
|
$intervalTimes[$counter] = $key; // Add the backend name (i.e. "once_monthly" or "daily")
|
||||||
$intervalUniques[$counter] = $interval; // Add the unix timestamp of this interval, used to identify unique items
|
$intervalUniques[$counter] = $interval; // Add the unix timestamp of this interval, used to identify unique items
|
||||||
|
|
||||||
|
// Format display name in a proper way
|
||||||
|
$numOfMinutes = ($interval/60);
|
||||||
|
$identifier = __( 'minutes', 'companion-auto-update' );
|
||||||
|
|
||||||
|
// I just know there's an easier way for this, but I can't come up with it and this works so...
|
||||||
|
if( $interval >= (60*60) ) {
|
||||||
|
$numOfMinutes = ($numOfMinutes/60);
|
||||||
|
$identifier = __( 'hours', 'companion-auto-update' );
|
||||||
|
}
|
||||||
|
if( $interval >= (60*60*24) ) {
|
||||||
|
$numOfMinutes = ($numOfMinutes/24);
|
||||||
|
$identifier = __( 'days', 'companion-auto-update' );
|
||||||
|
}
|
||||||
|
if( $interval >= (60*60*24*7) ) {
|
||||||
|
$numOfMinutes = ($numOfMinutes/7);
|
||||||
|
$identifier = __( 'weeks', 'companion-auto-update' );
|
||||||
|
}
|
||||||
|
if( $interval >= (60*60*24*7*(52/12)) ) {
|
||||||
|
$numOfMinutes = ($numOfMinutes/(52/12));
|
||||||
|
$identifier = __( 'months', 'companion-auto-update' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$display = sprintf( esc_html__( 'Every %s %s', 'companion-auto-update' ), round( $numOfMinutes, 2 ), $identifier ); // Translateble
|
||||||
|
$intervalNames[$counter] = $display; // Add the display name (i.e. "Once a month" or "Once Daily")
|
||||||
|
|
||||||
|
$counter++; // Make sure the next interval gets a new "key" value
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort the interval from smallest to largest
|
||||||
|
asort( $intervalUniques );
|
||||||
|
|
||||||
// Prevent duplicates
|
// Prevent duplicates
|
||||||
foreach ( array_unique( $intervalUniques ) as $key => $value ) {
|
foreach ( array_unique( $intervalUniques ) as $key => $value ) {
|
||||||
// $value is the timestamp
|
// $value is the timestamp
|
||||||
@ -1162,6 +1211,12 @@ function cau_updateLogDBisEmpty() {
|
|||||||
// Plugin information to DB
|
// Plugin information to DB
|
||||||
function cau_savePluginInformation( $method = 'New' ) {
|
function cau_savePluginInformation( $method = 'New' ) {
|
||||||
|
|
||||||
|
// Check if function exists
|
||||||
|
if ( ! function_exists( 'get_plugins' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set variables
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$updateDB = "update_log";
|
$updateDB = "update_log";
|
||||||
$updateLog = $wpdb->prefix.$updateDB;
|
$updateLog = $wpdb->prefix.$updateDB;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* 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.7.1.1
|
* Version: 3.8.0
|
||||||
* Author: Papin Schipper
|
* Author: Papin Schipper
|
||||||
* Author URI: http://codeermeneer.nl/
|
* Author URI: http://codeermeneer.nl/
|
||||||
* Contributors: papin
|
* Contributors: papin
|
||||||
@ -37,12 +37,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 mail etc.
|
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
|
||||||
}
|
}
|
||||||
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( 'wp_update_plugins', 'cau_run_custom_hooks_p' );
|
add_action( 'wp_update_plugins', 'cau_run_custom_hooks_p' );
|
||||||
add_action( 'wp_update_themes', 'cau_run_custom_hooks_t' );
|
add_action( 'wp_update_themes', 'cau_run_custom_hooks_t' );
|
||||||
add_action( 'wp_version_check', 'cau_run_custom_hooks_c' );
|
add_action( 'wp_version_check', 'cau_run_custom_hooks_c' );
|
||||||
@ -77,25 +79,28 @@ function cau_donateUrl() {
|
|||||||
|
|
||||||
// Database version
|
// Database version
|
||||||
function cau_db_version() {
|
function cau_db_version() {
|
||||||
return '3.7.0';
|
return '3.7.2';
|
||||||
}
|
}
|
||||||
function cau_database_creation() {
|
function cau_database_creation() {
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
|
// 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";
|
||||||
|
|
||||||
// Create db table
|
// WordPress db info
|
||||||
|
$charset_collate = $wpdb->get_charset_collate();
|
||||||
|
|
||||||
|
// DB table creation queries
|
||||||
$sql = "CREATE TABLE $autoupdates (
|
$sql = "CREATE TABLE $autoupdates (
|
||||||
id INT(9) NOT NULL AUTO_INCREMENT,
|
id INT(9) NOT NULL AUTO_INCREMENT,
|
||||||
name VARCHAR(255) NOT NULL,
|
name VARCHAR(255) NOT NULL,
|
||||||
onoroff TEXT NOT NULL,
|
onoroff TEXT NOT NULL,
|
||||||
UNIQUE KEY id (id)
|
UNIQUE KEY id (id)
|
||||||
)";
|
) $charset_collate;";
|
||||||
|
|
||||||
// Create second db table
|
|
||||||
$sql2 = "CREATE TABLE $updateLog (
|
$sql2 = "CREATE TABLE $updateLog (
|
||||||
id INT(9) NOT NULL AUTO_INCREMENT,
|
id INT(9) NOT NULL AUTO_INCREMENT,
|
||||||
slug VARCHAR(255) NOT NULL,
|
slug VARCHAR(255) NOT NULL,
|
||||||
@ -104,8 +109,9 @@ function cau_database_creation() {
|
|||||||
method VARCHAR(10) NOT NULL,
|
method VARCHAR(10) NOT NULL,
|
||||||
put_on_hold VARCHAR(100) DEFAULT '0',
|
put_on_hold VARCHAR(100) DEFAULT '0',
|
||||||
UNIQUE KEY id (id)
|
UNIQUE KEY id (id)
|
||||||
)";
|
) $charset_collate;";
|
||||||
|
|
||||||
|
// Create DB tables
|
||||||
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
||||||
dbDelta( $sql );
|
dbDelta( $sql );
|
||||||
dbDelta( $sql2 );
|
dbDelta( $sql2 );
|
||||||
@ -202,11 +208,28 @@ register_deactivation_hook( __FILE__, 'cau_remove' );
|
|||||||
|
|
||||||
// Update
|
// Update
|
||||||
function cau_update_db_check() {
|
function cau_update_db_check() {
|
||||||
|
|
||||||
$cau_db_version = cau_db_version();
|
$cau_db_version = cau_db_version();
|
||||||
|
|
||||||
if ( get_site_option( 'cau_db_version' ) != $cau_db_version ) {
|
if ( get_site_option( 'cau_db_version' ) != $cau_db_version ) {
|
||||||
|
|
||||||
cau_database_creation();
|
cau_database_creation();
|
||||||
|
|
||||||
|
// In 3.7.2 we've added $wpdb->get_charset_collate
|
||||||
|
if( get_site_option( 'cau_db_version' ) < '3.7.2' ) {
|
||||||
|
|
||||||
|
global $wpdb;
|
||||||
|
$autoupdates = $wpdb->prefix."auto_updates";
|
||||||
|
$updateLog = $wpdb->prefix."update_log";
|
||||||
|
$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 );
|
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' );
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@ Contributors: Papin, qweb
|
|||||||
Donate link: https://www.paypal.me/dakel/10/
|
Donate link: https://www.paypal.me/dakel/10/
|
||||||
Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
|
Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
|
||||||
Requires at least: 3.6.0
|
Requires at least: 3.6.0
|
||||||
Tested up to: 5.5
|
Tested up to: 5.6
|
||||||
Requires PHP: 5.1
|
Requires PHP: 5.1
|
||||||
Stable tag: 3.7.1.1
|
Stable tag: 3.8.0
|
||||||
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,11 @@ So obviously, some of you wondered what the difference would be between the defa
|
|||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 3.8.0 (January 14, 2020) =
|
||||||
|
* New: Better handling of plugins with an unknown WP version
|
||||||
|
* New: More intervals for notifications
|
||||||
|
* Fix: Call to undefined function errors
|
||||||
|
|
||||||
= 3.7.1.1 (November 2, 2020) =
|
= 3.7.1.1 (November 2, 2020) =
|
||||||
* Fix: Type in wp_next_scheduled
|
* Fix: Type in wp_next_scheduled
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user