Version Description
(February 10, 2018) = * New: Set the update time, many requested this feature so here it is :) * New: Update log * Fixed issue where multiple emailaddresses wouldn't work.
Download this release
Release Info
Developer | Papin |
Plugin | Companion Auto Update |
Version | 3.0 |
Comparing to | |
See all releases |
Code changes from version 2.9.6 to 3.0
- backend/style.css +57 -43
- companion-auto-update-check-updates.php +2 -177
- companion-auto-update.php +43 -416
- readme.txt +18 -17
backend/style.css
CHANGED
@@ -1,23 +1,47 @@
|
|
1 |
-
|
2 |
-
|
|
|
3 |
}
|
4 |
-
.
|
5 |
-
|
6 |
-
bottom: -6px;
|
7 |
}
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
color: rgba(0,0,0,0.2);
|
13 |
}
|
14 |
-
|
15 |
-
|
16 |
}
|
17 |
-
|
18 |
position: relative;
|
19 |
min-width: 55px;
|
20 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
#the-list input[type="checkbox"]:not(:checked), #the-list input[type="checkbox"]:checked {
|
22 |
width: 45px;
|
23 |
height: 45px;
|
@@ -41,45 +65,35 @@ thead .check-column, tfoot .check-column {
|
|
41 |
#the-list input[type="checkbox"]:not(:checked) + label:before, #the-list input[type="checkbox"]:checked + label:before {
|
42 |
left: 0;
|
43 |
top: -3px;
|
44 |
-
width:
|
45 |
-
height:
|
46 |
-
background:
|
|
|
47 |
border-radius: 15px;
|
48 |
transition: background-color .2s;
|
49 |
}
|
50 |
#the-list input[type="checkbox"]:not(:checked) + label:after, #the-list input[type="checkbox"]:checked + label:after {
|
51 |
-
width:
|
52 |
-
height:
|
53 |
transition: all .2s;
|
54 |
border-radius: 500px;
|
55 |
-
background:
|
56 |
-
|
|
|
57 |
left: 5px;
|
58 |
}
|
59 |
-
/* on checked */
|
60 |
#the-list input[type="checkbox"]:not(:checked) + label:before {
|
61 |
-
background: #
|
|
|
62 |
}
|
63 |
#the-list input[type="checkbox"]:not(:checked) + label:after {
|
64 |
-
background: #
|
65 |
-
|
66 |
-
left:
|
67 |
-
}
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
}
|
74 |
-
#the-list tr.inactive .status {
|
75 |
-
color: #BF3D3C;
|
76 |
-
}
|
77 |
-
#the-list tr.active .status {
|
78 |
-
color: rgba(0,0,0,0.4);
|
79 |
-
}
|
80 |
-
.message.warning {
|
81 |
-
border-left-color: orange;
|
82 |
-
}
|
83 |
-
p.warning strong {
|
84 |
-
color: orange;
|
85 |
}
|
1 |
+
/* Default Stylings */
|
2 |
+
.message.warning {
|
3 |
+
border-left-color: orange;
|
4 |
}
|
5 |
+
p.warning strong {
|
6 |
+
color: orange;
|
|
|
7 |
}
|
8 |
+
|
9 |
+
/* Table Styling */
|
10 |
+
table.autoupdate th.head-plugin {
|
11 |
+
min-width: 250px;
|
|
|
12 |
}
|
13 |
+
table.autoupdate th.head-status {
|
14 |
+
min-width: 150px;
|
15 |
}
|
16 |
+
table.autoupdate th.check-column {
|
17 |
position: relative;
|
18 |
min-width: 55px;
|
19 |
}
|
20 |
+
table.autoupdate tr.inactive {
|
21 |
+
background: #FEF7F1;
|
22 |
+
}
|
23 |
+
table.autoupdate tr.active .check-column {
|
24 |
+
border-left: 3px solid transparent;
|
25 |
+
}
|
26 |
+
table.autoupdate tr.inactive .check-column {
|
27 |
+
border-left: 3px solid #D54E21;
|
28 |
+
}
|
29 |
+
table.autoupdate tr.inactive td.column-status p {
|
30 |
+
color: #BF3D3C;
|
31 |
+
}
|
32 |
+
table.autoupdate tr.active td.column-status p {
|
33 |
+
color: #000;
|
34 |
+
}
|
35 |
+
|
36 |
+
/* Update Log */
|
37 |
+
table.autoupdatelog strong {
|
38 |
+
color: #000;
|
39 |
+
}
|
40 |
+
table.autoupdatelog .dashicons {
|
41 |
+
color: #00A0D2;
|
42 |
+
}
|
43 |
+
|
44 |
+
/* Custom checkboxes */
|
45 |
#the-list input[type="checkbox"]:not(:checked), #the-list input[type="checkbox"]:checked {
|
46 |
width: 45px;
|
47 |
height: 45px;
|
65 |
#the-list input[type="checkbox"]:not(:checked) + label:before, #the-list input[type="checkbox"]:checked + label:before {
|
66 |
left: 0;
|
67 |
top: -3px;
|
68 |
+
width: 30px;
|
69 |
+
height: 16px;
|
70 |
+
background: transparent;
|
71 |
+
border: 2px solid #555D66;
|
72 |
border-radius: 15px;
|
73 |
transition: background-color .2s;
|
74 |
}
|
75 |
#the-list input[type="checkbox"]:not(:checked) + label:after, #the-list input[type="checkbox"]:checked + label:after {
|
76 |
+
width: 8px;
|
77 |
+
height: 8px;
|
78 |
transition: all .2s;
|
79 |
border-radius: 500px;
|
80 |
+
background: transparent;
|
81 |
+
border: 2px solid #555D66;
|
82 |
+
top: 1px;
|
83 |
left: 5px;
|
84 |
}
|
|
|
85 |
#the-list input[type="checkbox"]:not(:checked) + label:before {
|
86 |
+
background: #00A0D2;
|
87 |
+
border: 2px solid #00A0D2;
|
88 |
}
|
89 |
#the-list input[type="checkbox"]:not(:checked) + label:after {
|
90 |
+
background: #00A0D2;
|
91 |
+
border-color: #FFF;
|
92 |
+
left: 18px;
|
93 |
+
}
|
94 |
+
|
95 |
+
@media screen and (max-width: 1000px) {
|
96 |
+
table.autoupdate thead {
|
97 |
+
display: none;
|
98 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
companion-auto-update-check-updates.php
CHANGED
@@ -1,181 +1,6 @@
|
|
1 |
<?php
|
2 |
-
function cau_check_updates_mail() {
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
$cau_configs = $wpdb->get_results( "SELECT * FROM $table_name" );
|
7 |
-
|
8 |
-
if( $cau_configs[5]->onoroff == 'on' ) {
|
9 |
-
cau_list_theme_updates(); // Check for theme updates
|
10 |
-
cau_list_plugin_updates(); // Check for plugin updates
|
11 |
-
}
|
12 |
-
|
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;
|
19 |
-
$table_name = $wpdb->prefix . "auto_updates";
|
20 |
-
$cau_configs = $wpdb->get_results( "SELECT * FROM $table_name" );
|
21 |
-
|
22 |
-
if( $cau_configs[4]->onoroff == '' ) $toemail = get_option('admin_email');
|
23 |
-
else $toemail = $cau_configs[4]->onoroff;
|
24 |
-
|
25 |
-
return $toemail;
|
26 |
-
|
27 |
-
}
|
28 |
-
|
29 |
-
function cau_set_content( $single, $plural ) {
|
30 |
-
|
31 |
-
return sprintf( esc_html__(
|
32 |
-
'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'
|
33 |
-
), $single, get_site_url(), $plural);
|
34 |
-
|
35 |
-
}
|
36 |
-
|
37 |
-
// Checks if theme updates are available
|
38 |
-
function cau_list_theme_updates() {
|
39 |
-
|
40 |
-
global $wpdb;
|
41 |
-
$table_name = $wpdb->prefix . "auto_updates";
|
42 |
-
|
43 |
-
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'themes'");
|
44 |
-
foreach ( $configs as $config ) {
|
45 |
-
|
46 |
-
if( $config->onoroff != 'on' ) {
|
47 |
-
|
48 |
-
require_once ABSPATH . '/wp-admin/includes/update.php';
|
49 |
-
$themes = get_theme_updates();
|
50 |
-
|
51 |
-
if ( !empty( $themes ) ) {
|
52 |
-
|
53 |
-
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __('Theme update available.', 'companion-auto-update');
|
54 |
-
$type = __('theme', 'companion-auto-update');
|
55 |
-
$type_plural = __('themes', 'companion-auto-update');
|
56 |
-
$message = cau_set_content( $type, $type_plural );
|
57 |
-
|
58 |
-
wp_mail( cau_set_email() , $subject, $message, $headers );
|
59 |
-
}
|
60 |
-
|
61 |
-
}
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
-
}
|
66 |
-
|
67 |
-
// Checks if plugin updates are available
|
68 |
-
function cau_list_plugin_updates() {
|
69 |
-
|
70 |
-
global $wpdb;
|
71 |
-
$table_name = $wpdb->prefix . "auto_updates";
|
72 |
-
|
73 |
-
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
|
74 |
-
foreach ( $configs as $config ) {
|
75 |
-
|
76 |
-
if( $config->onoroff != 'on' ) {
|
77 |
-
|
78 |
-
require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
|
79 |
-
$plugins = get_plugin_updates();
|
80 |
-
|
81 |
-
if ( !empty( $plugins ) ) {
|
82 |
-
|
83 |
-
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __('Plugin update available.', 'companion-auto-update');
|
84 |
-
$type = __('plugin', 'companion-auto-update');
|
85 |
-
$type_plural = __('plugins', 'companion-auto-update');
|
86 |
-
$message = cau_set_content( $type, $type_plural );
|
87 |
-
|
88 |
-
wp_mail( cau_set_email() , $subject, $message, $headers );
|
89 |
-
}
|
90 |
-
|
91 |
-
}
|
92 |
-
|
93 |
-
}
|
94 |
-
}
|
95 |
-
|
96 |
-
// Creates the messages to be send
|
97 |
-
function cau_updated_message( $type, $updatedList ) {
|
98 |
-
|
99 |
-
return sprintf( esc_html__(
|
100 |
-
'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'
|
101 |
-
), $type, get_site_url(), $updatedList );
|
102 |
-
|
103 |
-
}
|
104 |
-
|
105 |
-
// Alerts when plugin has been updated
|
106 |
-
function cau_plugin_updated() {
|
107 |
-
|
108 |
-
$today = date("Y-m-d");
|
109 |
-
$yesterday = date('Y-m-d',strtotime("-1 days"));
|
110 |
-
$updatedList = '';
|
111 |
-
$all_plugins = get_plugins();
|
112 |
-
|
113 |
-
$updatedPlugins = false;
|
114 |
-
|
115 |
-
foreach ( $all_plugins as $key => $value ) {
|
116 |
-
|
117 |
-
$slug = explode( '/', $key );
|
118 |
-
$slug_hash = md5( $slug[0] );
|
119 |
-
$last_updated = get_transient( "cau_{$slug_hash}" );
|
120 |
-
|
121 |
-
if ( false === $last_updated ) {
|
122 |
-
$last_updated = cau_get_last_updated( $slug );
|
123 |
-
set_transient( "cau_{$slug_hash}", $last_updated, 86400 );
|
124 |
-
}
|
125 |
-
|
126 |
-
if ( $last_updated ) {
|
127 |
-
$last_updated = explode( ' ', $last_updated );
|
128 |
-
$last_updated = $last_updated[0];
|
129 |
-
|
130 |
-
if( $last_updated == $today OR $last_updated == $yesterday ) {
|
131 |
-
foreach ( $value as $k => $v ) {
|
132 |
-
if( $k == "Name" ) $updatedList .= "- ".$v;
|
133 |
-
if( $k == "Version" ) $updatedList .= " ".__("to version:")." ".$v."\n";
|
134 |
-
}
|
135 |
-
|
136 |
-
$updatedPlugins = true;
|
137 |
-
|
138 |
-
$subject = '[' . get_bloginfo( 'name' ) . '] ' . __('One or more plugins have been updated.', 'companion-auto-update');
|
139 |
-
$type = __('plugins', 'companion-auto-update');
|
140 |
-
$message = cau_updated_message( $type, "\n".$updatedList );
|
141 |
-
|
142 |
-
}
|
143 |
-
}
|
144 |
-
|
145 |
-
}
|
146 |
-
|
147 |
-
if( $updatedPlugins ) {
|
148 |
-
wp_mail( cau_set_email() , $subject, $message, $headers );
|
149 |
-
}
|
150 |
-
|
151 |
-
}
|
152 |
-
|
153 |
-
// Do some high-tech stuff
|
154 |
-
function cau_get_last_updated( $slug ) {
|
155 |
-
$request = wp_remote_post(
|
156 |
-
'http://api.wordpress.org/plugins/info/1.0/',
|
157 |
-
array(
|
158 |
-
'body' => array(
|
159 |
-
'action' => 'plugin_information',
|
160 |
-
'request' => serialize(
|
161 |
-
(object) array(
|
162 |
-
'slug' => $slug,
|
163 |
-
'fields' => array( 'last_updated' => true )
|
164 |
-
)
|
165 |
-
)
|
166 |
-
)
|
167 |
-
)
|
168 |
-
);
|
169 |
-
if ( 200 != wp_remote_retrieve_response_code( $request ) ) return false;
|
170 |
-
|
171 |
-
$response = unserialize( wp_remote_retrieve_body( $request ) );
|
172 |
-
// Return an empty but cachable response if the plugin isn't in the .org repo
|
173 |
-
if ( empty( $response ) )
|
174 |
-
return '';
|
175 |
-
if ( isset( $response->last_updated ) )
|
176 |
-
return sanitize_text_field( $response->last_updated );
|
177 |
-
|
178 |
-
return false;
|
179 |
-
}
|
180 |
|
181 |
?>
|
1 |
<?php
|
|
|
2 |
|
3 |
+
// Deprecated file as of version 3.0. Will be removed in a future update.
|
4 |
+
require_once( 'cau_emails.php' ); // Fallback
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
?>
|
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:
|
7 |
* Author: Papin Schipper
|
8 |
* Author URI: http://codeermeneer.nl/
|
9 |
* Contributors: papin
|
@@ -25,7 +25,7 @@ add_action( 'init', 'cau_load_translations' );
|
|
25 |
// Install db
|
26 |
function cau_install() {
|
27 |
cau_database_creation(); // Db handle
|
28 |
-
if (! wp_next_scheduled ( 'cau_set_schedule_mail' )) wp_schedule_event(time(), 'daily', 'cau_set_schedule_mail'); //Set schedule
|
29 |
}
|
30 |
add_action('cau_set_schedule_mail', 'cau_check_updates_mail');
|
31 |
|
@@ -34,7 +34,7 @@ function cau_database_creation() {
|
|
34 |
global $wpdb;
|
35 |
global $cau_db_version;
|
36 |
|
37 |
-
$cau_db_version = '1.4.
|
38 |
|
39 |
// Create db table
|
40 |
$table_name = $wpdb->prefix . "auto_updates";
|
@@ -122,26 +122,15 @@ function cau_update_db_check() {
|
|
122 |
}
|
123 |
add_action( 'plugins_loaded', 'cau_update_db_check' );
|
124 |
|
|
|
|
|
|
|
125 |
// Add plugin to menu
|
126 |
function register_cau_menu_page() {
|
127 |
-
add_submenu_page(
|
128 |
}
|
129 |
add_action( 'admin_menu', 'register_cau_menu_page' );
|
130 |
|
131 |
-
function active_tab( $page ) {
|
132 |
-
|
133 |
-
if( !isset( $_GET['tab'] ) ) {
|
134 |
-
$cur_page = '';
|
135 |
-
} else {
|
136 |
-
$cur_page = $_GET['tab'];
|
137 |
-
}
|
138 |
-
|
139 |
-
if( $page == $cur_page ) {
|
140 |
-
echo 'nav-tab-active';
|
141 |
-
}
|
142 |
-
|
143 |
-
}
|
144 |
-
|
145 |
// Settings page
|
146 |
function cau_frontend() { ?>
|
147 |
|
@@ -156,440 +145,78 @@ function cau_frontend() { ?>
|
|
156 |
<hr class="wp-header-end">
|
157 |
|
158 |
<h2 class="nav-tab-wrapper wp-clearfix">
|
159 |
-
<a href="
|
160 |
-
<a href="
|
161 |
-
<a href="
|
|
|
162 |
</h2>
|
163 |
|
164 |
<?php
|
165 |
|
166 |
if( !isset( $_GET['tab'] ) ) {
|
167 |
|
168 |
-
|
169 |
|
170 |
-
|
171 |
-
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>';
|
172 |
|
173 |
-
|
174 |
-
|
175 |
-
global $wpdb;
|
176 |
-
$table_name = $wpdb->prefix . "auto_updates";
|
177 |
-
|
178 |
-
$plugins = $_POST['plugins'];
|
179 |
-
$themes = $_POST['themes'];
|
180 |
-
$minor = $_POST['minor'];
|
181 |
-
$major = $_POST['major'];
|
182 |
-
$translations = $_POST['translations'];
|
183 |
-
$send = $_POST['cau_send'];
|
184 |
-
$sendupdate = $_POST['cau_send_update'];
|
185 |
-
$wpemails = $_POST['wpemails'];
|
186 |
-
|
187 |
-
$email = sanitize_text_field( $_POST['cau_email'] );
|
188 |
-
|
189 |
-
$wpdb->query( " UPDATE $table_name SET onoroff = '$plugins' WHERE name = 'plugins' " );
|
190 |
-
$wpdb->query( " UPDATE $table_name SET onoroff = '$themes' WHERE name = 'themes' " );
|
191 |
-
$wpdb->query( " UPDATE $table_name SET onoroff = '$minor' WHERE name = 'minor' " );
|
192 |
-
$wpdb->query( " UPDATE $table_name SET onoroff = '$major' WHERE name = 'major' " );
|
193 |
-
$wpdb->query( " UPDATE $table_name SET onoroff = '$translations' WHERE name = 'translations' " );
|
194 |
-
$wpdb->query( " UPDATE $table_name SET onoroff = '$email' WHERE name = 'email' " );
|
195 |
-
$wpdb->query( " UPDATE $table_name SET onoroff = '$send' WHERE name = 'send' " );
|
196 |
-
$wpdb->query( " UPDATE $table_name SET onoroff = '$sendupdate' WHERE name = 'sendupdate' " );
|
197 |
-
$wpdb->query( " UPDATE $table_name SET onoroff = '$wpemails' WHERE name = 'wpemails' " );
|
198 |
-
|
199 |
-
echo '<div id="message" class="updated"><p><b>'.__('Settings saved', 'companion-auto-update').'.</b></p></div>';
|
200 |
-
}
|
201 |
-
|
202 |
-
?>
|
203 |
-
|
204 |
-
<form method="POST">
|
205 |
-
|
206 |
-
<table class="form-table">
|
207 |
-
<tr>
|
208 |
-
<th scope="row"><?php _e('Auto Updater', 'companion-auto-update');?></th>
|
209 |
-
<td>
|
210 |
-
<fieldset>
|
211 |
-
|
212 |
-
<?php
|
213 |
-
|
214 |
-
global $wpdb;
|
215 |
-
$table_name = $wpdb->prefix . "auto_updates";
|
216 |
-
|
217 |
-
$cau_configs = $wpdb->get_results( "SELECT * FROM $table_name" );
|
218 |
-
|
219 |
-
echo '<p><input id="'.$cau_configs[0]->name.'" name="'.$cau_configs[0]->name.'" type="checkbox"';
|
220 |
-
if( $cau_configs[0]->onoroff == 'on' ) echo 'checked';
|
221 |
-
echo '/> <label for="'.$cau_configs[0]->name.'">'.__('Auto update plugins?', 'companion-auto-update').'</label></p>';
|
222 |
-
|
223 |
-
echo '<p><input id="'.$cau_configs[1]->name.'" name="'.$cau_configs[1]->name.'" type="checkbox"';
|
224 |
-
if( $cau_configs[1]->onoroff == 'on' ) echo 'checked';
|
225 |
-
echo '/> <label for="'.$cau_configs[1]->name.'">'.__('Auto update themes?', 'companion-auto-update').'</label></p>';
|
226 |
-
|
227 |
-
|
228 |
-
echo '<p><input id="'.$cau_configs[2]->name.'" name="'.$cau_configs[2]->name.'" type="checkbox"';
|
229 |
-
if( $cau_configs[2]->onoroff == 'on' ) echo 'checked';
|
230 |
-
echo '/> <label for="'.$cau_configs[2]->name.'">'.__('Auto update minor core updates?', 'companion-auto-update').'</label></p>';
|
231 |
-
|
232 |
-
|
233 |
-
echo '<p><input id="'.$cau_configs[3]->name.'" name="'.$cau_configs[3]->name.'" type="checkbox"';
|
234 |
-
if( $cau_configs[3]->onoroff == 'on' ) echo 'checked';
|
235 |
-
echo '/> <label for="'.$cau_configs[3]->name.'">'.__('Auto update major core updates?', 'companion-auto-update').'</label></p>';
|
236 |
-
|
237 |
-
echo '<p><input id="'.$cau_configs[8]->name.'" name="'.$cau_configs[8]->name.'" type="checkbox"';
|
238 |
-
if( $cau_configs[8]->onoroff == 'on' ) echo 'checked';
|
239 |
-
echo '/> <label for="'.$cau_configs[8]->name.'">'.__('Auto update translation files?', 'companion-auto-update').'</label></p>';
|
240 |
-
|
241 |
-
?>
|
242 |
-
|
243 |
-
</fieldset>
|
244 |
-
</td>
|
245 |
-
</tr>
|
246 |
-
</table>
|
247 |
-
|
248 |
-
<h2 class="title"><?php _e('Email Notifications', 'companion-auto-update');?></h2>
|
249 |
-
<p><?php _e('Email notifications are send once a day, you can choose what notifications to send below.', 'companion-auto-update');?></p>
|
250 |
-
|
251 |
-
<?php
|
252 |
-
if( $cau_configs[4]->onoroff == '' ) $toemail = get_option('admin_email');
|
253 |
-
else $toemail = $cau_configs[4]->onoroff;
|
254 |
-
?>
|
255 |
-
|
256 |
-
<table class="form-table">
|
257 |
-
<tr>
|
258 |
-
<th scope="row"><?php _e('Update available', 'companion-auto-update');?></th>
|
259 |
-
<td>
|
260 |
-
<p>
|
261 |
-
<input id="cau_send" name="cau_send" type="checkbox" <?php if( $cau_configs[5]->onoroff == 'on' ) { echo 'checked'; } ?> />
|
262 |
-
<label for="cau_send"><?php _e('Send me emails when an update is available.', 'companion-auto-update');?></label>
|
263 |
-
</p>
|
264 |
-
</td>
|
265 |
-
</tr>
|
266 |
-
<tr>
|
267 |
-
<th scope="row"><?php _e('Successful update', 'companion-auto-update');?></th>
|
268 |
-
<td>
|
269 |
-
<p>
|
270 |
-
<input id="cau_send_update" name="cau_send_update" type="checkbox" <?php if( $cau_configs[6]->onoroff == 'on' ) { echo 'checked'; } ?> />
|
271 |
-
<label for="cau_send_update"><?php _e('Send me emails when something has been updated.', 'companion-auto-update');?></label>
|
272 |
-
</p>
|
273 |
-
</td>
|
274 |
-
</tr>
|
275 |
-
<tr>
|
276 |
-
<th scope="row"><?php _e('Core notifications', 'companion-auto-update');?></th>
|
277 |
-
<td>
|
278 |
-
<p>
|
279 |
-
<input id="wpemails" name="wpemails" type="checkbox" <?php if( $cau_configs[9]->onoroff == 'on' ) { echo 'checked'; } ?> />
|
280 |
-
<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>
|
281 |
-
</p>
|
282 |
-
</td>
|
283 |
-
</tr>
|
284 |
-
<tr>
|
285 |
-
<th scope="row"><?php _e('Email address', 'companion-auto-update');?></th>
|
286 |
-
<td>
|
287 |
-
<p>
|
288 |
-
<label for="cau_email"><?php _e('To', 'companion-auto-update');?>:</label>
|
289 |
-
<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 ); ?>" />
|
290 |
-
</p>
|
291 |
-
|
292 |
-
<p class="description"><?php _e('Seperate email addresses using commas.', 'companion-auto-update');?></p>
|
293 |
-
</td>
|
294 |
-
</tr>
|
295 |
-
</table>
|
296 |
-
|
297 |
-
<?php submit_button();
|
298 |
|
299 |
-
|
300 |
-
|
301 |
-
selectPlugins();
|
302 |
-
|
303 |
-
} else if( $_GET['tab'] == 'schedule' ) {
|
304 |
-
|
305 |
-
schedule();
|
306 |
-
|
307 |
-
} ?>
|
308 |
|
309 |
</div>
|
310 |
|
311 |
<?php }
|
312 |
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
$table_name = $wpdb->prefix . "auto_updates";
|
317 |
-
$config = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'notUpdateList'");
|
318 |
-
|
319 |
-
$list = $config[0]->onoroff;
|
320 |
-
$list = explode( ", ", $list );
|
321 |
-
$returnList = array();
|
322 |
-
|
323 |
-
foreach ( $list as $key ) array_push( $returnList, $key );
|
324 |
-
|
325 |
-
return $returnList;
|
326 |
-
|
327 |
}
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
$theme_sc = $_POST['theme_schedule'];
|
341 |
-
$core_sc = $_POST['core_schedule'];
|
342 |
-
$schedule_mail = $_POST['schedule_mail'];
|
343 |
-
|
344 |
-
// First clear schedules
|
345 |
-
wp_clear_scheduled_hook('wp_update_plugins');
|
346 |
-
wp_clear_scheduled_hook('wp_update_themes');
|
347 |
-
wp_clear_scheduled_hook('wp_version_check');
|
348 |
-
wp_clear_scheduled_hook('cau_set_schedule_mail');
|
349 |
-
|
350 |
-
// Then set the new times
|
351 |
-
wp_schedule_event( time(), $plugin_sc, 'wp_update_plugins' );
|
352 |
-
wp_schedule_event( time(), $theme_sc, 'wp_update_themes' );
|
353 |
-
wp_schedule_event( time(), $core_sc, 'wp_version_check' );
|
354 |
-
wp_schedule_event( time(), $schedule_mail, 'cau_set_schedule_mail' );
|
355 |
-
|
356 |
-
echo '<div id="message" class="updated"><p>'.__('Changes were saved. Reload the page to see the changes made.', 'companion-auto-update').'</p></div>';
|
357 |
-
|
358 |
-
}
|
359 |
-
?>
|
360 |
-
|
361 |
-
<form method="POST">
|
362 |
|
363 |
-
|
364 |
-
<p class="warning">
|
365 |
-
<strong><?php _e('Warning', 'companion-auto-update'); ?></strong> ‐ <?php _e('Changing these settings may affect your sites perfomance.', 'companion-auto-update'); ?>
|
366 |
-
</p>
|
367 |
-
</div>
|
368 |
-
|
369 |
-
<h2 class="title"><?php _e('Updating', 'companion-auto-update');?></h2>
|
370 |
-
<?php _e('How often should the auto updater kick in? (Default twice daily)', 'companion-auto-update'); ?>
|
371 |
-
<table class="form-table">
|
372 |
-
<tr>
|
373 |
-
<th scope="row"><?php _e('Plugin update interval', 'companion-auto-update');?></th>
|
374 |
-
<td>
|
375 |
-
<p>
|
376 |
-
<select name='plugin_schedule'>
|
377 |
-
<option value='hourly' <?php if( $plugin_schedule == 'hourly' ) { echo "SELECTED"; } ?> ><?php _e('Hourly', 'companion-auto-update');?></option>
|
378 |
-
<option value='twicedaily' <?php if( $plugin_schedule == 'twicedaily' ) { echo "SELECTED"; } ?> ><?php _e('Twice Daily', 'companion-auto-update');?></option>
|
379 |
-
<option value='daily' <?php if( $plugin_schedule == 'daily' ) { echo "SELECTED"; } ?> ><?php _e('Daily', 'companion-auto-update');?></option>
|
380 |
-
</select>
|
381 |
-
</p>
|
382 |
-
</td>
|
383 |
-
</tr>
|
384 |
-
<tr>
|
385 |
-
<th scope="row"><?php _e('Theme update interval', 'companion-auto-update');?></th>
|
386 |
-
<td>
|
387 |
-
<p>
|
388 |
-
<select name='theme_schedule'>
|
389 |
-
<option value='hourly' <?php if( $theme_schedule == 'hourly' ) { echo "SELECTED"; } ?> ><?php _e('Hourly', 'companion-auto-update');?></option>
|
390 |
-
<option value='twicedaily' <?php if( $theme_schedule == 'twicedaily' ) { echo "SELECTED"; } ?> ><?php _e('Twice Daily', 'companion-auto-update');?></option>
|
391 |
-
<option value='daily' <?php if( $theme_schedule == 'daily' ) { echo "SELECTED"; } ?> ><?php _e('Daily', 'companion-auto-update');?></option>
|
392 |
-
</select>
|
393 |
-
</p>
|
394 |
-
</td>
|
395 |
-
</tr>
|
396 |
-
<tr>
|
397 |
-
<th scope="row"><?php _e('Core update interval', 'companion-auto-update');?></th>
|
398 |
-
<td>
|
399 |
-
<p>
|
400 |
-
<select name='core_schedule'>
|
401 |
-
<option value='hourly' <?php if( $core_schedule == 'hourly' ) { echo "SELECTED"; } ?> ><?php _e('Hourly', 'companion-auto-update');?></option>
|
402 |
-
<option value='twicedaily' <?php if( $core_schedule == 'twicedaily' ) { echo "SELECTED"; } ?> ><?php _e('Twice Daily', 'companion-auto-update');?></option>
|
403 |
-
<option value='daily' <?php if( $core_schedule == 'daily' ) { echo "SELECTED"; } ?> ><?php _e('Daily', 'companion-auto-update');?></option>
|
404 |
-
</select>
|
405 |
-
</p>
|
406 |
-
</td>
|
407 |
-
</tr>
|
408 |
-
</table>
|
409 |
-
|
410 |
-
<h2 class="title"><?php _e('Email Notifications', 'companion-auto-update');?></h2>
|
411 |
-
<?php _e('How often should notifications be send? (Default daily)', 'companion-auto-update'); ?>
|
412 |
-
<table class="form-table">
|
413 |
-
<tr>
|
414 |
-
<th scope="row"><?php _e('Email Notifications', 'companion-auto-update');?></th>
|
415 |
-
<td>
|
416 |
-
<p>
|
417 |
-
<select name='schedule_mail'>
|
418 |
-
<option value='hourly' <?php if( $mail_sc == 'hourly' ) { echo "SELECTED"; } ?> ><?php _e('Hourly', 'companion-auto-update');?></option>
|
419 |
-
<option value='twicedaily' <?php if( $mail_sc == 'twicedaily' ) { echo "SELECTED"; } ?> ><?php _e('Twice Daily', 'companion-auto-update');?></option>
|
420 |
-
<option value='daily' <?php if( $mail_sc == 'daily' ) { echo "SELECTED"; } ?> ><?php _e('Daily', 'companion-auto-update');?></option>
|
421 |
-
</select>
|
422 |
-
</p>
|
423 |
-
</td>
|
424 |
-
</tr>
|
425 |
-
</table>
|
426 |
-
|
427 |
-
<input type='submit' name='submit' id='submit' class='button button-primary' value='<?php _e( "Save changes", "companion-auto-update" ); ?>'>
|
428 |
-
|
429 |
-
</form>
|
430 |
-
|
431 |
-
<?php }
|
432 |
-
|
433 |
-
function selectPlugins() { ?>
|
434 |
-
|
435 |
-
<p><?php _e('Here you can select plugins that you do not wish to automatically update', 'companion-auto-update'); ?>.</p>
|
436 |
-
|
437 |
-
<?php
|
438 |
-
|
439 |
-
global $wpdb;
|
440 |
-
$table_name = $wpdb->prefix . "auto_updates";
|
441 |
-
|
442 |
-
$configs = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'plugins'");
|
443 |
-
foreach ( $configs as $config ) if( $config->onoroff != 'on' ) echo '<div id="message" class="error"><p><b>'.__('Auto updating disabled', 'companion-auto-update').' –</b> '.__('You have <strong>disabled</strong> auto updating, these settings do not work unless you <strong>enable</strong> it', 'companion-auto-update').'.</p></div>';
|
444 |
-
|
445 |
-
if( isset( $_POST['submit'] ) ) {
|
446 |
-
|
447 |
-
$noUpdateList = '';
|
448 |
-
$noUpdateCount = 0;
|
449 |
-
|
450 |
-
foreach ( $_POST['post'] as $key ) {
|
451 |
-
$noUpdateList .= $key.', ';
|
452 |
-
$noUpdateCount++;
|
453 |
-
}
|
454 |
-
|
455 |
-
$wpdb->query( " UPDATE $table_name SET onoroff = '$noUpdateList' WHERE name = 'notUpdateList' " );
|
456 |
-
echo '<div id="message" class="updated"><p><b>'.__('Succes', 'companion-auto-update').' –</b> '.sprintf( esc_html__( '%1$s plugins have been added to the no-update-list', 'companion-auto-update' ), $noUpdateCount ).'.</p></div>';
|
457 |
-
}
|
458 |
-
|
459 |
-
if( isset( $_POST['reset'] ) ) {
|
460 |
-
|
461 |
-
$wpdb->query( " UPDATE $table_name SET onoroff = '' WHERE name = 'notUpdateList' " );
|
462 |
-
echo '<div id="message" class="updated"><p><b>'.__('Succes', 'companion-auto-update').' –</b> '.__( 'The no-update-list has been reset, all plugins will be auto-updated from now on', 'companion-auto-update' ).'.</p></div>';
|
463 |
-
}
|
464 |
-
|
465 |
-
?>
|
466 |
-
|
467 |
-
<form method="POST">
|
468 |
-
|
469 |
-
<p>
|
470 |
-
<input type='submit' name='submit' id='submit' class='button button-primary' value='<?php _e( "Save changes", "companion-auto-update" ); ?>'>
|
471 |
-
<input type='submit' name='reset' id='reset' class='button button-alt' value='<?php _e( "Reset list", "companion-auto-update" ); ?>'>
|
472 |
-
</p>
|
473 |
-
|
474 |
-
<table class="wp-list-table widefat autoupdate striped plugins">
|
475 |
-
<thead>
|
476 |
-
<tr>
|
477 |
-
<td id='cb' class='manage-column column-cb check-column'> </td>
|
478 |
-
<th id='name' class='manage-column column-name column-primary'><strong><?php _e('Plugin', 'companion-auto-update'); ?></strong></th>
|
479 |
-
<th id='description' class='manage-column column-description'><strong><?php _e('Description', 'companion-auto-update'); ?></strong></th>
|
480 |
-
</tr>
|
481 |
-
</thead>
|
482 |
-
|
483 |
-
<tbody id="the-list">
|
484 |
-
|
485 |
-
<?php
|
486 |
-
|
487 |
-
foreach ( get_plugins() as $key => $value ) {
|
488 |
-
|
489 |
-
$slug = $key;
|
490 |
-
$actualSlug = array_shift( explode( '/', $slug ) );
|
491 |
-
$hash = explode( '/', $slug );
|
492 |
-
$slug_hash = md5( $slug[0] );
|
493 |
-
|
494 |
-
foreach ( $value as $k => $v ) {
|
495 |
-
|
496 |
-
if( $k == "Name" ) $name = $v;
|
497 |
-
if( $k == "Description" ) $description = $v;
|
498 |
-
|
499 |
-
}
|
500 |
-
|
501 |
-
if( in_array( $actualSlug, donotupdatelist() ) ) {
|
502 |
-
|
503 |
-
$class = 'inactive';
|
504 |
-
$checked = 'CHECKED';
|
505 |
-
$status = __( 'Auto-updating: disabled' , 'companion-auto-update' );
|
506 |
-
|
507 |
-
} else {
|
508 |
-
|
509 |
-
$class = 'active';
|
510 |
-
$checked = '';
|
511 |
-
$status = __( 'Auto-updating: enabled' , 'companion-auto-update' );
|
512 |
-
|
513 |
-
}
|
514 |
-
|
515 |
-
echo '<tr id="post-'.$slug_hash.'" class="'.$class.'">
|
516 |
-
|
517 |
-
<th scope="row" class="check-column">
|
518 |
-
<label class="screen-reader-text" for="cb-select-'.$slug_hash.'">Select '. $name .'</label>
|
519 |
-
<input id="cb-select-'.$slug_hash.'" type="checkbox" name="post[]" value="'.$actualSlug.'" '.$checked.' ><label></label>
|
520 |
-
<div class="locked-indicator"></div>
|
521 |
-
</th>
|
522 |
-
|
523 |
-
<td class="plugin-title column-primary">
|
524 |
-
<strong class="plugin-name">
|
525 |
-
'. $name .'
|
526 |
-
</strong>
|
527 |
-
<div class="row-actions visible status">
|
528 |
-
'. $status .'
|
529 |
-
</div>
|
530 |
-
</td>
|
531 |
-
|
532 |
-
<td class="column-description desc">
|
533 |
-
<div class="plugin-description">
|
534 |
-
<p>'.$description.'</p>
|
535 |
-
</div>
|
536 |
-
</td>
|
537 |
-
|
538 |
-
</tr>';
|
539 |
-
|
540 |
-
}
|
541 |
-
?>
|
542 |
-
|
543 |
-
</tbody>
|
544 |
-
</table>
|
545 |
-
|
546 |
-
<p>
|
547 |
-
<input type='submit' name='submit' id='submit' class='button button-primary' value='<?php _e( "Save changes", "companion-auto-update" ); ?>'>
|
548 |
-
<input type='submit' name='reset' id='reset' class='button button-alt' value='<?php _e( "Reset list", "companion-auto-update" ); ?>'>
|
549 |
-
</p>
|
550 |
-
|
551 |
-
</form>
|
552 |
-
|
553 |
-
<?php }
|
554 |
|
555 |
// Load admin styles
|
556 |
function load_cau_sytyles( $hook ) {
|
557 |
|
558 |
-
|
559 |
-
|
560 |
|
561 |
}
|
562 |
add_action( 'admin_enqueue_scripts', 'load_cau_sytyles' );
|
563 |
|
564 |
// Send e-mails
|
565 |
-
require_once('
|
566 |
|
567 |
// Add settings link on plugin page
|
568 |
function cau_settings_link( $links ) {
|
569 |
|
570 |
-
$settings_link
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
array_unshift( $links, $settings_link );
|
|
|
572 |
return $links;
|
573 |
|
574 |
}
|
575 |
$plugin = plugin_basename(__FILE__);
|
576 |
add_filter( "plugin_action_links_$plugin", "cau_settings_link" );
|
577 |
|
578 |
-
// Only update plugin which are enabled
|
579 |
-
function cau_dont_update( $update, $item ) {
|
580 |
-
|
581 |
-
$plugins = donotupdatelist();
|
582 |
-
|
583 |
-
if ( in_array( $item->slug, $plugins ) ) {
|
584 |
-
// Use the normal API response to decide whether to update or not
|
585 |
-
return $update;
|
586 |
-
} else {
|
587 |
-
// Always update plugins
|
588 |
-
return true;
|
589 |
-
}
|
590 |
-
|
591 |
-
}
|
592 |
-
|
593 |
// Auto Update Class
|
594 |
class CAU_auto_update {
|
595 |
|
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
|
25 |
// Install db
|
26 |
function cau_install() {
|
27 |
cau_database_creation(); // Db handle
|
28 |
+
if (! wp_next_scheduled ( 'cau_set_schedule_mail' )) wp_schedule_event( time(), 'daily', 'cau_set_schedule_mail'); //Set schedule
|
29 |
}
|
30 |
add_action('cau_set_schedule_mail', 'cau_check_updates_mail');
|
31 |
|
34 |
global $wpdb;
|
35 |
global $cau_db_version;
|
36 |
|
37 |
+
$cau_db_version = '1.4.4';
|
38 |
|
39 |
// Create db table
|
40 |
$table_name = $wpdb->prefix . "auto_updates";
|
122 |
}
|
123 |
add_action( 'plugins_loaded', 'cau_update_db_check' );
|
124 |
|
125 |
+
// Load custom functions
|
126 |
+
require_once( 'cau_functions.php' );
|
127 |
+
|
128 |
// Add plugin to menu
|
129 |
function register_cau_menu_page() {
|
130 |
+
add_submenu_page( cau_menloc() , __('Auto Updater', 'companion-auto-update'), __('Auto Updater', 'companion-auto-update'), 'manage_options', 'cau-settings', 'cau_frontend' );
|
131 |
}
|
132 |
add_action( 'admin_menu', 'register_cau_menu_page' );
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
// Settings page
|
135 |
function cau_frontend() { ?>
|
136 |
|
145 |
<hr class="wp-header-end">
|
146 |
|
147 |
<h2 class="nav-tab-wrapper wp-clearfix">
|
148 |
+
<a href="<?php echo cau_menloc(); ?>?page=cau-settings" class="nav-tab <?php active_tab(''); ?>"><?php _e('Dashboard', 'companion-auto-update'); ?></a>
|
149 |
+
<a href="<?php echo cau_menloc(); ?>?page=cau-settings&tab=pluginlist" class="nav-tab <?php active_tab('pluginlist'); ?>"><?php _e('Filter plugins', 'companion-auto-update'); ?></a>
|
150 |
+
<a href="<?php echo cau_menloc(); ?>?page=cau-settings&tab=schedule" class="nav-tab <?php active_tab('schedule'); ?>"><?php _e('Scheduling', 'companion-auto-update'); ?></a>
|
151 |
+
<a href="<?php echo cau_menloc(); ?>?page=cau-settings&tab=log" class="nav-tab <?php active_tab('log'); ?>"><?php _e('Update log', 'companion-auto-update'); ?></a>
|
152 |
</h2>
|
153 |
|
154 |
<?php
|
155 |
|
156 |
if( !isset( $_GET['tab'] ) ) {
|
157 |
|
158 |
+
require_once( 'admin/dashboard.php' );
|
159 |
|
160 |
+
} else {
|
|
|
161 |
|
162 |
+
require_once( 'admin/'.$_GET['tab'].'.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
+
} ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
</div>
|
167 |
|
168 |
<?php }
|
169 |
|
170 |
+
// Add a widget to the dashboard.
|
171 |
+
function cau_add_widget() {
|
172 |
+
if ( current_user_can( 'manage_options' ) ) wp_add_dashboard_widget( 'cau-update-log', __('Update log', 'companion-auto-update'), 'cau_widget' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
}
|
174 |
+
add_action( 'wp_dashboard_setup', 'cau_add_widget' );
|
175 |
+
|
176 |
+
function cau_widget() {
|
177 |
+
|
178 |
+
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>';
|
179 |
+
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>';
|
180 |
+
cau_fetch_log( '7' );
|
181 |
+
echo '<p>
|
182 |
+
<a href="'.get_admin_url().''.cau_menloc().'?page=cau-settings&tab=log">'.__('View full changelog', 'companion-auto-update').'</a>
|
183 |
+
<span class="cau_divide">|</span>
|
184 |
+
<a href="'.get_admin_url().''.cau_menloc().'?page=cau-settings">'.__('Configure auto updating', 'companion-auto-update').'</a>
|
185 |
+
</p>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
187 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
|
189 |
// Load admin styles
|
190 |
function load_cau_sytyles( $hook ) {
|
191 |
|
192 |
+
if( $hook != 'tools_page_cau-settings' && $hook != 'index_page_cau-settings' ) return;
|
193 |
+
wp_enqueue_style( 'cau_admin_styles', plugins_url( 'backend/style.css' , __FILE__ ) );
|
194 |
|
195 |
}
|
196 |
add_action( 'admin_enqueue_scripts', 'load_cau_sytyles' );
|
197 |
|
198 |
// Send e-mails
|
199 |
+
require_once( 'cau_emails.php' );
|
200 |
|
201 |
// Add settings link on plugin page
|
202 |
function cau_settings_link( $links ) {
|
203 |
|
204 |
+
$settings_link = '<a href="'.get_admin_url().''.cau_menloc().'?page=cau-settings">'.__('Settings', 'companion-auto-update' ).'</a>';
|
205 |
+
$settings_link2 = '<a href="https://translate.wordpress.org/projects/wp-plugins/companion-auto-update">'.__('Translate', 'companion-auto-update' ).'</a>';
|
206 |
+
$settings_link3 = '<a href="https://www.paypal.me/dakel/1/">'.__('Donate', 'companion-auto-update' ).'</a>';
|
207 |
+
$settings_link4 = '<a href="http://codeermeneer.nl/cau_poll/">'.__('Feedback', 'companion-auto-update' ).'</a>';
|
208 |
+
|
209 |
+
array_unshift( $links, $settings_link2 );
|
210 |
+
array_unshift( $links, $settings_link3 );
|
211 |
+
array_unshift( $links, $settings_link4 );
|
212 |
array_unshift( $links, $settings_link );
|
213 |
+
|
214 |
return $links;
|
215 |
|
216 |
}
|
217 |
$plugin = plugin_basename(__FILE__);
|
218 |
add_filter( "plugin_action_links_$plugin", "cau_settings_link" );
|
219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
// Auto Update Class
|
221 |
class CAU_auto_update {
|
222 |
|
readme.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
=== Companion Auto Update ===
|
2 |
Contributors: Papin, qweb
|
3 |
-
Donate link: https://www.paypal.me/dakel/
|
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
|
@@ -18,24 +18,18 @@ This plugin enables background auto-updating for all plugins, all themes and the
|
|
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 |
= Available settings =
|
21 |
-
|
22 |
-
1. Enable/disable updates for themes (Enabled by default).
|
23 |
-
1. Enable/disable updates for minor WordPress updates (Enabled by default).
|
24 |
-
1. Enable/disable updates for major WordPress updates (Enabled by default).
|
25 |
-
1. Enable/disable updates for translation files (Enabled by default).
|
26 |
|
27 |
-
=
|
28 |
-
|
29 |
-
|
30 |
-
1. Core Emails: By default wordpress sends an email when a core update happend, you can now disable this.
|
31 |
|
32 |
= Advanced Controls =
|
33 |
You can control auto-updating per plugin via the plugin filter.
|
34 |
For example: If you have Woocommerce installed but you do not wan't to have it auto-updated you can now disable auto-updating for Woocommerce only, so your other plugins will continue to be updated.
|
35 |
|
36 |
= Scheduling =
|
37 |
-
|
38 |
-
The same settings can be changed for notifications.
|
39 |
|
40 |
== Installation ==
|
41 |
|
@@ -60,7 +54,7 @@ You can find the settings under Tools > Auto updating
|
|
60 |
|
61 |
= How often does this plugin check for updates? =
|
62 |
|
63 |
-
|
64 |
|
65 |
= Can I change how often it checks and/or updates? =
|
66 |
|
@@ -71,17 +65,24 @@ Yes you can. Go to the dashboard > Scheduling
|
|
71 |
Yes. You can control auto-updating per plugin via the plugin filter.
|
72 |
|
73 |
= I'm using cPanel and auto-updating doens't work =
|
|
|
74 |
If you launched your website a few years ago using cPanel it could be the case that auto-updating is broken. We've contacted cPanel and they said to remove the "AUTOMATIC_UPDATER_DISABLED" line from your wp-config file.
|
75 |
|
76 |
== Screenshots ==
|
77 |
|
78 |
-
1.
|
79 |
-
2.
|
80 |
-
3.
|
|
|
81 |
|
82 |
== Changelog ==
|
83 |
|
84 |
-
=
|
|
|
|
|
|
|
|
|
|
|
85 |
* Added buttons to help development of this plugin.
|
86 |
|
87 |
= 2.9.5 (6/22/2017) =
|
1 |
=== Companion Auto Update ===
|
2 |
Contributors: Papin, qweb
|
3 |
+
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
|
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 |
= Available settings =
|
21 |
+
Full control, that's what this plugin is all about. We offer settings to enable or disable automatic updating for plugins, themes, wordpress core updates (both minor and major can be changed separately) and for translation files.
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
= Know what's happening =
|
24 |
+
We want you to know what's happening on your website. This plugin offers settings for various email notifications. We can send you an email when an update is available, when a plugin has been updated or when wordpress has been updated.
|
25 |
+
But if you don't want to recieve emails about this you can still log in and view the changelog to see what happened.
|
|
|
26 |
|
27 |
= Advanced Controls =
|
28 |
You can control auto-updating per plugin via the plugin filter.
|
29 |
For example: If you have Woocommerce installed but you do not wan't to have it auto-updated you can now disable auto-updating for Woocommerce only, so your other plugins will continue to be updated.
|
30 |
|
31 |
= Scheduling =
|
32 |
+
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, this way you can make sure that it will not overload your server by letting it run at times with less activity. The same settings can be set for notifications.
|
|
|
33 |
|
34 |
== Installation ==
|
35 |
|
54 |
|
55 |
= How often does this plugin check for updates? =
|
56 |
|
57 |
+
y 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 |
|
65 |
Yes. You can control auto-updating per plugin via the plugin filter.
|
66 |
|
67 |
= I'm using cPanel and auto-updating doens't work =
|
68 |
+
|
69 |
If you launched your website a few years ago using cPanel it could be the case that auto-updating is broken. We've contacted cPanel and they said to remove the "AUTOMATIC_UPDATER_DISABLED" line from your wp-config file.
|
70 |
|
71 |
== Screenshots ==
|
72 |
|
73 |
+
1. Full control over what to update and when to recieve notifications
|
74 |
+
2. Disable auto-updating for certain plugins
|
75 |
+
3. Advanced scheduling options for updating and notifcations
|
76 |
+
4. Keep track of updates with the update log
|
77 |
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 3.0 (February 10, 2018) =
|
81 |
+
* New: Set the update time, many requested this feature so here it is :)
|
82 |
+
* New: Update log
|
83 |
+
* Fixed issue where multiple emailaddresses wouldn't work.
|
84 |
+
|
85 |
+
= 2.9.6 (7/11/2017) =
|
86 |
* Added buttons to help development of this plugin.
|
87 |
|
88 |
= 2.9.5 (6/22/2017) =
|