[wp-trac] Re: [WordPress Trac] #5651: Optimize get_plugin_data
WordPress Trac
wp-trac at lists.automattic.com
Sat Jan 12 20:29:26 GMT 2008
#5651: Optimize get_plugin_data
----------------------------------------------+-----------------------------
Reporter: filosofo | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.5
Component: General | Version: 2.5
Severity: normal | Resolution:
Keywords: has-patch get_plugin_data memory |
----------------------------------------------+-----------------------------
Comment (by darkdragon):
Most of the errors can be solved with the patch in #3141.
Your patch does not solve the issue, but merely only covers a large
portion of it. file() is still going to read the entire contents and
return an array. So it will still increase the memory requirements.
However, basically what the code is doing is exactly what
file_get_contents() will return.
If you want to solve the memory issue without #3141, then you need to open
the file, read the first 2048 bytes, run that through a regular expression
that checks if it contains all of the required information, if not then
pull in the next 2048 bytes and recheck and continue until you get
everything. At the very most you'll probably only be pulling 4 KB of data.
Far less than the size of some plugin files. It is also unlikely that
you'll need anything more than 2KB, but to be sure you can pull in 8KB of
the file and just hope that everything is within that amount.
--
Ticket URL: <http://trac.wordpress.org/ticket/5651#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list