Make WordPress Core

Changeset 48756


Ignore:
Timestamp:
08/07/2020 07:23:04 PM (5 years ago)
Author:
whyisjake
Message:

Docs: Correct usage of the dynamic auto_update_{$type} filter.

This ensures that the canonical name of the filter is used in Site Health debug data, as well as on plugin and theme screens, so the developer reference site remains correct.

This brings the changes from [48750] to the 5.5 branch.

Props johnbillion.
Fixes #50868, see [48750].

Location:
branches/5.5
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/5.5

  • branches/5.5/src/wp-admin/includes/class-wp-automatic-updater.php

    r48702 r48756  
    180180         *
    181181         * The dynamic portion of the hook name, `$type`, refers to the type of update
    182          * being checked. Can be 'core', 'theme', 'plugin', or 'translation'.
     182         * being checked. Potential hook names include:
     183         *
     184         *  - `auto_update_core`
     185         *  - `auto_update_plugin`
     186         *  - `auto_update_theme`
     187         *  - `auto_update_translation`
    183188         *
    184189         * Generally speaking, plugins, themes, and major core versions are not updated
  • branches/5.5/src/wp-admin/includes/class-wp-debug-data.php

    r48747 r48756  
    972972                }
    973973
    974                 /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */
    975                 $auto_update_forced = apply_filters( 'auto_update_plugin', null, (object) $item );
     974                $type = 'plugin';
     975                /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
     976                $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item );
    976977
    977978                if ( ! is_null( $auto_update_forced ) ) {
     
    11151116            }
    11161117
    1117             /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */
    1118             $auto_update_forced = apply_filters( 'auto_update_theme', null, (object) $item );
     1118            $type = 'theme';
     1119            /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
     1120            $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item );
    11191121
    11201122            if ( ! is_null( $auto_update_forced ) ) {
     
    12021204                }
    12031205
    1204                 /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */
    1205                 $auto_update_forced = apply_filters( 'auto_update_theme', null, (object) $item );
     1206                $type = 'theme';
     1207                /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
     1208                $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item );
    12061209
    12071210                if ( ! is_null( $auto_update_forced ) ) {
     
    12911294                }
    12921295
    1293                 /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */
    1294                 $auto_update_forced = apply_filters( 'auto_update_theme', null, (object) $item );
     1296                $type = 'theme';
     1297                /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
     1298                $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item );
    12951299
    12961300                if ( ! is_null( $auto_update_forced ) ) {
  • branches/5.5/src/wp-admin/includes/class-wp-plugins-list-table.php

    r48704 r48756  
    232232            $filter_payload = (object) array_merge( $filter_payload, array_intersect_key( $plugin_data, $filter_payload ) );
    233233
    234             /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */
    235             $auto_update_forced = apply_filters( 'auto_update_plugin', null, $filter_payload );
     234            $type = 'plugin';
     235            /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
     236            $auto_update_forced = apply_filters( "auto_update_{$type}", null, $filter_payload );
     237
    236238            if ( ! is_null( $auto_update_forced ) ) {
    237239                $plugin_data['auto-update-forced'] = $auto_update_forced;
  • branches/5.5/src/wp-admin/includes/class-wp-site-health.php

    r48746 r48756  
    23732373        );
    23742374
     2375        $type = 'plugin';
    23752376        /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
    2376         $test_plugins_enabled = apply_filters( 'auto_update_plugin', true, $mock_plugin );
     2377        $test_plugins_enabled = apply_filters( "auto_update_{$type}", true, $mock_plugin );
     2378
     2379        $type = 'theme';
    23772380        /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
    2378         $test_themes_enabled    = apply_filters( 'auto_update_theme', true, $mock_theme );
     2381        $test_themes_enabled = apply_filters( "auto_update_{$type}", true, $mock_theme );
     2382
    23792383        $ui_enabled_for_plugins = wp_is_auto_update_enabled_for_type( 'plugin' );
    23802384        $ui_enabled_for_themes  = wp_is_auto_update_enabled_for_type( 'theme' );
  • branches/5.5/src/wp-admin/includes/theme.php

    r48698 r48756  
    717717        }
    718718
    719         /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */
    720         $auto_update_forced = apply_filters( 'auto_update_theme', null, $auto_update_filter_payload );
     719        $type = 'theme';
     720        /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
     721        $auto_update_forced = apply_filters( "auto_update_{$type}", null, $auto_update_filter_payload );
    721722
    722723        $prepared_themes[ $slug ] = array(
Note: See TracChangeset for help on using the changeset viewer.