[wp-trac] [WordPress Trac] #36406: $network_wide is unreliable

WordPress Trac noreply at wordpress.org
Wed Apr 5 23:26:24 UTC 2017


#36406: $network_wide is unreliable
-------------------------------------------------+-------------------------
 Reporter:  mensmaximus                          |       Owner:
     Type:  defect (bug)                         |      Status:  reviewing
 Priority:  normal                               |   Milestone:  Future
Component:  Plugins                              |  Release
 Severity:  critical                             |     Version:  3.0
 Keywords:  has-patch needs-refresh needs-unit-  |  Resolution:
  tests                                          |     Focuses:  multisite
-------------------------------------------------+-------------------------
Changes (by KestutisIT):

 * severity:  normal => critical


Comment:

 It looks like that there is no solution currently at all, because I cannot
 put do_action from no reason at some random point of code, and I must use:


 {{{#!php
 <?php
  register_activation_hook($this->coreConf->getPluginPathWithFilename(),
 array(&$this, 'activate'));
 }}}


 and in the:

 {{{
 public function activate()
 {
 // there is NO way to check is that is single site, or network activation
 }
 }}}

 So the only hack might be to put:

 {{{#!php
 <?php
 if(is_network_admin())
 {
   register_activation_hook($this->coreConf->getPluginPathWithFilename(),
 array(&$this, 'networkActivate'));
 } else is_admin())
 {
   register_activation_hook($this->coreConf->getPluginPathWithFilename(),
 array(&$this, 'activate'));
 }
 }}}

 And this is critical, because this do not allow normal activation of
 network plugin at all, without leaving ability for plugin then being
 activated for single site only in multisite mode.

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


More information about the wp-trac mailing list