PageRenderTime 30ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-includes/update.php

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