Advanced Automatic Updates - Version 0.2

Version Description

  • ADDED: Some useful filters and actions. See the Documentation for details
  • FIXED: s/automattic/automatic/g
  • FIXED: Support forums link
Download this release

Release Info

Developer pento
Plugin Icon wp plugin Advanced Automatic Updates
Version 0.2
Comparing to
See all releases

Code changes from version 0.1 to 0.2

Files changed (3) hide show
  1. admin.php +5 -5
  2. automatic-updater.php +28 -15
  3. readme.txt +35 -2
admin.php CHANGED
@@ -19,14 +19,14 @@ function auto_updater_settings_loader() {
19
  get_current_screen()->set_help_sidebar(
20
  '<p><strong>' . sprintf( __( 'A Plugin By <a href="%s" target="_blank">Gary</a>', 'automatic-updater' ), 'http://pento.net/' ) . '</strong></p>' .
21
  '<p><a href="http://pento.net/donate/">' . __( 'Donations', 'automatic-updater' ) . '</a></p>' .
22
- '<p><a href="">' . __( 'Support Forums', 'automatic-updater' ) . '</a></p>'
23
  );
24
  }
25
 
26
  function auto_updater_settings() {
27
  if ( ! current_user_can( 'update_core' ) )
28
  wp_die( __( 'You do not have sufficient permissions to access this page.', 'automatic-updater' ) );
29
-
30
  $message = '';
31
  if ( ! empty( $_REQUEST['submit'] ) ) {
32
  check_admin_referer( 'automatic-updater-settings' );
@@ -43,7 +43,7 @@ function auto_updater_settings() {
43
  ?>
44
  <div class="wrap">
45
  <?php screen_icon('tools'); ?>
46
- <h2><?php _e( 'Automattic Updater', 'automatic-updater' ); ?></h2>
47
  <?php
48
  if ( ! empty( $message ) ) {
49
  ?>
@@ -73,13 +73,13 @@ function auto_updater_settings() {
73
  function auto_updater_save_settings() {
74
  $types = array( 'core', 'plugins', 'themes' );
75
  $options = get_option( 'automatic-updater' );
76
-
77
  foreach ( $types as $type ) {
78
  if ( ! empty( $_REQUEST[$type] ) )
79
  $options['update'][$type] = true;
80
  else
81
  $options['update'][$type] = false;
82
  }
83
-
84
  update_option( 'automatic-updater', $options );
85
  }
19
  get_current_screen()->set_help_sidebar(
20
  '<p><strong>' . sprintf( __( 'A Plugin By <a href="%s" target="_blank">Gary</a>', 'automatic-updater' ), 'http://pento.net/' ) . '</strong></p>' .
21
  '<p><a href="http://pento.net/donate/">' . __( 'Donations', 'automatic-updater' ) . '</a></p>' .
22
+ '<p><a href="http://wordpress.org/support/plugin/automatic-updater">' . __( 'Support Forums', 'automatic-updater' ) . '</a></p>'
23
  );
24
  }
25
 
26
  function auto_updater_settings() {
27
  if ( ! current_user_can( 'update_core' ) )
28
  wp_die( __( 'You do not have sufficient permissions to access this page.', 'automatic-updater' ) );
29
+
30
  $message = '';
31
  if ( ! empty( $_REQUEST['submit'] ) ) {
32
  check_admin_referer( 'automatic-updater-settings' );
43
  ?>
44
  <div class="wrap">
45
  <?php screen_icon('tools'); ?>
46
+ <h2><?php _e( 'Automatic Updater', 'automatic-updater' ); ?></h2>
47
  <?php
48
  if ( ! empty( $message ) ) {
49
  ?>
73
  function auto_updater_save_settings() {
74
  $types = array( 'core', 'plugins', 'themes' );
75
  $options = get_option( 'automatic-updater' );
76
+
77
  foreach ( $types as $type ) {
78
  if ( ! empty( $_REQUEST[$type] ) )
79
  $options['update'][$type] = true;
80
  else
81
  $options['update'][$type] = false;
82
  }
83
+
84
  update_option( 'automatic-updater', $options );
85
  }
automatic-updater.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://pento.net/
5
  * Description: Automatically update your WordPress site, as soon as updates are released! Never worry about falling behing on updating again!
6
  * Author: pento
7
- * Version: 0.1
8
  * Author URI: http://pento.net
9
  * License: GPL2+
10
  * Text Domain: automatic-updater
@@ -21,8 +21,8 @@ function auto_updater_init() {
21
  $options = get_option( 'automatic-updater', array() );
22
 
23
  if ( empty( $options ) ) {
24
- $options = array(
25
- 'update' => array(
26
  'core' => true,
27
  'plugins' => false,
28
  'themes' => false,
@@ -64,27 +64,31 @@ function auto_updater_core() {
64
  // It's behind a DOING_CRON check, so won't cause much trouble.
65
  include_once( ABSPATH . 'wp-admin/includes/update.php' );
66
  include_once( ABSPATH . 'wp-admin/includes/file.php' );
67
-
68
  include_once( dirname( __FILE__ ) . '/updater-skin.php' );
69
 
70
  $updates = get_core_updates();
71
  if ( empty( $updates ) )
72
  return;
73
 
74
- $update = find_core_update( $updates[0]->current, $updates[0]->locale );
75
  if ( empty( $update ) )
76
  return;
77
 
78
  $auto_updater_running = true;
79
 
 
 
80
  $skin = new Auto_Updater_Skin();
81
  $upgrader = new Core_Upgrader( $skin );
82
  $upgrader->upgrade( $update );
83
-
 
 
84
  $message = join( "\r\n", $skin->messages );
85
-
86
  wp_mail( get_option( 'admin_email' ), __( 'Core Update', 'automatic-updater' ), $message );
87
-
88
  wp_version_check();
89
  }
90
 
@@ -95,23 +99,27 @@ function auto_updater_plugins() {
95
 
96
  include_once( ABSPATH . 'wp-admin/includes/update.php' );
97
  include_once( ABSPATH . 'wp-admin/includes/file.php' );
98
-
99
  include_once( dirname( __FILE__ ) . '/updater-skin.php' );
100
 
101
- $plugins = array_keys( get_plugin_updates() );
102
  if ( empty( $plugins ) )
103
  return;
104
 
105
  $auto_updater_running = true;
106
 
 
 
107
  $skin = new Auto_Updater_Skin();
108
  $upgrader = new Plugin_Upgrader( $skin );
109
  $upgrader->bulk_upgrade( $plugins );
110
 
 
 
111
  $message = join( "\r\n", $skin->messages );
112
-
113
  wp_mail( get_option( 'admin_email' ), __( 'Plugin Update', 'automatic-updater' ), $message );
114
-
115
  wp_update_plugins();
116
  }
117
 
@@ -122,22 +130,27 @@ function auto_updater_themes() {
122
 
123
  include_once( ABSPATH . 'wp-admin/includes/update.php' );
124
  include_once( ABSPATH . 'wp-admin/includes/file.php' );
125
-
126
  include_once( dirname( __FILE__ ) . '/updater-skin.php' );
127
 
128
- $themes = array_keys( get_theme_updates() );
129
  if ( empty( $themes ) )
130
  return;
131
 
132
  $auto_updater_running = true;
133
 
 
 
134
  $skin = new Auto_Updater_Skin();
135
  $upgrader = new Theme_Upgrader( $skin );
136
  $upgrader->bulk_upgrade( $themes );
137
 
 
 
138
  $message = join( "\r\n", $skin->messages );
139
-
140
  wp_mail( get_option( 'admin_email' ), __( 'Theme Update', 'automatic-updater' ), $message );
141
 
142
  wp_update_themes();
143
  }
 
4
  * Plugin URI: http://pento.net/
5
  * Description: Automatically update your WordPress site, as soon as updates are released! Never worry about falling behing on updating again!
6
  * Author: pento
7
+ * Version: 0.2
8
  * Author URI: http://pento.net
9
  * License: GPL2+
10
  * Text Domain: automatic-updater
21
  $options = get_option( 'automatic-updater', array() );
22
 
23
  if ( empty( $options ) ) {
24
+ $options = array(
25
+ 'update' => array(
26
  'core' => true,
27
  'plugins' => false,
28
  'themes' => false,
64
  // It's behind a DOING_CRON check, so won't cause much trouble.
65
  include_once( ABSPATH . 'wp-admin/includes/update.php' );
66
  include_once( ABSPATH . 'wp-admin/includes/file.php' );
67
+
68
  include_once( dirname( __FILE__ ) . '/updater-skin.php' );
69
 
70
  $updates = get_core_updates();
71
  if ( empty( $updates ) )
72
  return;
73
 
74
+ $update = apply_filters( 'auto_updater_core_updates', find_core_update( $updates[0]->current, $updates[0]->locale ) );
75
  if ( empty( $update ) )
76
  return;
77
 
78
  $auto_updater_running = true;
79
 
80
+ do_action( 'auto_updater_before_update', 'core' );
81
+
82
  $skin = new Auto_Updater_Skin();
83
  $upgrader = new Core_Upgrader( $skin );
84
  $upgrader->upgrade( $update );
85
+
86
+ do_action( 'auto_updater_after_update', 'core' );
87
+
88
  $message = join( "\r\n", $skin->messages );
89
+
90
  wp_mail( get_option( 'admin_email' ), __( 'Core Update', 'automatic-updater' ), $message );
91
+
92
  wp_version_check();
93
  }
94
 
99
 
100
  include_once( ABSPATH . 'wp-admin/includes/update.php' );
101
  include_once( ABSPATH . 'wp-admin/includes/file.php' );
102
+
103
  include_once( dirname( __FILE__ ) . '/updater-skin.php' );
104
 
105
+ $plugins = apply_filters( 'auto_updater_plugin_updates', array_keys( get_plugin_updates() ) );
106
  if ( empty( $plugins ) )
107
  return;
108
 
109
  $auto_updater_running = true;
110
 
111
+ do_action( 'auto_updater_before_update', 'plugins' );
112
+
113
  $skin = new Auto_Updater_Skin();
114
  $upgrader = new Plugin_Upgrader( $skin );
115
  $upgrader->bulk_upgrade( $plugins );
116
 
117
+ do_action( 'auto_updater_after_update', 'plugins' );
118
+
119
  $message = join( "\r\n", $skin->messages );
120
+
121
  wp_mail( get_option( 'admin_email' ), __( 'Plugin Update', 'automatic-updater' ), $message );
122
+
123
  wp_update_plugins();
124
  }
125
 
130
 
131
  include_once( ABSPATH . 'wp-admin/includes/update.php' );
132
  include_once( ABSPATH . 'wp-admin/includes/file.php' );
133
+
134
  include_once( dirname( __FILE__ ) . '/updater-skin.php' );
135
 
136
+ $themes = apply_filters( 'auto_updater_theme_updates', array_keys( get_theme_updates() ) );
137
  if ( empty( $themes ) )
138
  return;
139
 
140
  $auto_updater_running = true;
141
 
142
+ do_action( 'auto_updater_before_update', 'themes' );
143
+
144
  $skin = new Auto_Updater_Skin();
145
  $upgrader = new Theme_Upgrader( $skin );
146
  $upgrader->bulk_upgrade( $themes );
147
 
148
+ do_action( 'auto_updater_after_update', 'themes' );
149
+
150
  $message = join( "\r\n", $skin->messages );
151
+
152
  wp_mail( get_option( 'admin_email' ), __( 'Theme Update', 'automatic-updater' ), $message );
153
 
154
  wp_update_themes();
155
  }
156
+
readme.txt CHANGED
@@ -1,9 +1,10 @@
1
  === Automatic Updater ===
2
  Contributors: pento
 
3
  Tags: updates, core, plugins, themes
4
- Requires at least: 3.1
5
  Tested up to: 3.5
6
- Stable tag: 0.1
7
 
8
  Automatically update WordPress, your themes and plugins! Never have to click the update button again!
9
 
@@ -14,3 +15,35 @@ Automatic Updater keeps your WordPress install up to date with the latest releas
14
  While this will be useful for the vast majority of sites, please exercise caution, particularly if you have any custom themes or plugins running on your site.
15
 
16
  You should also be aware that this will only work on WordPress installs that have the appropriate file permissions to update through the web interface - it will not work if you usually FTP updates to your server.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  === Automatic Updater ===
2
  Contributors: pento
3
+ Donate link: http://pento.net/donate/
4
  Tags: updates, core, plugins, themes
5
+ Requires at least: 3.3
6
  Tested up to: 3.5
7
+ Stable tag: 0.2
8
 
9
  Automatically update WordPress, your themes and plugins! Never have to click the update button again!
10
 
15
  While this will be useful for the vast majority of sites, please exercise caution, particularly if you have any custom themes or plugins running on your site.
16
 
17
  You should also be aware that this will only work on WordPress installs that have the appropriate file permissions to update through the web interface - it will not work if you usually FTP updates to your server.
18
+
19
+ There are some Actions and Filters provided, check the [Documentation](http://pento.net/projects/automatic-updater-for-wordpress/) for more details.
20
+
21
+ == Installation ==
22
+
23
+ = The Good Way =
24
+
25
+ 1. In your WordPress Admin, go to the Add New Plugins page
26
+ 1. Search for: automatic updater
27
+ 1. Automatic Updater should be the first result. Click the Install link.
28
+
29
+ = The Old Way =
30
+
31
+ 1. Upload the plugin to the `/wp-content/plugins/` directory
32
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
33
+
34
+ = The Living-On-The-Edge Way =
35
+
36
+ (Please don't do this in production, you will almost certainly break something!)
37
+
38
+ 1. Checkout the current development version from http://plugins.svn.wordpress.org/automatic-updater/trunk/
39
+ 1. Subscribe to the [RSS feed](http://plugins.trac.wordpress.org/log/automatic-updater?limit=100&mode=stop_on_copy&format=rss) to be notified of changes
40
+
41
+ == Changelog ==
42
+
43
+ = 0.2 =
44
+ * ADDED: Some useful filters and actions. See the [Documentation](http://pento.net/projects/automatic-updater-for-wordpress/) for details
45
+ * FIXED: s/automattic/automatic/g
46
+ * FIXED: Support forums link
47
+
48
+ = 0.1 =
49
+ * Initial release