Make WordPress Core


Ignore:
Timestamp:
06/25/2020 07:13:22 AM (5 years ago)
Author:
mikeschroder
Message:

Upgrade/Install: Invalidate OPcache for PHP files during updates.

When files are copied into place, check whether opcode invalidation is available and attempt to invalidate to avoid unintended behavior or fatal errors from themes, plugins, or core.

Introduces wp_opcache_invalidate() to allow safe invalidation of PHP files from opcode cache, and a filter, wp_opcache_invalidate_file to override the behavior.

Replaces the existing calls to opcache_invalidate() in the plugin and theme editors to use the new function.

Thanks to jnylen0 for porting over a patch from ClassicPress that provided much of the approach for what is being committed.

Props nigro.simone, dd32, JasWSInc, szepe.viktor, swissspidy, JanR, asalce, Garavani, pavelevap, pputzer, GregLone, benoitchantre, jadonn, doc987, kraftbj, Krstarica, jnylen0, nextendweb, williampatton, ayeshrajans, joostdevalk, stevenkussmaul, boogah, jorbin, mikeschroder.
Fixes #36455, #50354.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-core-upgrader.php

    r47808 r48160  
    162162        $wp_filesystem->chmod( $wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE );
    163163
     164        wp_opcache_invalidate( ABSPATH . 'wp-admin/includes/update-core.php' );
    164165        require_once ABSPATH . 'wp-admin/includes/update-core.php';
    165166
Note: See TracChangeset for help on using the changeset viewer.