[wp-trac] [WordPress Trac] #36455: Call opcache_reset() after plug-in, theme or core update

WordPress Trac noreply at wordpress.org
Fri Jan 6 07:45:47 UTC 2017

#36455: Call opcache_reset() after plug-in, theme or core update
 Reporter:  nigro.simone                         |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  4.8
Component:  Upgrade/Install                      |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  2nd-opinion has-patch needs-testing  |     Focuses:

Comment (by JanR):

 Replying to [comment:9 asalce]:
 >  I attached a new function wp_opcache_reset which should be called on
 "upgrader_process_complete" action. This should clear the OP Cache when
 ever the upgrade/update process is completed, I wasn't sure if this action
 is called for all updates (theme, plugin, wp core). Let me know if the
 attached patch fixes your issue.

 A patch like this is something WordPress definitely needs. However,
 sometimes files are locked on the file system by the opcode cache (whether
 that's OPcache, WinCache or APCu doesn't matter), and the flush needs to
 be executed prior to updating.

 Also, don't forget to remove, or invalidate, cached script paths:

 foreach( $opcache_status['scripts'] as $key => $data ) {
         $dirs[dirname( $key )][basename( $key )] = $data;
         opcache_invalidate( $data['full_path'] , $force = true );

 Reference http://php.net/manual/en/function.opcache-get-status.php.

Ticket URL: <https://core.trac.wordpress.org/ticket/36455#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list