WordPress.org

Make WordPress Core

Ticket #36455: 36455.5.diff

File 36455.5.diff, 930 bytes (added by benoitchantre, 18 months ago)
  • src/wp-includes/update.php

    diff --git src/wp-includes/update.php src/wp-includes/update.php
    index e23811b..f065d09 100644
    function wp_clean_update_cache() { 
    736736        delete_site_transient( 'update_core' );
    737737}
    738738
     739/**
     740 * Reset PHP opcache
     741 *
     742 * @since 4.9.5
     743 */
     744function wp_opcache_reset() {
     745        if ( ! function_exists( 'opcache_reset' ) ) {
     746                return;
     747        }
     748
     749        if ( ! empty( ini_get( 'opcache.restrict_api' ) ) && strpos( __FILE__, ini_get( 'opcache.restrict_api' ) ) !== 0 ) {
     750                return;
     751        }
     752
     753        opcache_reset();
     754}
     755
    739756if ( ( ! is_main_site() && ! is_network_admin() ) || wp_doing_ajax() ) {
    740757        return;
    741758}
    add_action( 'update_option_WPLANG', 'wp_clean_update_cache' , 10, 0 ); 
    760777add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' );
    761778
    762779add_action( 'init', 'wp_schedule_update_checks' );
     780
     781add_action( 'upgrader_process_complete', 'wp_opcache_reset' );