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

WordPress Trac noreply at wordpress.org
Wed Jun 10 09:04:20 UTC 2020


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

Comment (by nextendweb):

 @ayeshrajans {{{opcache_invalidate}}} -> "the script will only be
 invalidated if the modification time of the script is newer than the
 cached opcodes." [https://www.php.net/manual/en/function.opcache-
 invalidate.php]

 Probably if we update a plugin the modification time will change for every
 file as WordPress deletes the whole folder and replaces it with the new
 version of the whole plugin.

 1. If we call {{{opcache_invalidate}}} for every file: you are right, PHP
 will recompile them when they used next time.

 2. If do not call {{{opcache_invalidate}}} when timestamp enabled: We do
 not tell PHP to invalidate the files, but it will invalidate them after
 the {{{revalidate_freq}}} so the result will be the same as 1., but there
 will be a timeframe between the install of a plugin/theme/core and the
 {{{revalidate_freq}}} while the opcode cache is in invalid state.


 PHP will do the same thing if {{{revalidate_freq}}} enabled, so if a
 shared hosting crashes if we call {{{opcache_invalidate}}} on every case,
 then it would crash when the {{{revalidate_freq}}} notice the changes for
 all of those files.

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


More information about the wp-trac mailing list