Make WordPress Core

Ticket #37731: 37731.5.patch

File 37731.5.patch, 5.9 KB (added by gitlost, 5 years ago)

Demo patch adding 3 shims (includes 37731.4.patch).

  • src/wp-admin/includes/admin-filters.php

     
    116116
    117117// Upgrade hooks.
    118118add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
    119 add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 );
    120 add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 );
    121 add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 );
     119add_action( 'upgrader_process_complete', 'wp_version_check_upc', 10, 2 );
     120add_action( 'upgrader_process_complete', 'wp_update_plugins_upc', 10, 2 );
     121add_action( 'upgrader_process_complete', 'wp_update_themes_upc', 10, 2 );
  • src/wp-admin/includes/class-language-pack-upgrader.php

     
    268268
    269269                // Remove upgrade hooks which are not required for translation updates.
    270270                remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
    271                 remove_action( 'upgrader_process_complete', 'wp_version_check' );
    272                 remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
    273                 remove_action( 'upgrader_process_complete', 'wp_update_themes' );
     271                remove_action( 'upgrader_process_complete', 'wp_version_check_upc', 10, 2 );
     272                remove_action( 'upgrader_process_complete', 'wp_update_plugins_upc', 10, 2 );
     273                remove_action( 'upgrader_process_complete', 'wp_update_themes_upc', 10, 2 );
    274274
    275275                /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
    276276                do_action( 'upgrader_process_complete', $this, array(
     
    282282
    283283                // Re-add upgrade hooks.
    284284                add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
    285                 add_action( 'upgrader_process_complete', 'wp_version_check' );
    286                 add_action( 'upgrader_process_complete', 'wp_update_plugins' );
    287                 add_action( 'upgrader_process_complete', 'wp_update_themes' );
     285                add_action( 'upgrader_process_complete', 'wp_version_check_upc', 10, 2 );
     286                add_action( 'upgrader_process_complete', 'wp_update_plugins_upc', 10, 2 );
     287                add_action( 'upgrader_process_complete', 'wp_update_themes_upc', 10, 2 );
    288288
    289289                $this->skin->bulk_footer();
    290290
  • src/wp-admin/includes/class-wp-automatic-updater.php

     
    389389
    390390                // Don't automatically run these thins, as we'll handle it ourselves
    391391                remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
    392                 remove_action( 'upgrader_process_complete', 'wp_version_check' );
    393                 remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
    394                 remove_action( 'upgrader_process_complete', 'wp_update_themes' );
     392                remove_action( 'upgrader_process_complete', 'wp_version_check_upc', 10, 2 );
     393                remove_action( 'upgrader_process_complete', 'wp_update_plugins_upc', 10, 2 );
     394                remove_action( 'upgrader_process_complete', 'wp_update_themes_upc', 10, 2 );
    395395
    396396                // Next, Plugins
    397397                wp_update_plugins(); // Check for Plugin updates
  • src/wp-includes/functions.php

     
    28712871 * @return string|false The JSON encoded string, or false if it cannot be encoded.
    28722872 */
    28732873function wp_json_encode( $data, $options = 0, $depth = 512 ) {
     2874        // Prepare the data for JSON serialization.
     2875        $data = _wp_json_prepare_data( $data );
     2876
    28742877        /*
    28752878         * json_encode() has had extra params added over the years.
    28762879         * $options was added in 5.3, and $depth in 5.5.
     
    28842887                $args = array( $data );
    28852888        }
    28862889
    2887         // Prepare the data for JSON serialization.
    2888         $args[0] = _wp_json_prepare_data( $data );
    28892890
    28902891        $json = @call_user_func_array( 'json_encode', $args );
    28912892
     
    28972898        }
    28982899
    28992900        try {
    2900                 $args[0] = _wp_json_sanity_check( $data, $depth );
     2901                $args[0] = _wp_json_sanity_check( $args[0], $depth );
    29012902        } catch ( Exception $e ) {
    29022903                return false;
    29032904        }
  • src/wp-includes/update.php

     
    176176}
    177177
    178178/**
     179 * Shim for wp_version_check() to be used with 'upgrader_process_complete' action.
     180 */
     181function wp_version_check_upc( $upgrader, $hook_extra ) {
     182        $extra_stats = array(); // Anything interesting to put here, either from $hook_extra or otherwise?
     183        wp_version_check( $extra_stats );
     184}
     185
     186/**
    179187 * Check plugin versions against the latest versions hosted on WordPress.org.
    180188 *
    181189 * The WordPress version, PHP version, and Locale is sent along with a list of
     
    342350}
    343351
    344352/**
     353 * Shim for wp_update_plugins() to be used with 'upgrader_process_complete' action.
     354 */
     355function wp_update_plugins_upc( $upgrader, $hook_extra ) {
     356        $extra_stats = array(); // Anything interesting to put here, either from $hook_extra or otherwise?
     357        wp_update_plugins( $extra_stats );
     358}
     359
     360/**
    345361 * Check theme versions against the latest versions hosted on WordPress.org.
    346362 *
    347363 * A list of all themes installed in sent to WP. Checks against the
     
    499515}
    500516
    501517/**
     518 * Shim for wp_update_themes() to be used with 'upgrader_process_complete' action.
     519 */
     520function wp_update_themes_upc( $upgrader, $hook_extra ) {
     521        $extra_stats = array(); // Anything interesting to put here, either from $hook_extra or otherwise?
     522        wp_update_themes( $extra_stats );
     523}
     524
     525/**
    502526 * Performs WordPress automatic background updates.
    503527 *
    504528 * @since 3.7.0