Version Description
(November 8, 2019) = * New: Options for "Weekly", "Twice a month" and "Monthly" for scheduling * New: Added Database version to status page * Tweak: cau_database_creation() query is no longer running on every page load, just on activation or updating of the plugin
Download this release
Release Info
Developer | Papin |
Plugin | Companion Auto Update |
Version | 3.4.3 |
Comparing to | |
See all releases |
Code changes from version 3.4.2.1 to 3.4.3
- admin/dashboard.php +1 -15
- admin/schedule.php +30 -12
- admin/status.php +4 -0
- cau_functions.php +26 -0
- companion-auto-update.php +11 -21
- readme.txt +7 -2
admin/dashboard.php
CHANGED
@@ -4,9 +4,7 @@
|
|
4 |
echo '<div id="message" class="error"><p><b>'.__('Companion Auto Update was not able to set the event for sending you emails, please re-activate the plugin in order to set the event', 'companion-auto-update').'.</b></p></div>';
|
5 |
}
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
if ( get_site_option( 'cau_db_version' ) != $cau_db_version ) {
|
10 |
echo '<div id="message" class="error"><p><b>'.__('Database Update', 'companion-auto-update').' –</b> '.__('It seems like something went wrong while updating the database, please re-activate this plugin', 'companion-auto-update').'.</p></div>';
|
11 |
}
|
12 |
|
@@ -194,16 +192,4 @@
|
|
194 |
<p style="font-size: 12px; color: #BDBDBD;">Donations via PayPal. Amount can be changed.</p>
|
195 |
</div>
|
196 |
|
197 |
-
<?php
|
198 |
-
|
199 |
-
if( date( "Y" ) < '2020' ) {
|
200 |
-
echo '<div style="background: #CDE4E3; color: #273654; padding: 15px; border-radius: 5px;">
|
201 |
-
<p style="margin-top: 0;"><strong>For every $10 you donate to one of our plugins we’ll donate $10 to team trees.</strong></p>
|
202 |
-
<img src="https://teamtrees.org/images/logo-teamtrees-full.svg">
|
203 |
-
<p style="margin-bottom: 0;"><a href="https://codeermeneer.nl/blog/companion-supports-teamtrees/" target="_blank" style="color: #273654; font-weight: bold; text-decoration: underline;">Read our blog-post</a></p>
|
204 |
-
</div>';
|
205 |
-
}
|
206 |
-
|
207 |
-
?>
|
208 |
-
|
209 |
</div>
|
4 |
echo '<div id="message" class="error"><p><b>'.__('Companion Auto Update was not able to set the event for sending you emails, please re-activate the plugin in order to set the event', 'companion-auto-update').'.</b></p></div>';
|
5 |
}
|
6 |
|
7 |
+
if ( get_site_option( 'cau_db_version' ) != cau_db_version() ) {
|
|
|
|
|
8 |
echo '<div id="message" class="error"><p><b>'.__('Database Update', 'companion-auto-update').' –</b> '.__('It seems like something went wrong while updating the database, please re-activate this plugin', 'companion-auto-update').'.</p></div>';
|
9 |
}
|
10 |
|
192 |
<p style="font-size: 12px; color: #BDBDBD;">Donations via PayPal. Amount can be changed.</p>
|
193 |
</div>
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
</div>
|
admin/schedule.php
CHANGED
@@ -107,6 +107,8 @@ if( isset( $_POST['submit'] ) ) {
|
|
107 |
|
108 |
}
|
109 |
|
|
|
|
|
110 |
?>
|
111 |
<div style="clear: both;"></div>
|
112 |
|
@@ -123,9 +125,13 @@ if( isset( $_POST['submit'] ) ) {
|
|
123 |
<td>
|
124 |
<p>
|
125 |
<select name='plugin_schedule' id='plugin_schedule'>
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
129 |
</select>
|
130 |
</p>
|
131 |
<div class='timeSchedulePlugins' <?php if( $plugin_schedule != 'daily' ) { echo "style='display: none;'"; } ?> >
|
@@ -159,9 +165,13 @@ if( isset( $_POST['submit'] ) ) {
|
|
159 |
<p>
|
160 |
|
161 |
<select name='theme_schedule' id='theme_schedule'>
|
162 |
-
|
163 |
-
|
164 |
-
|
|
|
|
|
|
|
|
|
165 |
</select>
|
166 |
</p>
|
167 |
<div class='timeScheduleThemes' <?php if( $theme_schedule != 'daily' ) { echo "style='display: none;'"; } ?> >
|
@@ -193,9 +203,13 @@ if( isset( $_POST['submit'] ) ) {
|
|
193 |
<td>
|
194 |
<p>
|
195 |
<select name='core_schedule' id='core_schedule'>
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
|
|
199 |
</select>
|
200 |
</p>
|
201 |
<div class='timeScheduleCore' <?php if( $core_schedule != 'daily' ) { echo "style='display: none;'"; } ?> >
|
@@ -234,9 +248,13 @@ if( isset( $_POST['submit'] ) ) {
|
|
234 |
<td>
|
235 |
<p>
|
236 |
<select id='schedule_mail' name='schedule_mail'>
|
237 |
-
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
240 |
</select>
|
241 |
</p>
|
242 |
<div class='timeScheduleEmail' <?php if( $mail_sc != 'daily' ) { echo "style='display: none;'"; } ?> >
|
107 |
|
108 |
}
|
109 |
|
110 |
+
$availableIntervals = wp_get_schedules();
|
111 |
+
|
112 |
?>
|
113 |
<div style="clear: both;"></div>
|
114 |
|
125 |
<td>
|
126 |
<p>
|
127 |
<select name='plugin_schedule' id='plugin_schedule'>
|
128 |
+
<?php foreach ( $availableIntervals as $key => $value ) {
|
129 |
+
foreach ( $value as $display => $interval ) {
|
130 |
+
if( $display == 'display' ) {
|
131 |
+
echo "<option "; if( $plugin_schedule == $key ) { echo "selected "; } echo "value='".$key."'>".$interval."</option>";
|
132 |
+
}
|
133 |
+
}
|
134 |
+
} ?>
|
135 |
</select>
|
136 |
</p>
|
137 |
<div class='timeSchedulePlugins' <?php if( $plugin_schedule != 'daily' ) { echo "style='display: none;'"; } ?> >
|
165 |
<p>
|
166 |
|
167 |
<select name='theme_schedule' id='theme_schedule'>
|
168 |
+
<?php foreach ( $availableIntervals as $key => $value ) {
|
169 |
+
foreach ( $value as $display => $interval ) {
|
170 |
+
if( $display == 'display' ) {
|
171 |
+
echo "<option "; if( $theme_schedule == $key ) { echo "selected "; } echo "value='".$key."'>".$interval."</option>";
|
172 |
+
}
|
173 |
+
}
|
174 |
+
} ?>
|
175 |
</select>
|
176 |
</p>
|
177 |
<div class='timeScheduleThemes' <?php if( $theme_schedule != 'daily' ) { echo "style='display: none;'"; } ?> >
|
203 |
<td>
|
204 |
<p>
|
205 |
<select name='core_schedule' id='core_schedule'>
|
206 |
+
<?php foreach ( $availableIntervals as $key => $value ) {
|
207 |
+
foreach ( $value as $display => $interval ) {
|
208 |
+
if( $display == 'display' ) {
|
209 |
+
echo "<option "; if( $core_schedule == $key ) { echo "selected "; } echo "value='".$key."'>".$interval."</option>";
|
210 |
+
}
|
211 |
+
}
|
212 |
+
} ?>
|
213 |
</select>
|
214 |
</p>
|
215 |
<div class='timeScheduleCore' <?php if( $core_schedule != 'daily' ) { echo "style='display: none;'"; } ?> >
|
248 |
<td>
|
249 |
<p>
|
250 |
<select id='schedule_mail' name='schedule_mail'>
|
251 |
+
<?php foreach ( $availableIntervals as $key => $value ) {
|
252 |
+
foreach ( $value as $display => $interval ) {
|
253 |
+
if( $display == 'display' ) {
|
254 |
+
echo "<option "; if( $mail_sc == $key ) { echo "selected "; } echo "value='".$key."'>".$interval."</option>";
|
255 |
+
}
|
256 |
+
}
|
257 |
+
} ?>
|
258 |
</select>
|
259 |
</p>
|
260 |
<div class='timeScheduleEmail' <?php if( $mail_sc != 'daily' ) { echo "style='display: none;'"; } ?> >
|
admin/status.php
CHANGED
@@ -408,6 +408,10 @@ if( cau_incompatiblePlugins() ) { ?>
|
|
408 |
<td>PHP</td>
|
409 |
<td><?php echo phpversion(); ?></td>
|
410 |
</tr>
|
|
|
|
|
|
|
|
|
411 |
<tr>
|
412 |
<td class="cau_status_name"><?php _e( 'Timezone' ); ?></td>
|
413 |
<td class="cau_status_active_state"><?php echo get_option('timezone_string'); ?> (GMT <?php echo get_option('gmt_offset'); ?>) - <?php echo date_default_timezone_get(); ?></td>
|
408 |
<td>PHP</td>
|
409 |
<td><?php echo phpversion(); ?></td>
|
410 |
</tr>
|
411 |
+
<tr>
|
412 |
+
<td>Database</td>
|
413 |
+
<td><?php echo get_option( "cau_db_version" ); ?> <code>(Latest: <?php echo cau_db_version(); ?>)</code></td>
|
414 |
+
</tr>
|
415 |
<tr>
|
416 |
<td class="cau_status_name"><?php _e( 'Timezone' ); ?></td>
|
417 |
<td class="cau_status_active_state"><?php echo get_option('timezone_string'); ?> (GMT <?php echo get_option('gmt_offset'); ?>) - <?php echo date_default_timezone_get(); ?></td>
|
cau_functions.php
CHANGED
@@ -631,4 +631,30 @@ function cau_hideUpdateNag() {
|
|
631 |
|
632 |
add_action( 'admin_head', 'cau_hideUpdateNag', 100 );
|
633 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
634 |
?>
|
631 |
|
632 |
add_action( 'admin_head', 'cau_hideUpdateNag', 100 );
|
633 |
|
634 |
+
// Add more intervals to event schedules
|
635 |
+
function cau_addMoreIntervals( $schedules ) {
|
636 |
+
|
637 |
+
// Add a weekly interval.
|
638 |
+
$schedules['weekly'] = array(
|
639 |
+
'interval' => 604800,
|
640 |
+
'display' => __( 'Once Weekly' ),
|
641 |
+
);
|
642 |
+
|
643 |
+
// Add a twice montly interval.
|
644 |
+
$schedules['twice_monthly'] = array(
|
645 |
+
'interval' => 1317600,
|
646 |
+
'display' => __( 'Twice a month' ),
|
647 |
+
);
|
648 |
+
|
649 |
+
// Add a montly interval.
|
650 |
+
$schedules['monthly'] = array(
|
651 |
+
'interval' => 2635200,
|
652 |
+
'display' => __( 'Once a month' ),
|
653 |
+
);
|
654 |
+
|
655 |
+
return $schedules;
|
656 |
+
|
657 |
+
}
|
658 |
+
add_filter( 'cron_schedules', 'cau_addMoreIntervals' );
|
659 |
+
|
660 |
?>
|
companion-auto-update.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Companion Auto Update
|
4 |
* Plugin URI: http://codeermeneer.nl/portfolio/companion-auto-update/
|
5 |
* Description: This plugin auto updates all plugins, all themes and the wordpress core.
|
6 |
-
* Version: 3.4.
|
7 |
* Author: Papin Schipper
|
8 |
* Author URI: http://codeermeneer.nl/
|
9 |
* Contributors: papin
|
@@ -54,17 +54,18 @@ function cau_donateUrl() {
|
|
54 |
return 'https://www.paypal.me/dakel/10/';
|
55 |
}
|
56 |
|
57 |
-
//
|
|
|
|
|
|
|
58 |
function cau_database_creation() {
|
59 |
|
60 |
global $wpdb;
|
61 |
-
global $cau_db_version;
|
62 |
|
63 |
-
$cau_db_version =
|
|
|
64 |
|
65 |
// Create db table
|
66 |
-
$table_name = $wpdb->prefix . "auto_updates";
|
67 |
-
|
68 |
$sql = "CREATE TABLE $table_name (
|
69 |
id INT(9) NOT NULL AUTO_INCREMENT,
|
70 |
name VARCHAR(255) NOT NULL,
|
@@ -81,10 +82,6 @@ function cau_database_creation() {
|
|
81 |
// Insert data
|
82 |
cau_install_data();
|
83 |
|
84 |
-
// Updating..
|
85 |
-
$installed_ver = get_option( "cau_db_version" );
|
86 |
-
if ( $installed_ver != $cau_db_version ) update_option( "cau_db_version", $cau_db_version );
|
87 |
-
|
88 |
}
|
89 |
|
90 |
// Check if database table exists before creating
|
@@ -96,7 +93,7 @@ function cau_check_if_exists( $whattocheck ) {
|
|
96 |
$rows = $wpdb->get_col( "SELECT COUNT(*) as num_rows FROM {$table_name} WHERE name = '{$whattocheck}'" );
|
97 |
$check = $rows[0];
|
98 |
|
99 |
-
if( $check > 0) {
|
100 |
return true;
|
101 |
} else {
|
102 |
return false;
|
@@ -141,12 +138,13 @@ register_deactivation_hook( __FILE__, 'cau_remove' );
|
|
141 |
|
142 |
// Update
|
143 |
function cau_update_db_check() {
|
144 |
-
|
145 |
if ( get_site_option( 'cau_db_version' ) != $cau_db_version ) {
|
146 |
cau_database_creation();
|
|
|
147 |
}
|
148 |
}
|
149 |
-
add_action( '
|
150 |
|
151 |
// Load custom functions
|
152 |
require_once( plugin_dir_path( __FILE__ ) . 'cau_functions.php' );
|
@@ -224,14 +222,6 @@ add_action( 'wp_dashboard_setup', 'cau_add_widget' );
|
|
224 |
|
225 |
function cau_widget() {
|
226 |
|
227 |
-
if( date( "Y" ) < '2020' ) {
|
228 |
-
echo '<div style="background: #CDE4E3; color: #273654; padding: 15px; border-radius: 5px;">
|
229 |
-
<p style="margin-top: 0;"><strong>For every $10 you donate to one of our plugins we’ll donate $10 to team trees.</strong></p>
|
230 |
-
<img src="https://teamtrees.org/images/logo-teamtrees-full.svg">
|
231 |
-
<p style="margin-bottom: 0;"><a href="https://codeermeneer.nl/blog/companion-supports-teamtrees/" target="_blank" style="color: #273654; font-weight: bold; text-decoration: underline;">Read our blog-post</a></p>
|
232 |
-
</div>';
|
233 |
-
}
|
234 |
-
|
235 |
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>';
|
236 |
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>';
|
237 |
cau_fetch_log( '7' );
|
3 |
* Plugin Name: Companion Auto Update
|
4 |
* Plugin URI: http://codeermeneer.nl/portfolio/companion-auto-update/
|
5 |
* Description: This plugin auto updates all plugins, all themes and the wordpress core.
|
6 |
+
* Version: 3.4.3
|
7 |
* Author: Papin Schipper
|
8 |
* Author URI: http://codeermeneer.nl/
|
9 |
* Contributors: papin
|
54 |
return 'https://www.paypal.me/dakel/10/';
|
55 |
}
|
56 |
|
57 |
+
// Database version
|
58 |
+
function cau_db_version() {
|
59 |
+
return '3.4.3';
|
60 |
+
}
|
61 |
function cau_database_creation() {
|
62 |
|
63 |
global $wpdb;
|
|
|
64 |
|
65 |
+
$cau_db_version = cau_db_version();
|
66 |
+
$table_name = $wpdb->prefix . "auto_updates";
|
67 |
|
68 |
// Create db table
|
|
|
|
|
69 |
$sql = "CREATE TABLE $table_name (
|
70 |
id INT(9) NOT NULL AUTO_INCREMENT,
|
71 |
name VARCHAR(255) NOT NULL,
|
82 |
// Insert data
|
83 |
cau_install_data();
|
84 |
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
|
87 |
// Check if database table exists before creating
|
93 |
$rows = $wpdb->get_col( "SELECT COUNT(*) as num_rows FROM {$table_name} WHERE name = '{$whattocheck}'" );
|
94 |
$check = $rows[0];
|
95 |
|
96 |
+
if( $check > 0 ) {
|
97 |
return true;
|
98 |
} else {
|
99 |
return false;
|
138 |
|
139 |
// Update
|
140 |
function cau_update_db_check() {
|
141 |
+
$cau_db_version = cau_db_version();
|
142 |
if ( get_site_option( 'cau_db_version' ) != $cau_db_version ) {
|
143 |
cau_database_creation();
|
144 |
+
update_option( "cau_db_version", $cau_db_version );
|
145 |
}
|
146 |
}
|
147 |
+
add_action( 'upgrader_process_complete', 'cau_update_db_check' );
|
148 |
|
149 |
// Load custom functions
|
150 |
require_once( plugin_dir_path( __FILE__ ) . 'cau_functions.php' );
|
222 |
|
223 |
function cau_widget() {
|
224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
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>';
|
226 |
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>';
|
227 |
cau_fetch_log( '7' );
|
readme.txt
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
Contributors: Papin, qweb
|
3 |
Donate link: https://www.paypal.me/dakel/10/
|
4 |
Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
|
5 |
-
Requires at least: 3.
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.1
|
8 |
-
Stable tag: 3.4.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -68,6 +68,11 @@ Settings can be found trough Tools > Auto Updater
|
|
68 |
|
69 |
== Changelog ==
|
70 |
|
|
|
|
|
|
|
|
|
|
|
71 |
= 3.4.2 (June 28, 2019) =
|
72 |
* Fixed: Times being all messed up
|
73 |
* New: Set the time of email notifications
|
2 |
Contributors: Papin, qweb
|
3 |
Donate link: https://www.paypal.me/dakel/10/
|
4 |
Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
|
5 |
+
Requires at least: 3.6.0
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.1
|
8 |
+
Stable tag: 3.4.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
= 3.4.3 (November 8, 2019) =
|
72 |
+
* New: Options for "Weekly", "Twice a month" and "Monthly" for scheduling
|
73 |
+
* New: Added Database version to status page
|
74 |
+
* Tweak: cau_database_creation() query is no longer running on every page load, just on activation or updating of the plugin
|
75 |
+
|
76 |
= 3.4.2 (June 28, 2019) =
|
77 |
* Fixed: Times being all messed up
|
78 |
* New: Set the time of email notifications
|