WP_Automatic_Updater
- Since
- 3.7.0, 4.6.0
- Source
wp-admin/includes/class-wp-automatic-updater.php:16
Core class used for handling automatic background updates.
Compatibility
- WordPress
- since 4.6.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Hooks and filters fired · 14
Every hook that fires from inside WP_Automatic_Updater, in the order it appears in the class, grouped by the method that fires it.
WP_Automatic_Updater::is_vcs_checkout()
- apply_filters( automatic_updates_is_vcs_checkout )filter line 178
WP_Automatic_Updater::send_core_update_notification_email()
- apply_filters( send_core_update_notification_email )filter line 345
WP_Automatic_Updater::update()
- do_action( pre_auto_update )action line 401
WP_Automatic_Updater::run()
- apply_filters( automatic_updates_send_debug_email )filter line 766
- do_action( automatic_updates_complete )action line 783
WP_Automatic_Updater::send_email()
- apply_filters( auto_core_update_send_email )filter line 935
- apply_filters( auto_core_update_email )filter line 1147
WP_Automatic_Updater::after_plugin_theme_update()
- apply_filters( auto_plugin_update_send_email )filter line 1177
- apply_filters( auto_theme_update_send_email )filter line 1200
WP_Automatic_Updater::send_plugin_theme_email()
- apply_filters( auto_plugin_theme_update_email )filter line 1541
Properties · 1
$update_resultsarrayprotected- Tracks update results during processing.
Methods · 13
- is_disabled()Determines whether the entire automatic updater is disabled.
- is_allowed_dir()Checks whether access to a given directory is allowed.
- is_vcs_checkout()Checks for version control checkouts.
- should_update()Tests to see if we can and should update a specific item.
- send_core_update_notification_email()Notifies an administrator of a core update.
- update()Updates an item, if appropriate.
- run()Kicks off the background update process, looping through all pending updates.
- after_core_update()Checks whether to send an email and avoid processing future updates after attempting a core update.
- send_email()Sends an email upon the completion or failure of a background core update.
- after_plugin_theme_update()Checks whether an email should be sent after attempting plugin or theme updates.
- send_plugin_theme_email()Sends an email upon the completion or failure of a plugin or theme background update.
- send_debug_email()Prepares and sends an email of a full log of background update results, useful for debugging and geekery.
- has_fatal_error()Performs a loopback request to check for potential fatal errors.
Source code
#[AllowDynamicProperties]class WP_Automatic_Updater { /** * Tracks update results during processing. * * @var array */ protected $update_results = array(); /** * Determines whether the entire automatic updater is disabled. * * @since 3.7.0 * * @return bool True if the automatic updater is disabled, false otherwise. */ public function is_disabled() { // Background updates are disabled if you don't want file changes. if ( ! wp_is_file_mod_allowed( 'automatic_updater' ) ) { return true; } if ( wp_installing() ) { return true; } // More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters. $disabled = defined( 'AUTOMATIC_UPDATER_DISABLED' ) && AUTOMATIC_UPDATER_DISABLED; /** * Filters whether to entirely disable background updates. * * There are more fine-grained filters and controls for selective disabling. * This filter parallels the AUTOMATIC_UPDATER_DISABLED constant in name. * * This also disables update notification emails. That may change in the future. * * @since 3.7.0 * * @param bool $disabled Whether the updater should be disabled. */ return apply_filters( 'automatic_updater_disabled', $disabled ); } /** * Checks whether access to a given directory is allowed. * * This is used when detecting version control checkouts. Takes into account * the PHP `open_basedir` restrictions, so that WordPress does not try to access * directories it is not allowed to. * * @since 6.2.0 * * @param string $dir The directory to check. * @return bool True if access to the directory is allowed, false otherwise. */ public function is_allowed_dir( $dir ) { if ( is_string( $dir ) ) { $dir = trim( $dir ); } if ( ! is_string( $dir ) || '' === $dir ) { _doing_it_wrong( __METHOD__, sprintf( /* translators: %s: The "$dir" argument. */ __( 'The "%s" argument must be a non-empty string.' ), '$dir' ), '6.2.0' ); return false; } $open_basedir = ini_get( 'open_basedir' ); if ( empty( $open_basedir ) ) { return true;Changelog
Introduced in 3.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.6.0
Moved to its own file from wp-admin/includes/class-wp-upgrader.php.from the docblock
3.7.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-admin/includes/class-wp-automatic-updater.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.