[wp-trac] [WordPress Trac] #14941: switch_to_blog() needs documentation; dynamic unloading and loading of plugins (was: switch_to_blog() needs documentation)

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 23 18:23:52 UTC 2010


#14941: switch_to_blog() needs documentation; dynamic unloading and loading of
plugins
-------------------------+--------------------------------------------------
 Reporter:  madtownlems  |        Owner:          
     Type:  enhancement  |       Status:  reopened
 Priority:  normal       |    Milestone:  3.1     
Component:  Multisite    |      Version:  3.0     
 Severity:  normal       |   Resolution:          
 Keywords:  needs-patch  |  
-------------------------+--------------------------------------------------

Comment(by hakre):

 switch_to_blog() is to switch the database ''only''. That is by
 intention/design.

 In case you need a new feature, that must be some function like:
 switch_blog_context($blogid) then which does not exists right now. Do not
 expect something like that in the near future as Nacin pointed out
 wordpress core can not unload plugins as of now.

 As most plugins register hooks on inclusion you might be able to
 unregister all those plugin hooks and then re-include the plugin files of
 the new blog. The plugins must be coded in a way that they do not re-
 define their functions and classes then.

 The current hook implementation does not support identifying of plugins as
 of now. I might release some code that shows how to do that the sooner or
 later.

 Worth to consider might be [http://pecl.php.net/package/runkit runkit].

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14941#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list