[wp-trac] Re: [WordPress Trac] #7372: Plugin update check running on each pageload is slow

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 22 17:07:36 GMT 2008


#7372: Plugin update check running on each pageload is slow
--------------------------------------+-------------------------------------
 Reporter:  DD32                      |        Owner:  anonymous
     Type:  defect                    |       Status:  new      
 Priority:  normal                    |    Milestone:  2.7      
Component:  Administration            |      Version:  2.6      
 Severity:  normal                    |   Resolution:           
 Keywords:  needs-patch dev-feedback  |  
--------------------------------------+-------------------------------------
Comment (by Otto42):

 Well, I like the idea of hitting the plugin update function on every admin
 page load, like it does now, but I do agree that it is ridiculous that it
 basically loads every single PHP file up to the very end if it can't find
 the plugin data. I think adding a limitation on this might be cleaner:

 Examine this bit of code down in plugin_get_contents():

 {{{
 // Keep reading the contents of the file until End of File is
 // reached, or we grabbed all of the required plugin data.
 while( !feof($fp) && !plugin_has_required_fields($contents) )
         $contents .= fread( $fp, 1024 );
 }}}

 Really? Do we need to load the whole bloody file just to look for plugin
 data? How about we add that those 5 required fields must be within the
 first, say, 2k of the file. Limit this read to twice only. If you can't
 put the plugin comments at the top and within 2k, then fix your plugin.

 I really can't see this sort of a limit affecting any existing plugins in
 a significant way. And it will severely reduce the load time for plugin
 files in all the cases where we load the list.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7372#comment:3>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list