[wp-trac] [WordPress Trac] #37656: Improve plugin bootstrapping processes with `WP_Plugin`

WordPress Trac noreply at wordpress.org
Tue Aug 16 13:16:42 UTC 2016


#37656: Improve plugin bootstrapping processes with `WP_Plugin`
-------------------------+------------------------------
 Reporter:  flixos90     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Plugins      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by jdgrimes):

 FWIW,
 [https://github.com/WordPoints/wordpoints/blob/4cad924f90ab9d9e6a7376e4b0a5d61ac7d4696b/src/includes
 /class-un-installer-base.php here is what I use in WordPoints] to perform
 install, uninstall, and update. Takes care of multisite, network vs per-
 site activation, etc. (It really needs to be reworked into separate
 classes for each of these actions [uninstall/install/update].) But I think
 really adding anything like this would be for a separate ticket. As
 @swissspidy said, this has to start small if it is going to become part of
 core.


 As far as making `WP_Plugin` hold the plugin header data as `WP_Theme`
 does for themes, I have a proposal to make in regard to that. What if
 instead of having to read the file to parse the plugin headers, the header
 data was passed directly to a function?

 {{{#!php
 <?php
 WP_Plugins::register(
    '
    Plugin Name: Foo
    ...
    '
 );
 }}}

 The cool thing is that this will still work with the file parsing, since
 `get_file_data()` doesn't specifically look for this information only
 within PHP comments. But it also allows us to get the raw headers without
 having to read the files at all. So when the plugin is active, we can
 parse this string passed directly to our function to get the plugin data,
 and we can still read it with `get_file_data()` when the plugin is
 inactive. (I already
 [https://github.com/WordPoints/wordpoints/blob/4cad924f90ab9d9e6a7376e4b0a5d61ac7d4696b/src/includes
 /class-modules.php#L158 do this for modules in WordPoints].)

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


More information about the wp-trac mailing list