Version Description
(April 17, 2018) = * Fix: Successful update emails to multiple adresses. We took our time to really test this one but it works now! Promise! * Update available emails might still be broken. * Improvement: Email notifications no long show updates done in the last 2 days but instead changed depending on the interval of the emails.
Download this release
Release Info
Developer | Papin |
Plugin | Companion Auto Update |
Version | 3.0.9 |
Comparing to | |
See all releases |
Code changes from version 3.0.8 to 3.0.9
- admin/dashboard.php +14 -8
- cau_emails.php +79 -72
- companion-auto-update.php +1 -1
- readme.txt +7 -2
admin/dashboard.php
CHANGED
@@ -118,23 +118,29 @@
|
|
118 |
</td>
|
119 |
</tr>
|
120 |
<tr>
|
121 |
-
<th scope="row"><?php _e('
|
122 |
<td>
|
123 |
<p>
|
124 |
-
<
|
125 |
-
<
|
126 |
</p>
|
|
|
|
|
127 |
</td>
|
128 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
<tr>
|
130 |
-
<th scope="row"><?php _e('
|
131 |
<td>
|
132 |
<p>
|
133 |
-
<
|
134 |
-
<
|
135 |
</p>
|
136 |
-
|
137 |
-
<p class="description"><?php _e('Seperate email addresses using commas.', 'companion-auto-update');?></p>
|
138 |
</td>
|
139 |
</tr>
|
140 |
</table>
|
118 |
</td>
|
119 |
</tr>
|
120 |
<tr>
|
121 |
+
<th scope="row"><?php _e('Email address', 'companion-auto-update');?></th>
|
122 |
<td>
|
123 |
<p>
|
124 |
+
<label for="cau_email"><?php _e('To', 'companion-auto-update');?>:</label>
|
125 |
+
<input type="text" name="cau_email" id="cau_email" class="regular-text" placeholder="<?php echo get_option('admin_email'); ?>" value="<?php echo esc_html( $toemail ); ?>" />
|
126 |
</p>
|
127 |
+
|
128 |
+
<p class="description"><?php _e('Seperate email addresses using commas.', 'companion-auto-update');?></p>
|
129 |
</td>
|
130 |
</tr>
|
131 |
+
</table>
|
132 |
+
|
133 |
+
<h2 class="title"><?php _e('Core notifications', 'companion-auto-update');?></h2>
|
134 |
+
<p><?php _e('Core notifications are handled by WordPress and not by this plugin. You can only disable them, changing your email address in the settings above will not affect these notifications.', 'companion-auto-update');?></p>
|
135 |
+
|
136 |
+
<table class="form-table">
|
137 |
<tr>
|
138 |
+
<th scope="row"><?php _e('Core notifications', 'companion-auto-update');?></th>
|
139 |
<td>
|
140 |
<p>
|
141 |
+
<input id="wpemails" name="wpemails" type="checkbox" <?php if( $cau_configs[9]->onoroff == 'on' ) { echo 'checked'; } ?> />
|
142 |
+
<label for="wpemails"><?php _e('By default wordpress sends an email when a core update happend. Uncheck this box to disable these emails.', 'companion-auto-update');?></label>
|
143 |
</p>
|
|
|
|
|
144 |
</td>
|
145 |
</tr>
|
146 |
</table>
|
cau_emails.php
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
function cau_check_updates_mail() {
|
3 |
|
4 |
global $wpdb;
|
@@ -13,6 +15,7 @@ function cau_check_updates_mail() {
|
|
13 |
if( $cau_configs[6]->onoroff == 'on' ) if( $cau_configs[0]->onoroff == 'on' ) cau_plugin_updated(); // Check for updated plugins
|
14 |
}
|
15 |
|
|
|
16 |
function cau_set_email() {
|
17 |
|
18 |
global $wpdb;
|
@@ -34,7 +37,8 @@ function cau_set_email() {
|
|
34 |
|
35 |
}
|
36 |
|
37 |
-
|
|
|
38 |
|
39 |
return sprintf( esc_html__(
|
40 |
'There are one or more %1$s updates available on your WordPress site at: %2$s, but you have disabled auto-updating for %3$s. Login to your dashboard to manually update your %3$s.', 'companion-auto-update'
|
@@ -42,6 +46,15 @@ function cau_set_content( $single, $plural ) {
|
|
42 |
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
// Checks if theme updates are available
|
46 |
function cau_list_theme_updates() {
|
47 |
|
@@ -61,9 +74,14 @@ function cau_list_theme_updates() {
|
|
61 |
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __('Theme update available.', 'companion-auto-update');
|
62 |
$type = __('theme', 'companion-auto-update');
|
63 |
$type_plural = __('themes', 'companion-auto-update');
|
64 |
-
$message =
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
|
69 |
}
|
@@ -91,9 +109,14 @@ function cau_list_plugin_updates() {
|
|
91 |
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __('Plugin update available.', 'companion-auto-update');
|
92 |
$type = __('plugin', 'companion-auto-update');
|
93 |
$type_plural = __('plugins', 'companion-auto-update');
|
94 |
-
$message =
|
95 |
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
|
99 |
}
|
@@ -101,93 +124,77 @@ function cau_list_plugin_updates() {
|
|
101 |
}
|
102 |
}
|
103 |
|
104 |
-
//
|
105 |
-
function
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
|
111 |
-
|
|
|
|
|
112 |
|
113 |
-
//
|
114 |
-
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
120 |
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
-
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
128 |
|
129 |
-
|
130 |
-
$last_updated = cau_get_last_updated( $slug );
|
131 |
-
set_transient( "cau_{$slug_hash}", $last_updated, 86400 );
|
132 |
}
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
137 |
|
138 |
-
|
139 |
-
foreach ( $value as $k => $v ) {
|
140 |
-
|
141 |
-
if( $k == "Name" ) $plugName = $v;
|
142 |
-
if( $k == "Version" ) $plugVersion = $v;
|
143 |
|
144 |
-
|
|
|
145 |
|
146 |
-
|
147 |
|
148 |
-
|
|
|
149 |
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
|
|
|
|
|
|
|
154 |
}
|
|
|
155 |
}
|
156 |
|
157 |
}
|
158 |
|
159 |
-
if( $updatedPlugins ) {
|
160 |
-
wp_mail( array( cau_set_email() ) , $subject, $message, $headers );
|
161 |
-
}
|
162 |
-
|
163 |
-
}
|
164 |
-
|
165 |
-
// Do some high-tech stuff
|
166 |
-
function cau_get_last_updated( $slug ) {
|
167 |
-
$request = wp_remote_post(
|
168 |
-
'http://api.wordpress.org/plugins/info/1.0/',
|
169 |
-
array(
|
170 |
-
'body' => array(
|
171 |
-
'action' => 'plugin_information',
|
172 |
-
'request' => serialize(
|
173 |
-
(object) array(
|
174 |
-
'slug' => $slug,
|
175 |
-
'fields' => array( 'last_updated' => true )
|
176 |
-
)
|
177 |
-
)
|
178 |
-
)
|
179 |
-
)
|
180 |
-
);
|
181 |
-
if ( 200 != wp_remote_retrieve_response_code( $request ) ) return false;
|
182 |
-
|
183 |
-
$response = unserialize( wp_remote_retrieve_body( $request ) );
|
184 |
-
// Return an empty but cachable response if the plugin isn't in the .org repo
|
185 |
-
if ( empty( $response ) )
|
186 |
-
return '';
|
187 |
-
if ( isset( $response->last_updated ) )
|
188 |
-
return sanitize_text_field( $response->last_updated );
|
189 |
-
|
190 |
-
return false;
|
191 |
}
|
192 |
|
193 |
?>
|
1 |
<?php
|
2 |
+
|
3 |
+
// Check if emails should be send or not
|
4 |
function cau_check_updates_mail() {
|
5 |
|
6 |
global $wpdb;
|
15 |
if( $cau_configs[6]->onoroff == 'on' ) if( $cau_configs[0]->onoroff == 'on' ) cau_plugin_updated(); // Check for updated plugins
|
16 |
}
|
17 |
|
18 |
+
// Ge the emailadresses it should be send to
|
19 |
function cau_set_email() {
|
20 |
|
21 |
global $wpdb;
|
37 |
|
38 |
}
|
39 |
|
40 |
+
// Set the content for the emails about pending updates
|
41 |
+
function cau_pending_message( $single, $plural ) {
|
42 |
|
43 |
return sprintf( esc_html__(
|
44 |
'There are one or more %1$s updates available on your WordPress site at: %2$s, but you have disabled auto-updating for %3$s. Login to your dashboard to manually update your %3$s.', 'companion-auto-update'
|
46 |
|
47 |
}
|
48 |
|
49 |
+
// Set the content for the emails about recent updates
|
50 |
+
function cau_updated_message( $type, $updatedList ) {
|
51 |
+
|
52 |
+
return sprintf( esc_html__(
|
53 |
+
'We have updated one or more %1$s on your WordPress site at %2$s, be sure to check if everything still works properly. The following %1$s have been updated: %3$s', 'companion-auto-update'
|
54 |
+
), $type, get_site_url(), $updatedList );
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
// Checks if theme updates are available
|
59 |
function cau_list_theme_updates() {
|
60 |
|
74 |
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __('Theme update available.', 'companion-auto-update');
|
75 |
$type = __('theme', 'companion-auto-update');
|
76 |
$type_plural = __('themes', 'companion-auto-update');
|
77 |
+
$message = cau_pending_message( $type, $type_plural );
|
78 |
+
|
79 |
+
foreach ( cau_set_email() as $key => $value) {
|
80 |
+
foreach ($value as $k => $v) {
|
81 |
+
wp_mail( $v, $subject, $message, $headers );
|
82 |
+
}
|
83 |
+
break;
|
84 |
+
}
|
85 |
}
|
86 |
|
87 |
}
|
109 |
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __('Plugin update available.', 'companion-auto-update');
|
110 |
$type = __('plugin', 'companion-auto-update');
|
111 |
$type_plural = __('plugins', 'companion-auto-update');
|
112 |
+
$message = cau_pending_message( $type, $type_plural );
|
113 |
|
114 |
+
foreach ( cau_set_email() as $key => $value) {
|
115 |
+
foreach ($value as $k => $v) {
|
116 |
+
wp_mail( $v, $subject, $message, $headers );
|
117 |
+
}
|
118 |
+
break;
|
119 |
+
}
|
120 |
}
|
121 |
|
122 |
}
|
124 |
}
|
125 |
}
|
126 |
|
127 |
+
// Alerts when plugin has been updated
|
128 |
+
function cau_plugin_updated() {
|
129 |
|
130 |
+
// Create arrays
|
131 |
+
$pluginNames = array();
|
132 |
+
$pluginDates = array();
|
133 |
|
134 |
+
// Where to look for plugins
|
135 |
+
$plugdir = plugin_dir_path( __DIR__ );
|
136 |
+
$allPlugins = get_plugins();
|
137 |
|
138 |
+
// Loop trough all plugins
|
139 |
+
foreach ( $allPlugins as $key => $value) {
|
140 |
|
141 |
+
// Get plugin data
|
142 |
+
$fullPath = $plugdir.'/'.$key;
|
143 |
+
$getFile = $path_parts = pathinfo( $fullPath );
|
144 |
+
$pluginData = get_plugin_data( $fullPath );
|
145 |
+
|
146 |
+
// Get last update date
|
147 |
+
$fileDate = date ( 'YmdHi', filemtime( $fullPath ) );
|
148 |
+
$mailSched = wp_get_schedule( 'cau_set_schedule_mail' );
|
149 |
|
150 |
+
if( $mailSched == 'hourly' ) {
|
151 |
+
$lastday = date( 'YmdHi', strtotime( '-1 hour' ) );
|
152 |
+
} elseif( $mailSched == 'twicedaily' ) {
|
153 |
+
$lastday = date( 'YmdHi', strtotime( '-12 hours' ) );
|
154 |
+
} elseif( $mailSched == 'daily' ) {
|
155 |
+
$lastday = date( 'YmdHi', strtotime( '-1 day' ) );
|
156 |
+
}
|
157 |
|
158 |
+
if( $fileDate >= $lastday ) {
|
159 |
|
160 |
+
// Get plugin name
|
161 |
+
foreach ( $pluginData as $dataKey => $dataValue ) {
|
162 |
+
if( $dataKey == 'Name') {
|
163 |
+
array_push( $pluginNames , $dataValue );
|
164 |
+
}
|
165 |
+
}
|
166 |
|
167 |
+
array_push( $pluginDates, $fileDate );
|
|
|
|
|
168 |
}
|
169 |
|
170 |
+
}
|
171 |
+
|
172 |
+
$totalNum = 0;
|
173 |
+
$updatedList = '';
|
174 |
|
175 |
+
foreach ( $pluginDates as $key => $value ) {
|
|
|
|
|
|
|
|
|
176 |
|
177 |
+
$updatedList .= "- ".$pluginNames[$key]."\n";
|
178 |
+
$totalNum++;
|
179 |
|
180 |
+
}
|
181 |
|
182 |
+
// If plugins have been updated in the last day, send email
|
183 |
+
if( $totalNum > 0 ) {
|
184 |
|
185 |
+
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more plugins have been updated.', 'companion-auto-update');
|
186 |
+
$type = __('plugins', 'companion-auto-update');
|
187 |
+
$message = cau_updated_message( $type, "\n".$updatedList );
|
188 |
|
189 |
+
foreach ( cau_set_email() as $key => $value) {
|
190 |
+
foreach ($value as $k => $v) {
|
191 |
+
wp_mail( $v, $subject, $message, $headers );
|
192 |
}
|
193 |
+
break;
|
194 |
}
|
195 |
|
196 |
}
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
}
|
199 |
|
200 |
?>
|
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.0.
|
7 |
* Author: Papin Schipper
|
8 |
* Author URI: http://codeermeneer.nl/
|
9 |
* Contributors: papin
|
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.0.9
|
7 |
* Author: Papin Schipper
|
8 |
* Author URI: http://codeermeneer.nl/
|
9 |
* Contributors: papin
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/dakel/2
|
|
4 |
Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
|
5 |
Requires at least: 3.5.0
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -54,7 +54,7 @@ You can find the settings under Tools > Auto updating
|
|
54 |
|
55 |
= How often does this plugin check for updates? =
|
56 |
|
57 |
-
|
58 |
|
59 |
= Can I change how often it checks and/or updates? =
|
60 |
|
@@ -77,6 +77,11 @@ If you launched your website a few years ago using cPanel it could be the case t
|
|
77 |
|
78 |
== Changelog ==
|
79 |
|
|
|
|
|
|
|
|
|
|
|
80 |
= 3.0.8 (March 22, 2018) =
|
81 |
* Fix: Error "Notice: Only variables should be passed by reference"
|
82 |
|
4 |
Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
|
5 |
Requires at least: 3.5.0
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 3.0.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
54 |
|
55 |
= How often does this plugin check for updates? =
|
56 |
|
57 |
+
By default the updater will run twice a day, but you can change this to every hour or to daily. When set to daily you can even set the time at which it should run.
|
58 |
|
59 |
= Can I change how often it checks and/or updates? =
|
60 |
|
77 |
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 3.0.9 (April 17, 2018) =
|
81 |
+
* Fix: Successful update emails to multiple adresses. We took our time to really test this one but it works now! Promise!
|
82 |
+
* Update available emails might still be broken.
|
83 |
+
* Improvement: Email notifications no long show updates done in the last 2 days but instead changed depending on the interval of the emails.
|
84 |
+
|
85 |
= 3.0.8 (March 22, 2018) =
|
86 |
* Fix: Error "Notice: Only variables should be passed by reference"
|
87 |
|