[wp-trac] [WordPress Trac] #36406: $network_wide is unreliable
WordPress Trac
noreply at wordpress.org
Thu Apr 6 01:32:20 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
-------------------------------------------------+-------------------------
Comment (by KestutisIT):
Replying to [comment:28 KestutisIT]:
> 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.
And even my hack with is_network_admin() doesn't work here, because if I
do debug test for network-install click, it says that is a regular admin
page, not a network. So that works only after plugin install, when I
browse plugin pages, but not during plugin activation. So there is
absolutely NO SOLUTION AT THIS MOMENT.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36406#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list