Make WordPress Core

Ticket #49691: 49691.diff

File 49691.diff, 1.1 KB (added by skithund, 5 years ago)
  • src/wp-admin/includes/file.php

    diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php
    index 5b11a07f6d..988314b089 100644
    a b function wp_edit_theme_plugin_file( $args ) { 
    498498        if ( false === $written ) {
    499499                return new WP_Error( 'unable_to_write', __( 'Unable to write to file.' ) );
    500500        }
    501         if ( 'php' === $extension && function_exists( 'opcache_invalidate' ) ) {
     501        if ( 'php' === $extension && function_exists( 'opcache_invalidate' ) && ( '' === ini_get( 'opcache.restrict_api' ) || strpos( ini_get( 'opcache.restrict_api' ), 'wp-admin' ) ) ) {
    502502                opcache_invalidate( $real_file, true );
    503503        }
    504504
    function wp_edit_theme_plugin_file( $args ) { 
    608608
    609609                        // Roll-back file change.
    610610                        file_put_contents( $real_file, $previous_content );
    611                         if ( function_exists( 'opcache_invalidate' ) ) {
     611                        if ( function_exists( 'opcache_invalidate' ) && ( '' === ini_get( 'opcache.restrict_api' ) || strpos( ini_get( 'opcache.restrict_api' ), 'wp-admin' ) ) ) {
    612612                                opcache_invalidate( $real_file, true );
    613613                        }
    614614