wppaste
WordPress

WP_Site_Health_Auto_Updates

Since
5.2.0
Source
wp-admin/includes/class-wp-site-health-auto-updates.php:10
Class for testing automatic updates in the WordPress code.

Compatibility

WordPress
since 5.2.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 · 4

Every hook that fires from inside WP_Site_Health_Auto_Updates, in the order it appears in the class, grouped by the method that fires it.

Methods · 12

Source code

#[AllowDynamicProperties]class WP_Site_Health_Auto_Updates {	/**	 * WP_Site_Health_Auto_Updates constructor.	 *	 * @since 5.2.0	 */	public function __construct() {		require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';	}  	/**	 * Runs tests to determine if auto-updates can run.	 *	 * @since 5.2.0	 *	 * @return array The test results.	 */	public function run_tests() {		$tests = array(			$this->test_constants( 'WP_AUTO_UPDATE_CORE', array( true, 'beta', 'rc', 'development', 'branch-development', 'minor' ) ),			$this->test_wp_version_check_attached(),			$this->test_filters_automatic_updater_disabled(),			$this->test_wp_automatic_updates_disabled(),			$this->test_if_failed_update(),			$this->test_vcs_abspath(),			$this->test_check_wp_filesystem_method(),			$this->test_all_files_writable(),			$this->test_accepts_dev_updates(),			$this->test_accepts_minor_updates(),		); 		$tests = array_filter( $tests );		$tests = array_map(			static function ( $test ) {				$test = (object) $test; 				if ( empty( $test->severity ) ) {					$test->severity = 'warning';				} 				return $test;			},			$tests		); 		return $tests;	} 	/**	 * Tests if auto-updates related constants are set correctly.	 *	 * @since 5.2.0	 * @since 5.5.1 The `$value` parameter can accept an array.	 *	 * @param string $constant         The name of the constant to check.	 * @param bool|string|array $value The value that the constant should be, if set,	 *                                 or an array of acceptable values.	 * @return array|null The test results if there are any constants set incorrectly,	 *                    or null if the test passed.	 */	public function test_constants( $constant, $value ) {		$acceptable_values = (array) $value; 		if ( defined( $constant ) && ! in_array( constant( $constant ), $acceptable_values, true ) ) {			return array(				'description' => sprintf(					/* translators: 1: Name of the constant used. 2: Value of the constant used. */					__( 'The %1$s constant is defined as %2$s' ),					"<code>$constant</code>",					'<code>' . esc_html( var_export( constant( $constant ), true ) ) . '</code>'				),				'severity'    => 'fail',			);		} 		return null;	}

Changelog

Introduced in 5.2.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-admin/includes/class-wp-site-health-auto-updates.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.