Make WordPress Core


Ignore:
Timestamp:
10/20/2020 05:37:16 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Upgrade/Install: Introduce a wrapper for the auto_update_{$type} filter checks.

This allows for cleaner checks whether auto-updates are forced for a plugin or theme.

Follow-up to [48750].

Props rebasaurus, garrett-eclipse, SergeyBiryukov.
Fixes #50875.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/update.php

    r49108 r49241  
    10471047
    10481048/**
     1049 * Checks whether auto-updates are forced for an item.
     1050 *
     1051 * @since 5.6.0
     1052 *
     1053 * @param string    $type   The type of update being checked: 'theme' or 'plugin'.
     1054 * @param bool|null $update Whether to update. The value of null is internally used
     1055 *                          to detect whether nothing has hooked into this filter.
     1056 * @param object    $item   The update offer.
     1057 * @return bool True if auto-updates are forced for `$item`, false otherwise.
     1058 */
     1059function wp_is_auto_update_forced_for_item( $type, $update, $item ) {
     1060    /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
     1061    return apply_filters( "auto_update_{$type}", $update, $item );
     1062}
     1063
     1064/**
    10491065 * Determines the appropriate auto-update message to be displayed.
    10501066 *
Note: See TracChangeset for help on using the changeset viewer.