]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/update.php
WordPress 3.8.3-scripts
[autoinstalls/wordpress.git] / wp-includes / update.php
1 <?php
2 /**
3  * A simple set of functions to check our version 1.0 update service.
4  *
5  * @package WordPress
6  * @since 2.3.0
7  */
8
9 /**
10  * Check WordPress version against the newest version.
11  *
12  * The WordPress version, PHP version, and Locale is sent. Checks against the
13  * WordPress server at api.wordpress.org server. Will only check if WordPress
14  * isn't installing.
15  *
16  * @package WordPress
17  * @since 2.3.0
18  * @uses $wp_version Used to check against the newest WordPress version.
19  *
20  * @param array $extra_stats Extra statistics to report to the WordPress.org API.
21  * @param bool $force_check Whether to bypass the transient cache and force a fresh update check. Defaults to false, true if $extra_stats is set.
22  * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
23  */
24 function wp_version_check( $extra_stats = array(), $force_check = false ) {
25         if ( defined('WP_INSTALLING') )
26                 return;
27
28         global $wpdb, $wp_local_package;
29         include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
30         $php_version = phpversion();
31
32         $current = get_site_transient( 'update_core' );
33         $translations = wp_get_installed_translations( 'core' );
34
35         // Invalidate the transient when $wp_version changes
36         if ( is_object( $current ) && $wp_version != $current->version_checked )
37                 $current = false;
38
39         if ( ! is_object($current) ) {
40                 $current = new stdClass;
41                 $current->updates = array();
42                 $current->version_checked = $wp_version;
43         }
44
45         if ( ! empty( $extra_stats ) )
46                 $force_check = true;
47
48         // Wait 60 seconds between multiple version check requests
49         $timeout = 60;
50         $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
51         if ( ! $force_check && $time_not_changed )
52                 return false;
53
54         $locale = get_locale();
55         /**
56          * Filter the locale requested for WordPress core translations.
57          *
58          * @since 2.8.0
59          *
60          * @param string $locale Current locale.
61          */
62         $locale = apply_filters( 'core_version_check_locale', $locale );
63
64         // Update last_checked for current to prevent multiple blocking requests if request hangs
65         $current->last_checked = time();
66         set_site_transient( 'update_core', $current );
67
68         if ( method_exists( $wpdb, 'db_version' ) )
69                 $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version());
70         else
71                 $mysql_version = 'N/A';
72
73         if ( is_multisite() ) {
74                 $user_count = get_user_count();
75                 $num_blogs = get_blog_count();
76                 $wp_install = network_site_url();
77                 $multisite_enabled = 1;
78         } else {
79                 $user_count = count_users();
80                 $user_count = $user_count['total_users'];
81                 $multisite_enabled = 0;
82                 $num_blogs = 1;
83                 $wp_install = home_url( '/' );
84         }
85
86         $query = array(
87                 'version'           => $wp_version,
88                 'php'               => $php_version,
89                 'locale'            => $locale,
90                 'mysql'             => $mysql_version,
91                 'local_package'     => isset( $wp_local_package ) ? $wp_local_package : '',
92                 'blogs'             => $num_blogs,
93                 'users'             => $user_count,
94                 'multisite_enabled' => $multisite_enabled,
95         );
96
97         $post_body = array(
98                 'translations' => json_encode( $translations ),
99         );
100
101         if ( is_array( $extra_stats ) )
102                 $post_body = array_merge( $post_body, $extra_stats );
103
104         $url = $http_url = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query( $query, null, '&' );
105         if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
106                 $url = set_url_scheme( $url, 'https' );
107
108         $options = array(
109                 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
110                 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
111                 'headers' => array(
112                         'wp_install' => $wp_install,
113                         'wp_blog' => home_url( '/' )
114                 ),
115                 'body' => $post_body,
116         );
117
118         $response = wp_remote_post( $url, $options );
119         if ( $ssl && is_wp_error( $response ) ) {
120                 trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ) . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
121                 $response = wp_remote_post( $http_url, $options );
122         }
123
124         if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
125                 return false;
126
127         $body = trim( wp_remote_retrieve_body( $response ) );
128         $body = json_decode( $body, true );
129
130         if ( ! is_array( $body ) || ! isset( $body['offers'] ) )
131                 return false;
132
133         $offers = $body['offers'];
134
135         foreach ( $offers as &$offer ) {
136                 foreach ( $offer as $offer_key => $value ) {
137                         if ( 'packages' == $offer_key )
138                                 $offer['packages'] = (object) array_intersect_key( array_map( 'esc_url', $offer['packages'] ),
139                                         array_fill_keys( array( 'full', 'no_content', 'new_bundled', 'partial', 'rollback' ), '' ) );
140                         elseif ( 'download' == $offer_key )
141                                 $offer['download'] = esc_url( $value );
142                         else
143                                 $offer[ $offer_key ] = esc_html( $value );
144                 }
145                 $offer = (object) array_intersect_key( $offer, array_fill_keys( array( 'response', 'download', 'locale',
146                         'packages', 'current', 'version', 'php_version', 'mysql_version', 'new_bundled', 'partial_version', 'notify_email' ), '' ) );
147         }
148
149         $updates = new stdClass();
150         $updates->updates = $offers;
151         $updates->last_checked = time();
152         $updates->version_checked = $wp_version;
153
154         if ( isset( $body['translations'] ) )
155                 $updates->translations = $body['translations'];
156
157         set_site_transient( 'update_core',  $updates);
158 }
159
160 /**
161  * Check plugin versions against the latest versions hosted on WordPress.org.
162  *
163  * The WordPress version, PHP version, and Locale is sent along with a list of
164  * all plugins installed. Checks against the WordPress server at
165  * api.wordpress.org. Will only check if WordPress isn't installing.
166  *
167  * @package WordPress
168  * @since 2.3.0
169  * @uses $wp_version Used to notify the WordPress version.
170  *
171  * @param array $extra_stats Extra statistics to report to the WordPress.org API.
172  * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
173  */
174 function wp_update_plugins( $extra_stats = array() ) {
175         include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
176
177         if ( defined('WP_INSTALLING') )
178                 return false;
179
180         // If running blog-side, bail unless we've not checked in the last 12 hours
181         if ( !function_exists( 'get_plugins' ) )
182                 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
183
184         $plugins = get_plugins();
185         $translations = wp_get_installed_translations( 'plugins' );
186
187         $active  = get_option( 'active_plugins', array() );
188         $current = get_site_transient( 'update_plugins' );
189         if ( ! is_object($current) )
190                 $current = new stdClass;
191
192         $new_option = new stdClass;
193         $new_option->last_checked = time();
194
195         // Check for update on a different schedule, depending on the page.
196         switch ( current_filter() ) {
197                 case 'upgrader_process_complete' :
198                         $timeout = 0;
199                         break;
200                 case 'load-update-core.php' :
201                         $timeout = MINUTE_IN_SECONDS;
202                         break;
203                 case 'load-plugins.php' :
204                 case 'load-update.php' :
205                         $timeout = HOUR_IN_SECONDS;
206                         break;
207                 default :
208                         $timeout = 12 * HOUR_IN_SECONDS;
209         }
210
211         $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
212
213         if ( $time_not_changed && ! $extra_stats ) {
214                 $plugin_changed = false;
215                 foreach ( $plugins as $file => $p ) {
216                         $new_option->checked[ $file ] = $p['Version'];
217
218                         if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) )
219                                 $plugin_changed = true;
220                 }
221
222                 if ( isset ( $current->response ) && is_array( $current->response ) ) {
223                         foreach ( $current->response as $plugin_file => $update_details ) {
224                                 if ( ! isset($plugins[ $plugin_file ]) ) {
225                                         $plugin_changed = true;
226                                         break;
227                                 }
228                         }
229                 }
230
231                 // Bail if we've checked recently and if nothing has changed
232                 if ( ! $plugin_changed )
233                         return false;
234         }
235
236         // Update last_checked for current to prevent multiple blocking requests if request hangs
237         $current->last_checked = time();
238         set_site_transient( 'update_plugins', $current );
239
240         $to_send = compact( 'plugins', 'active' );
241
242         $locales = array( get_locale() );
243         /**
244          * Filter the locales requested for plugin translations.
245          *
246          * @since 3.7.0
247          *
248          * @param array $locales Plugin locale. Default is current locale of the site.
249          */
250         $locales = apply_filters( 'plugins_update_check_locales', $locales );
251
252         $options = array(
253                 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
254                 'body' => array(
255                         'plugins'      => json_encode( $to_send ),
256                         'translations' => json_encode( $translations ),
257                         'locale'       => json_encode( $locales ),
258                 ),
259                 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
260         );
261
262         if ( $extra_stats ) {
263                 $options['body']['update_stats'] = json_encode( $extra_stats );
264         }
265
266         $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
267         if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
268                 $url = set_url_scheme( $url, 'https' );
269
270         $raw_response = wp_remote_post( $url, $options );
271         if ( $ssl && is_wp_error( $raw_response ) ) {
272                 trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ) . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
273                 $raw_response = wp_remote_post( $http_url, $options );
274         }
275
276         if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) )
277                 return false;
278
279         $response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
280         foreach ( $response['plugins'] as &$plugin ) {
281                 $plugin = (object) $plugin;
282         }
283         unset( $plugin );
284
285         if ( is_array( $response ) ) {
286                 $new_option->response = $response['plugins'];
287                 $new_option->translations = $response['translations'];
288         } else {
289                 $new_option->response = array();
290                 $new_option->translations = array();
291         }
292
293         set_site_transient( 'update_plugins', $new_option );
294 }
295
296 /**
297  * Check theme versions against the latest versions hosted on WordPress.org.
298  *
299  * A list of all themes installed in sent to WP. Checks against the
300  * WordPress server at api.wordpress.org. Will only check if WordPress isn't
301  * installing.
302  *
303  * @package WordPress
304  * @since 2.7.0
305  * @uses $wp_version Used to notify the WordPress version.
306  *
307  * @param array $extra_stats Extra statistics to report to the WordPress.org API.
308  * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
309  */
310 function wp_update_themes( $extra_stats = array() ) {
311         include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
312
313         if ( defined( 'WP_INSTALLING' ) )
314                 return false;
315
316         $installed_themes = wp_get_themes();
317         $translations = wp_get_installed_translations( 'themes' );
318
319         $last_update = get_site_transient( 'update_themes' );
320         if ( ! is_object($last_update) )
321                 $last_update = new stdClass;
322
323         $themes = $checked = $request = array();
324
325         // Put slug of current theme into request.
326         $request['active'] = get_option( 'stylesheet' );
327
328         foreach ( $installed_themes as $theme ) {
329                 $checked[ $theme->get_stylesheet() ] = $theme->get('Version');
330
331                 $themes[ $theme->get_stylesheet() ] = array(
332                         'Name'       => $theme->get('Name'),
333                         'Title'      => $theme->get('Name'),
334                         'Version'    => $theme->get('Version'),
335                         'Author'     => $theme->get('Author'),
336                         'Author URI' => $theme->get('AuthorURI'),
337                         'Template'   => $theme->get_template(),
338                         'Stylesheet' => $theme->get_stylesheet(),
339                 );
340         }
341
342         // Check for update on a different schedule, depending on the page.
343         switch ( current_filter() ) {
344                 case 'upgrader_process_complete' :
345                         $timeout = 0;
346                         break;
347                 case 'load-update-core.php' :
348                         $timeout = MINUTE_IN_SECONDS;
349                         break;
350                 case 'load-themes.php' :
351                 case 'load-update.php' :
352                         $timeout = HOUR_IN_SECONDS;
353                         break;
354                 default :
355                         $timeout = 12 * HOUR_IN_SECONDS;
356         }
357
358         $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked );
359
360         if ( $time_not_changed && ! $extra_stats ) {
361                 $theme_changed = false;
362                 foreach ( $checked as $slug => $v ) {
363                         if ( !isset( $last_update->checked[ $slug ] ) || strval($last_update->checked[ $slug ]) !== strval($v) )
364                                 $theme_changed = true;
365                 }
366
367                 if ( isset ( $last_update->response ) && is_array( $last_update->response ) ) {
368                         foreach ( $last_update->response as $slug => $update_details ) {
369                                 if ( ! isset($checked[ $slug ]) ) {
370                                         $theme_changed = true;
371                                         break;
372                                 }
373                         }
374                 }
375
376                 // Bail if we've checked recently and if nothing has changed
377                 if ( ! $theme_changed )
378                         return false;
379         }
380
381         // Update last_checked for current to prevent multiple blocking requests if request hangs
382         $last_update->last_checked = time();
383         set_site_transient( 'update_themes', $last_update );
384
385         $request['themes'] = $themes;
386
387         $locales = array( get_locale() );
388         /**
389          * Filter the locales requested for theme translations.
390          *
391          * @since 3.7.0
392          *
393          * @param array $locales Theme locale. Default is current locale of the site.
394          */
395         $locales = apply_filters( 'themes_update_check_locales', $locales );
396
397         $options = array(
398                 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
399                 'body' => array(
400                         'themes'       => json_encode( $request ),
401                         'translations' => json_encode( $translations ),
402                         'locale'       => json_encode( $locales ),
403                 ),
404                 'user-agent'    => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
405         );
406
407         if ( $extra_stats ) {
408                 $options['body']['update_stats'] = json_encode( $extra_stats );
409         }
410
411         $url = $http_url = 'http://api.wordpress.org/themes/update-check/1.1/';
412         if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
413                 $url = set_url_scheme( $url, 'https' );
414
415         $raw_response = wp_remote_post( $url, $options );
416         if ( $ssl && is_wp_error( $raw_response ) ) {
417                 trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ) . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
418                 $raw_response = wp_remote_post( $http_url, $options );
419         }
420
421         if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) )
422                 return false;
423
424         $new_update = new stdClass;
425         $new_update->last_checked = time();
426         $new_update->checked = $checked;
427
428         $response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
429
430         if ( is_array( $response ) ) {
431                 $new_update->response     = $response['themes'];
432                 $new_update->translations = $response['translations'];
433         }
434
435         set_site_transient( 'update_themes', $new_update );
436 }
437
438 /**
439  * Performs WordPress automatic background updates.
440  *
441  * @since 3.7.0
442  */
443 function wp_maybe_auto_update() {
444         include_once ABSPATH . '/wp-admin/includes/admin.php';
445         include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
446
447         $upgrader = new WP_Automatic_Updater;
448         $upgrader->run();
449 }
450
451 /**
452  * Retrieves a list of all language updates available.
453  *
454  * @since 3.7.0
455  */
456 function wp_get_translation_updates() {
457         $updates = array();
458         $transients = array( 'update_core' => 'core', 'update_plugins' => 'plugin', 'update_themes' => 'theme' );
459         foreach ( $transients as $transient => $type ) {
460
461                 $transient = get_site_transient( $transient );
462                 if ( empty( $transient->translations ) )
463                         continue;
464
465                 foreach ( $transient->translations as $translation ) {
466                         $updates[] = (object) $translation;
467                 }
468         }
469
470         return $updates;
471 }
472
473 /**
474  * Collect counts and UI strings for available updates
475  *
476  * @since 3.3.0
477  *
478  * @return array
479  */
480 function wp_get_update_data() {
481         $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0, 'translations' => 0 );
482
483         if ( $plugins = current_user_can( 'update_plugins' ) ) {
484                 $update_plugins = get_site_transient( 'update_plugins' );
485                 if ( ! empty( $update_plugins->response ) )
486                         $counts['plugins'] = count( $update_plugins->response );
487         }
488
489         if ( $themes = current_user_can( 'update_themes' ) ) {
490                 $update_themes = get_site_transient( 'update_themes' );
491                 if ( ! empty( $update_themes->response ) )
492                         $counts['themes'] = count( $update_themes->response );
493         }
494
495         if ( ( $core = current_user_can( 'update_core' ) ) && function_exists( 'get_core_updates' ) ) {
496                 $update_wordpress = get_core_updates( array('dismissed' => false) );
497                 if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') )
498                         $counts['wordpress'] = 1;
499         }
500
501         if ( ( $core || $plugins || $themes ) && wp_get_translation_updates() )
502                 $counts['translations'] = 1;
503
504         $counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress'] + $counts['translations'];
505         $titles = array();
506         if ( $counts['wordpress'] )
507                 $titles['wordpress'] = sprintf( __( '%d WordPress Update'), $counts['wordpress'] );
508         if ( $counts['plugins'] )
509                 $titles['plugins'] = sprintf( _n( '%d Plugin Update', '%d Plugin Updates', $counts['plugins'] ), $counts['plugins'] );
510         if ( $counts['themes'] )
511                 $titles['themes'] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $counts['themes'] ), $counts['themes'] );
512         if ( $counts['translations'] )
513                 $titles['translations'] = __( 'Translation Updates' );
514
515         $update_title = $titles ? esc_attr( implode( ', ', $titles ) ) : '';
516
517         $update_data = array( 'counts' => $counts, 'title' => $update_title );
518         /**
519          * Filter the returned array of update data for plugins, themes, and WordPress core.
520          *
521          * @since 3.5.0
522          *
523          * @param array $update_data {
524          *     Fetched update data.
525          *
526          *     @type array   $counts       An array of counts for available plugin, theme, and WordPress updates.
527          *     @type string  $update_title Titles of available updates.
528          * }
529          * @param array $titles An array of update counts and UI strings for available updates.
530          */
531         return apply_filters( 'wp_get_update_data', $update_data, $titles );
532 }
533
534 function _maybe_update_core() {
535         include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
536
537         $current = get_site_transient( 'update_core' );
538
539         if ( isset( $current->last_checked ) &&
540                 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) &&
541                 isset( $current->version_checked ) &&
542                 $current->version_checked == $wp_version )
543                 return;
544
545         wp_version_check();
546 }
547 /**
548  * Check the last time plugins were run before checking plugin versions.
549  *
550  * This might have been backported to WordPress 2.6.1 for performance reasons.
551  * This is used for the wp-admin to check only so often instead of every page
552  * load.
553  *
554  * @since 2.7.0
555  * @access private
556  */
557 function _maybe_update_plugins() {
558         $current = get_site_transient( 'update_plugins' );
559         if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) )
560                 return;
561         wp_update_plugins();
562 }
563
564 /**
565  * Check themes versions only after a duration of time.
566  *
567  * This is for performance reasons to make sure that on the theme version
568  * checker is not run on every page load.
569  *
570  * @since 2.7.0
571  * @access private
572  */
573 function _maybe_update_themes() {
574         $current = get_site_transient( 'update_themes' );
575         if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) )
576                 return;
577
578         wp_update_themes();
579 }
580
581 /**
582  * Schedule core, theme, and plugin update checks.
583  *
584  * @since 3.1.0
585  */
586 function wp_schedule_update_checks() {
587         if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') )
588                 wp_schedule_event(time(), 'twicedaily', 'wp_version_check');
589
590         if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') )
591                 wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins');
592
593         if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )
594                 wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
595
596         if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) {
597                 // Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site.
598                 $next = strtotime( 'today 7am' );
599                 $now = time();
600                 // Find the next instance of 7 a.m. or 7 p.m., but skip it if it is within 3 hours from now.
601                 while ( ( $now + 3 * HOUR_IN_SECONDS ) > $next ) {
602                         $next += 12 * HOUR_IN_SECONDS;
603                 }
604                 $next = $next - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
605                 // Add a random number of minutes, so we don't have all sites trying to update exactly on the hour
606                 $next = $next + rand( 0, 59 ) * MINUTE_IN_SECONDS;
607                 wp_schedule_event( $next, 'twicedaily', 'wp_maybe_auto_update' );
608         }
609 }
610
611 if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
612         return;
613
614 add_action( 'admin_init', '_maybe_update_core' );
615 add_action( 'wp_version_check', 'wp_version_check' );
616 add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 );
617
618 add_action( 'load-plugins.php', 'wp_update_plugins' );
619 add_action( 'load-update.php', 'wp_update_plugins' );
620 add_action( 'load-update-core.php', 'wp_update_plugins' );
621 add_action( 'admin_init', '_maybe_update_plugins' );
622 add_action( 'wp_update_plugins', 'wp_update_plugins' );
623 add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 );
624
625 add_action( 'load-themes.php', 'wp_update_themes' );
626 add_action( 'load-update.php', 'wp_update_themes' );
627 add_action( 'load-update-core.php', 'wp_update_themes' );
628 add_action( 'admin_init', '_maybe_update_themes' );
629 add_action( 'wp_update_themes', 'wp_update_themes' );
630 add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 );
631
632 add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' );
633
634 add_action('init', 'wp_schedule_update_checks');