Version Description
- Better updating: How ironic, this plugin did not handle it's own updates so well (required re-activation etc.) this has been fixed.
- Fixed bug: WordPress updates could not be disabled, this should work now.
- Update Notifications: You can now get an email notification when an plugin has been updated (right now this only works with plugins, themes coming up).
- Minor perfomance improvements.
Download this release
Release Info
Developer | Papin |
Plugin | Companion Auto Update |
Version | 2.7.0 |
Comparing to | |
See all releases |
Code changes from version 2.5.0 to 2.7.0
- companion-auto-update-check-updates.php +92 -0
- companion-auto-update.php +78 -84
- readme.txt +11 -4
companion-auto-update-check-updates.php
CHANGED
@@ -16,6 +16,13 @@ function cau_check_updates_mail() {
|
|
16 |
|
17 |
}
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
function cau_set_email() {
|
@@ -43,6 +50,7 @@ function cau_set_content( $single, $plural ) {
|
|
43 |
|
44 |
}
|
45 |
|
|
|
46 |
function cau_list_theme_updates() {
|
47 |
|
48 |
global $wpdb;
|
@@ -72,6 +80,7 @@ function cau_list_theme_updates() {
|
|
72 |
|
73 |
}
|
74 |
|
|
|
75 |
function cau_list_plugin_updates() {
|
76 |
|
77 |
global $wpdb;
|
@@ -98,7 +107,90 @@ function cau_list_plugin_updates() {
|
|
98 |
}
|
99 |
|
100 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
|
104 |
?>
|
16 |
|
17 |
}
|
18 |
|
19 |
+
if( $cau_configs[6]->onoroff == 'on' ) {
|
20 |
+
|
21 |
+
// Check for updated plugins
|
22 |
+
cau_plugin_updated();
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
}
|
27 |
|
28 |
function cau_set_email() {
|
50 |
|
51 |
}
|
52 |
|
53 |
+
// Checks if theme updates are available
|
54 |
function cau_list_theme_updates() {
|
55 |
|
56 |
global $wpdb;
|
80 |
|
81 |
}
|
82 |
|
83 |
+
// Checks if plugin updates are available
|
84 |
function cau_list_plugin_updates() {
|
85 |
|
86 |
global $wpdb;
|
107 |
}
|
108 |
|
109 |
}
|
110 |
+
}
|
111 |
+
|
112 |
+
// Creates the messages to be send
|
113 |
+
function cau_updated_message( $type, $updatedList ) {
|
114 |
+
|
115 |
+
return sprintf( esc_html__(
|
116 |
+
'We have updated on 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'
|
117 |
+
), $type, get_site_url(), $updatedList );
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
// Alerts when plugin has been updated
|
122 |
+
function cau_plugin_updated() {
|
123 |
+
|
124 |
+
$today = date("Y-m-d");
|
125 |
+
$yesterday = date('Y-m-d',strtotime("-1 days"));
|
126 |
+
$updatedPlugins = 1;
|
127 |
+
$updatedList = '';
|
128 |
+
$all_plugins = get_plugins();
|
129 |
+
|
130 |
+
foreach ( $all_plugins as $key => $value ) {
|
131 |
+
|
132 |
+
$slug = explode( '/', $key );
|
133 |
+
$slug_hash = md5( $slug[0] );
|
134 |
+
$last_updated = get_transient( "cau_{$slug_hash}" );
|
135 |
+
|
136 |
+
if ( false === $last_updated ) {
|
137 |
+
$last_updated = cau_get_last_updated( $slug );
|
138 |
+
set_transient( "cau_{$slug_hash}", $last_updated, 86400 );
|
139 |
+
}
|
140 |
+
|
141 |
+
if ( $last_updated ) {
|
142 |
+
$last_updated = explode( ' ', $last_updated );
|
143 |
+
$last_updated = $last_updated[0];
|
144 |
+
|
145 |
+
if( $last_updated == $today OR $last_updated == $yesterday ) {
|
146 |
+
foreach ( $value as $k => $v ) {
|
147 |
+
if( $k == "Name" ) $updatedList .= "- ".$v;
|
148 |
+
if( $k == "Version" ) $updatedList .= " ".__("to version:")." ".$v."\n";
|
149 |
+
}
|
150 |
+
$updatedPlugins = 1;
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
}
|
155 |
+
|
156 |
+
if( $updatedPlugins != 0 ) {
|
157 |
+
|
158 |
+
$subject = __('One ore more plugins have been updated.', 'companion-auto-update');
|
159 |
+
$type = __('plugins', 'companion-auto-update');
|
160 |
+
$message = cau_updated_message( $type, "\n".$updatedList );
|
161 |
+
|
162 |
+
wp_mail( cau_set_email() , $subject, $message, $headers );
|
163 |
+
|
164 |
+
}
|
165 |
|
166 |
+
}
|
167 |
+
|
168 |
+
// Do some high-tech stuff
|
169 |
+
function cau_get_last_updated( $slug ) {
|
170 |
+
$request = wp_remote_post(
|
171 |
+
'http://api.wordpress.org/plugins/info/1.0/',
|
172 |
+
array(
|
173 |
+
'body' => array(
|
174 |
+
'action' => 'plugin_information',
|
175 |
+
'request' => serialize(
|
176 |
+
(object) array(
|
177 |
+
'slug' => $slug,
|
178 |
+
'fields' => array( 'last_updated' => true )
|
179 |
+
)
|
180 |
+
)
|
181 |
+
)
|
182 |
+
)
|
183 |
+
);
|
184 |
+
if ( 200 != wp_remote_retrieve_response_code( $request ) ) return false;
|
185 |
+
|
186 |
+
$response = unserialize( wp_remote_retrieve_body( $request ) );
|
187 |
+
// Return an empty but cachable response if the plugin isn't in the .org repo
|
188 |
+
if ( empty( $response ) )
|
189 |
+
return '';
|
190 |
+
if ( isset( $response->last_updated ) )
|
191 |
+
return sanitize_text_field( $response->last_updated );
|
192 |
+
|
193 |
+
return false;
|
194 |
}
|
195 |
|
196 |
?>
|
companion-auto-update.php
CHANGED
@@ -3,9 +3,9 @@
|
|
3 |
* Plugin Name: Companion Auto Update
|
4 |
* Plugin URI: https://qreative-web.com
|
5 |
* Description: This plugin auto updates all plugins, all themes and the wordpress core.
|
6 |
-
* Version: 2.
|
7 |
* Author: Qreative-Web
|
8 |
-
* Author URI:
|
9 |
* Contributors: papin
|
10 |
* License: GPLv2 or later
|
11 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -27,32 +27,46 @@ add_action( 'init', 'cau_load_translations' );
|
|
27 |
// Install db
|
28 |
function cau_install() {
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
// Create db table
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
UNIQUE KEY id (id)
|
39 |
) $charset_collate;";
|
40 |
|
41 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
42 |
dbDelta( $sql );
|
43 |
|
44 |
// Database version
|
45 |
-
add_option( "cau_db_version", "
|
46 |
|
47 |
// Insert data
|
48 |
cau_install_data();
|
49 |
|
50 |
-
//
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
}
|
55 |
-
add_action('cau_set_schedule_mail', 'cau_check_updates_mail');
|
56 |
|
57 |
// Inset Data
|
58 |
function cau_install_data() {
|
@@ -62,54 +76,16 @@ function cau_install_data() {
|
|
62 |
$toemail = get_option('admin_email');
|
63 |
|
64 |
// Update configs
|
65 |
-
$wpdb->insert(
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
)
|
71 |
-
);
|
72 |
-
|
73 |
-
$wpdb->insert(
|
74 |
-
$table_name,
|
75 |
-
array(
|
76 |
-
'name' => 'themes',
|
77 |
-
'onoroff' => 'on',
|
78 |
-
)
|
79 |
-
);
|
80 |
-
|
81 |
-
$wpdb->insert(
|
82 |
-
$table_name,
|
83 |
-
array(
|
84 |
-
'name' => 'minor',
|
85 |
-
'onoroff' => 'on',
|
86 |
-
)
|
87 |
-
);
|
88 |
-
|
89 |
-
$wpdb->insert(
|
90 |
-
$table_name,
|
91 |
-
array(
|
92 |
-
'name' => 'major',
|
93 |
-
'onoroff' => 'on',
|
94 |
-
)
|
95 |
-
);
|
96 |
-
|
97 |
// Email configs
|
98 |
-
$wpdb->insert(
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
'onoroff' => '',
|
103 |
-
)
|
104 |
-
);
|
105 |
-
|
106 |
-
$wpdb->insert(
|
107 |
-
$table_name,
|
108 |
-
array(
|
109 |
-
'name' => 'send',
|
110 |
-
'onoroff' => 'on',
|
111 |
-
)
|
112 |
-
);
|
113 |
|
114 |
}
|
115 |
register_activation_hook( __FILE__, 'cau_install' );
|
@@ -126,6 +102,15 @@ function cau_remove() {
|
|
126 |
}
|
127 |
register_deactivation_hook( __FILE__, 'cau_remove' );
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
// Add plugin to menu
|
130 |
function register_cau_menu_page() {
|
131 |
add_submenu_page( 'tools.php', __('Auto Updater', 'companion-auto-update'), __('Auto Updater', 'companion-auto-update'), 'manage_options', 'cau-settings', 'cau_frontend' );
|
@@ -141,6 +126,10 @@ function cau_frontend() { ?>
|
|
141 |
|
142 |
<?php
|
143 |
|
|
|
|
|
|
|
|
|
144 |
|
145 |
if( isset( $_POST['submit'] ) ) {
|
146 |
|
@@ -153,6 +142,7 @@ function cau_frontend() { ?>
|
|
153 |
$major = $_POST['major'];
|
154 |
$email = $_POST['cau_email'];
|
155 |
$send = $_POST['cau_send'];
|
|
|
156 |
|
157 |
$wpdb->query( " UPDATE $table_name SET onoroff = '$plugins' WHERE name = 'plugins' " );
|
158 |
$wpdb->query( " UPDATE $table_name SET onoroff = '$themes' WHERE name = 'themes' " );
|
@@ -160,6 +150,7 @@ function cau_frontend() { ?>
|
|
160 |
$wpdb->query( " UPDATE $table_name SET onoroff = '$major' WHERE name = 'major' " );
|
161 |
$wpdb->query( " UPDATE $table_name SET onoroff = '$email' WHERE name = 'email' " );
|
162 |
$wpdb->query( " UPDATE $table_name SET onoroff = '$send' WHERE name = 'send' " );
|
|
|
163 |
|
164 |
echo '<div id="message" class="updated"><p><b>'.__('Settings saved', 'companion-auto-update').'.</b></p></div>';
|
165 |
}
|
@@ -206,22 +197,17 @@ function cau_frontend() { ?>
|
|
206 |
</tr>
|
207 |
</table>
|
208 |
|
209 |
-
<h2 class="title"><?php _e('Email
|
210 |
-
<p><?php _e('
|
211 |
-
(<?php _e('We wil not send more than one mail per day', 'companion-auto-update');?>)</p>
|
212 |
|
213 |
<?php
|
214 |
-
if( $cau_configs[4]->onoroff == '' )
|
215 |
-
|
216 |
-
} else {
|
217 |
-
$toemail = $cau_configs[4]->onoroff;
|
218 |
-
}
|
219 |
-
|
220 |
?>
|
221 |
|
222 |
<table class="form-table">
|
223 |
<tr>
|
224 |
-
<th scope="row"><?php _e('
|
225 |
<td>
|
226 |
<p>
|
227 |
<input id="cau_send" name="cau_send" type="checkbox" <?php if( $cau_configs[5]->onoroff == 'on' ) { echo 'checked'; } ?> />
|
@@ -229,6 +215,15 @@ function cau_frontend() { ?>
|
|
229 |
</p>
|
230 |
</td>
|
231 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
<tr>
|
233 |
<th scope="row"><?php _e('Email address', 'companion-auto-update');?></th>
|
234 |
<td>
|
@@ -242,12 +237,7 @@ function cau_frontend() { ?>
|
|
242 |
</tr>
|
243 |
</table>
|
244 |
|
245 |
-
<?php submit_button();
|
246 |
-
|
247 |
-
|
248 |
-
if ( !wp_next_scheduled ( 'cau_set_schedule_mail' )) {
|
249 |
-
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>';
|
250 |
-
} ?>
|
251 |
|
252 |
</div>
|
253 |
|
@@ -265,7 +255,6 @@ class CAU_auto_update {
|
|
265 |
|
266 |
public function CAU_auto_update_filters() {
|
267 |
|
268 |
-
|
269 |
global $wpdb;
|
270 |
$table_name = $wpdb->prefix . "auto_updates";
|
271 |
|
@@ -273,7 +262,8 @@ class CAU_auto_update {
|
|
273 |
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'major'");
|
274 |
foreach ( $configs as $config ) {
|
275 |
|
276 |
-
if( $config->onoroff == 'on' ) add_filter( 'allow_major_auto_core_updates', '__return_true', 1 );
|
|
|
277 |
|
278 |
}
|
279 |
|
@@ -281,7 +271,8 @@ class CAU_auto_update {
|
|
281 |
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'minor'");
|
282 |
foreach ( $configs as $config ) {
|
283 |
|
284 |
-
if( $config->onoroff == 'on' ) add_filter( 'allow_minor_auto_core_updates', '__return_true', 1 );
|
|
|
285 |
|
286 |
}
|
287 |
|
@@ -289,7 +280,8 @@ class CAU_auto_update {
|
|
289 |
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
|
290 |
foreach ( $configs as $config ) {
|
291 |
|
292 |
-
if( $config->onoroff == 'on' ) add_filter( 'auto_update_plugin', '__return_true', 1 );
|
|
|
293 |
|
294 |
}
|
295 |
|
@@ -297,7 +289,8 @@ class CAU_auto_update {
|
|
297 |
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'themes'");
|
298 |
foreach ( $configs as $config ) {
|
299 |
|
300 |
-
if( $config->onoroff == 'on' ) add_filter( 'auto_update_theme', '__return_true', 1 );
|
|
|
301 |
|
302 |
}
|
303 |
|
@@ -306,6 +299,7 @@ class CAU_auto_update {
|
|
306 |
}
|
307 |
new CAU_auto_update();
|
308 |
|
|
|
309 |
require_once('companion-auto-update-check-updates.php');
|
310 |
|
311 |
// Add settings link on plugin page
|
3 |
* Plugin Name: Companion Auto Update
|
4 |
* Plugin URI: https://qreative-web.com
|
5 |
* Description: This plugin auto updates all plugins, all themes and the wordpress core.
|
6 |
+
* Version: 2.7.0
|
7 |
* Author: Qreative-Web
|
8 |
+
* Author URI: http://papinschipper.nl
|
9 |
* Contributors: papin
|
10 |
* License: GPLv2 or later
|
11 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
27 |
// Install db
|
28 |
function cau_install() {
|
29 |
|
30 |
+
cau_database_creation();
|
31 |
+
|
32 |
+
// Set schedule for emails
|
33 |
+
if (! wp_next_scheduled ( 'cau_set_schedule_mail' )) {
|
34 |
+
wp_schedule_event(time(), 'daily', 'cau_set_schedule_mail');
|
35 |
+
}
|
36 |
+
}
|
37 |
+
add_action('cau_set_schedule_mail', 'cau_check_updates_mail');
|
38 |
+
|
39 |
+
function cau_database_creation() {
|
40 |
+
|
41 |
+
global $wpdb;
|
42 |
+
global $cau_db_version;
|
43 |
+
|
44 |
+
$cau_db_version = '1.2';
|
45 |
+
|
46 |
// Create db table
|
47 |
+
$table_name = $wpdb->prefix . "auto_updates";
|
48 |
+
|
49 |
+
$sql = "CREATE TABLE $table_name (
|
50 |
+
id INT(9) NOT NULL AUTO_INCREMENT,
|
51 |
+
name VARCHAR(255) NOT NULL,
|
52 |
+
onoroff VARCHAR(255) NOT NULL,
|
53 |
+
UNIQUE KEY id (id)
|
|
|
54 |
) $charset_collate;";
|
55 |
|
56 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
57 |
dbDelta( $sql );
|
58 |
|
59 |
// Database version
|
60 |
+
add_option( "cau_db_version", "$cau_db_version" );
|
61 |
|
62 |
// Insert data
|
63 |
cau_install_data();
|
64 |
|
65 |
+
// Updating..
|
66 |
+
$installed_ver = get_option( "cau_db_version" );
|
67 |
+
if ( $installed_ver != $cau_db_version ) update_option( "cau_db_version", $cau_db_version );
|
68 |
+
|
69 |
}
|
|
|
70 |
|
71 |
// Inset Data
|
72 |
function cau_install_data() {
|
76 |
$toemail = get_option('admin_email');
|
77 |
|
78 |
// Update configs
|
79 |
+
$wpdb->insert( $table_name, array( 'name' => 'plugins', 'onoroff' => 'on' ) );
|
80 |
+
$wpdb->insert( $table_name, array( 'name' => 'themes', 'onoroff' => 'on' ) );
|
81 |
+
$wpdb->insert( $table_name, array( 'name' => 'minor', 'onoroff' => 'on' ) );
|
82 |
+
$wpdb->insert( $table_name, array( 'name' => 'major', 'onoroff' => 'on' ) );
|
83 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
// Email configs
|
85 |
+
$wpdb->insert( $table_name, array( 'name' => 'email', 'onoroff' => '' ) );
|
86 |
+
$wpdb->insert( $table_name, array( 'name' => 'send', 'onoroff' => '' ) );
|
87 |
+
$wpdb->insert( $table_name, array( 'name' => 'sendupdate', 'onoroff' => '' ) );
|
88 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
}
|
91 |
register_activation_hook( __FILE__, 'cau_install' );
|
102 |
}
|
103 |
register_deactivation_hook( __FILE__, 'cau_remove' );
|
104 |
|
105 |
+
// Update
|
106 |
+
function cau_update_db_check() {
|
107 |
+
global $cau_db_version;
|
108 |
+
if ( get_site_option( 'cau_db_version' ) != $cau_db_version ) {
|
109 |
+
cau_database_creation();
|
110 |
+
}
|
111 |
+
}
|
112 |
+
add_action( 'plugins_loaded', 'cau_update_db_check' );
|
113 |
+
|
114 |
// Add plugin to menu
|
115 |
function register_cau_menu_page() {
|
116 |
add_submenu_page( 'tools.php', __('Auto Updater', 'companion-auto-update'), __('Auto Updater', 'companion-auto-update'), 'manage_options', 'cau-settings', 'cau_frontend' );
|
126 |
|
127 |
<?php
|
128 |
|
129 |
+
if ( !wp_next_scheduled ( 'cau_set_schedule_mail' )) 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>';
|
130 |
+
|
131 |
+
global $cau_db_version;
|
132 |
+
if ( get_site_option( 'cau_db_version' ) != $cau_db_version ) 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>';
|
133 |
|
134 |
if( isset( $_POST['submit'] ) ) {
|
135 |
|
142 |
$major = $_POST['major'];
|
143 |
$email = $_POST['cau_email'];
|
144 |
$send = $_POST['cau_send'];
|
145 |
+
$sendupdate = $_POST['cau_send_update'];
|
146 |
|
147 |
$wpdb->query( " UPDATE $table_name SET onoroff = '$plugins' WHERE name = 'plugins' " );
|
148 |
$wpdb->query( " UPDATE $table_name SET onoroff = '$themes' WHERE name = 'themes' " );
|
150 |
$wpdb->query( " UPDATE $table_name SET onoroff = '$major' WHERE name = 'major' " );
|
151 |
$wpdb->query( " UPDATE $table_name SET onoroff = '$email' WHERE name = 'email' " );
|
152 |
$wpdb->query( " UPDATE $table_name SET onoroff = '$send' WHERE name = 'send' " );
|
153 |
+
$wpdb->query( " UPDATE $table_name SET onoroff = '$sendupdate' WHERE name = 'sendupdate' " );
|
154 |
|
155 |
echo '<div id="message" class="updated"><p><b>'.__('Settings saved', 'companion-auto-update').'.</b></p></div>';
|
156 |
}
|
197 |
</tr>
|
198 |
</table>
|
199 |
|
200 |
+
<h2 class="title"><?php _e('Email Notifications', 'companion-auto-update');?></h2>
|
201 |
+
<p><?php _e('Email notifications are send once a day, you can choose what notifications to send below.', 'companion-auto-update');?></p>
|
|
|
202 |
|
203 |
<?php
|
204 |
+
if( $cau_configs[4]->onoroff == '' ) $toemail = get_option('admin_email');
|
205 |
+
else $toemail = $cau_configs[4]->onoroff;
|
|
|
|
|
|
|
|
|
206 |
?>
|
207 |
|
208 |
<table class="form-table">
|
209 |
<tr>
|
210 |
+
<th scope="row"><?php _e('Update Available', 'companion-auto-update');?></th>
|
211 |
<td>
|
212 |
<p>
|
213 |
<input id="cau_send" name="cau_send" type="checkbox" <?php if( $cau_configs[5]->onoroff == 'on' ) { echo 'checked'; } ?> />
|
215 |
</p>
|
216 |
</td>
|
217 |
</tr>
|
218 |
+
<tr>
|
219 |
+
<th scope="row"><?php _e('Successful Update', 'companion-auto-update');?></th>
|
220 |
+
<td>
|
221 |
+
<p>
|
222 |
+
<input id="cau_send_update" name="cau_send_update" type="checkbox" <?php if( $cau_configs[6]->onoroff == 'on' ) { echo 'checked'; } ?> />
|
223 |
+
<label for="cau_send_update"><?php _e('Send me emails when something has been updated.', 'companion-auto-update');?></label>
|
224 |
+
</p>
|
225 |
+
</td>
|
226 |
+
</tr>
|
227 |
<tr>
|
228 |
<th scope="row"><?php _e('Email address', 'companion-auto-update');?></th>
|
229 |
<td>
|
237 |
</tr>
|
238 |
</table>
|
239 |
|
240 |
+
<?php submit_button(); ?>
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
</div>
|
243 |
|
255 |
|
256 |
public function CAU_auto_update_filters() {
|
257 |
|
|
|
258 |
global $wpdb;
|
259 |
$table_name = $wpdb->prefix . "auto_updates";
|
260 |
|
262 |
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'major'");
|
263 |
foreach ( $configs as $config ) {
|
264 |
|
265 |
+
if( $config->onoroff == 'on' ) add_filter( 'allow_major_auto_core_updates', '__return_true', 1 ); // Turn on
|
266 |
+
if( $config->onoroff != 'on' ) add_filter( 'allow_major_auto_core_updates', '__return_false', 1 ); // Turn off
|
267 |
|
268 |
}
|
269 |
|
271 |
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'minor'");
|
272 |
foreach ( $configs as $config ) {
|
273 |
|
274 |
+
if( $config->onoroff == 'on' ) add_filter( 'allow_minor_auto_core_updates', '__return_true', 1 ); // Turn on
|
275 |
+
if( $config->onoroff != 'on' ) add_filter( 'allow_minor_auto_core_updates', '__return_false', 1 ); // Turn off
|
276 |
|
277 |
}
|
278 |
|
280 |
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
|
281 |
foreach ( $configs as $config ) {
|
282 |
|
283 |
+
if( $config->onoroff == 'on' ) add_filter( 'auto_update_plugin', '__return_true', 1 ); // Turn on
|
284 |
+
if( $config->onoroff != 'on' ) add_filter( 'auto_update_plugin', '__return_false', 1 ); // Turn off
|
285 |
|
286 |
}
|
287 |
|
289 |
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'themes'");
|
290 |
foreach ( $configs as $config ) {
|
291 |
|
292 |
+
if( $config->onoroff == 'on' ) add_filter( 'auto_update_theme', '__return_true', 1 ); // Turn on
|
293 |
+
if( $config->onoroff != 'on' ) add_filter( 'auto_update_theme', '__return_false', 1 ); // Turn off
|
294 |
|
295 |
}
|
296 |
|
299 |
}
|
300 |
new CAU_auto_update();
|
301 |
|
302 |
+
// Send e-mails
|
303 |
require_once('companion-auto-update-check-updates.php');
|
304 |
|
305 |
// Add settings link on plugin page
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/dakel/1
|
|
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.6
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -17,9 +17,10 @@ We understand that you might not always be able to check if your wordpress site
|
|
17 |
This plugin enables background auto-updating for all plugins, all themes and the wordpress core (both major and minor updates).
|
18 |
We give you full control over what is updated and what isn't, via the settings page you can easily disallow auto-updating for either plugins, themes or wordpress core.
|
19 |
|
20 |
-
=
|
21 |
-
|
22 |
-
|
|
|
23 |
|
24 |
== Installation ==
|
25 |
|
@@ -34,6 +35,12 @@ We will only do this once a day ;)
|
|
34 |
|
35 |
== Changelog ==
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
= 2.5.0 =
|
38 |
* New: If you have disabled one or multiple auto-updates, we can email you when an update is available.
|
39 |
|
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.6
|
7 |
+
Stable tag: 2.7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
17 |
This plugin enables background auto-updating for all plugins, all themes and the wordpress core (both major and minor updates).
|
18 |
We give you full control over what is updated and what isn't, via the settings page you can easily disallow auto-updating for either plugins, themes or wordpress core.
|
19 |
|
20 |
+
= Email Notifications =
|
21 |
+
Email notifications are send once a day, right now two notifications are available:
|
22 |
+
* Update Available: Sends an email when an update is available and you've disabled auto-updates
|
23 |
+
* Successful Update: Sends an email when something has been updated (only works for plugins right now)
|
24 |
|
25 |
== Installation ==
|
26 |
|
35 |
|
36 |
== Changelog ==
|
37 |
|
38 |
+
= 2.7.0 =
|
39 |
+
* Better updating: How ironic, this plugin did not handle it's own updates so well (required re-activation etc.) this has been fixed.
|
40 |
+
* Fixed bug: WordPress updates could not be disabled, this should work now.
|
41 |
+
* Update Notifications: You can now get an email notification when an plugin has been updated (right now this only works with plugins, themes coming up).
|
42 |
+
* Minor perfomance improvements.
|
43 |
+
|
44 |
= 2.5.0 =
|
45 |
* New: If you have disabled one or multiple auto-updates, we can email you when an update is available.
|
46 |
|