WordPress.org

Make WordPress Core

Ticket #36455: 36455.2.diff

File 36455.2.diff, 1.5 KB (added by asalce, 2 years ago)
  • wp-admin/includes/admin-filters.php

    diff --git a/wp-admin/includes/admin-filters.php b/wp-admin/includes/admin-filters.php
    index 141e8aa..2350d4c 100644
    a b add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async 
    119119add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 );
    120120add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 );
    121121add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 );
     122add_action( 'upgrader_pre_download', 'wp_opcache_reset', 10, 0 );
  • wp-includes/update.php

    diff --git a/wp-includes/update.php b/wp-includes/update.php
    index f0b999a..db87c1d 100644
    a b function wp_clean_update_cache() { 
    706706        delete_site_transient( 'update_core' );
    707707}
    708708
     709/**
     710 * Reset PHP opcache
     711 *
     712 * @since 4.8
     713 *
     714 * @return boolean
     715 */
     716function wp_opcache_reset() {
     717        if ( function_exists( 'opcache_reset' ) && ini_get('opcache.validate_timestamps') != '1' && (!ini_get('opcache.restrict_api') || stripos(ABSPATH, ini_get('opcache.restrict_api')) === 0) ) {
     718                opcache_reset();
     719                $opcache_status = opcache_get_status();
     720                $matches = preg_grep( "/^" . preg_quote(ABSPATH, '/') . "/" , array_keys($opcache_status['scripts']) );
     721                if(count($matches))
     722                        array_map('opcache_invalidate', $matches, array_fill(0, count($a), TRUE));
     723                return true;
     724        }
     725        return false;
     726}
     727
    709728if ( ( ! is_main_site() && ! is_network_admin() ) || wp_doing_ajax() ) {
    710729        return;
    711730}