WordPress.org

Make WordPress Core

Changeset 48584


Ignore:
Timestamp:
07/23/2020 07:01:24 PM (2 months ago)
Author:
desrosj
Message:

Site Health: Pass all expected parameters to auto_update_{$type}.

This prevents fatal errors when other hooked functions are expecting both parameters.

Props dd32, desrosj, audrasjb, pbiron.
Fixes #50662.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r48576 r48584  
    23432343     */
    23442344    function detect_plugin_theme_auto_update_issues() {
     2345        $mock_plugin = (object) array(
     2346            'id'            => 'w.org/plugins/a-fake-plugin',
     2347            'slug'          => 'a-fake-plugin',
     2348            'plugin'        => 'a-fake-plugin/a-fake-plugin.php',
     2349            'new_version'   => '9.9',
     2350            'url'           => 'https://wordpress.org/plugins/a-fake-plugin',
     2351            'package'       => 'https://downloads.wordpress.org/plugin/a-fake-plugin.9.9.zip',
     2352            'icons'         => array(
     2353                '2x' => 'https://ps.w.org/a-fake-plugin/assets/icon-256x256.png',
     2354                '1x' => 'https://ps.w.org/a-fake-plugin/assets/icon-128x128.png',
     2355            ),
     2356            'banners'       => array(
     2357                '2x' => 'https://ps.w.org/a-fake-plugin/assets/banner-1544x500.png',
     2358                '1x' => 'https://ps.w.org/a-fake-plugin/assets/banner-772x250.png',
     2359            ),
     2360            'banners_rtl'   => array(),
     2361            'tested'        => `5.5.0`,
     2362            'requires_php'  => '5.6.20',
     2363            'compatibility' => new stdClass(),
     2364        );
     2365
     2366        $mock_theme = (object) array(
     2367            'theme'        => 'a-fake-theme',
     2368            'new_version'  => '9.9',
     2369            'url'          => 'https://wordpress.org/themes/a-fake-theme/',
     2370            'package'      => 'https://downloads.wordpress.org/theme/a-fake-theme.9.9.zip',
     2371            'requires'     => '5.0.0',
     2372            'requires_php' => '5.6.20',
     2373        );
     2374
    23452375        /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
    2346         $test_plugins_enabled   = apply_filters( 'auto_update_plugin', true );
     2376        $test_plugins_enabled = apply_filters( 'auto_update_plugin', true, $mock_plugin );
    23472377        /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
    2348         $test_themes_enabled    = apply_filters( 'auto_update_theme', true );
     2378        $test_themes_enabled    = apply_filters( 'auto_update_theme', true, $mock_theme );
    23492379        $ui_enabled_for_plugins = wp_is_auto_update_enabled_for_type( 'plugin' );
    23502380        $ui_enabled_for_themes  = wp_is_auto_update_enabled_for_type( 'theme' );
Note: See TracChangeset for help on using the changeset viewer.