Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Plugins and network activations
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  15 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dino Termini  
View profile  
 More options Jun 28 2011, 7:42 am
From: Dino Termini <d...@duechiacchiere.it>
Date: Tue, 28 Jun 2011 07:42:17 -0400
Local: Tues, Jun 28 2011 7:42 am
Subject: [wp-hackers] Plugins and network activations
Hi all,

I've developed a plugin for Wordpress that needs some extra tables in
order to work properly. A few users have complained that when they try
to "network-activate" it, it only works on the main blog.

So I found this discussion about how Wordpress should support these
activations, but I don't understand how we plugin developers should
handle the activation process

http://core.trac.wordpress.org/ticket/14170

Can someone please elaborate on it, maybe posting an example or a
snippet of code?

Thank you!
Dino
_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Blackbourn  
View profile  
 More options Jun 28 2011, 8:21 am
From: John Blackbourn <johnbillion...@gmail.com>
Date: Tue, 28 Jun 2011 13:21:48 +0100
Local: Tues, Jun 28 2011 8:21 am
Subject: Re: [wp-hackers] Plugins and network activations
On 28 June 2011 12:42, Dino Termini <d...@duechiacchiere.it> wrote:

> Hi all,

> I've developed a plugin for Wordpress that needs some extra tables in order
> to work properly. A few users have complained that when they try to
> "network-activate" it, it only works on the main blog.

> So I found this discussion about how Wordpress should support these
> activations, but I don't understand how we plugin developers should handle
> the activation process

> http://core.trac.wordpress.org/ticket/14170

> Can someone please elaborate on it, maybe posting an example or a snippet of
> code?

This [1] is the code I use in one of my plugins. Basically you detect
if the activation is network-wide or not, and loop over each blog,
installing the tables in turn.

*Beware* though, that this code is likely to timeout (ie. hit PHP's
script execution time limit) if you have hundreds of blogs in your
network, especially if you're adding tables to each blog. My plugin is
only deployed in controlled environments so I know it'll be fine. If
your plugin is going to be made publicly available you should look
into a method similar to what scribu does in his Proper Network
Activation plugin [2].

John

[1] http://pastebin.com/QeeXXRKD
[2] http://wordpress.org/extend/plugins/proper-network-activation/
_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dino Termini  
View profile  
 More options Jun 28 2011, 8:43 am
From: Dino Termini <d...@duechiacchiere.it>
Date: Tue, 28 Jun 2011 08:43:33 -0400
Local: Tues, Jun 28 2011 8:43 am
Subject: Re: [wp-hackers] Plugins and network activations
John,

thank you for your feedback. I'm actually suggesting my users to install
Scribu's plugin before they activate mine network-wide. Unfortunately
some of them still report that it didn't help, and that only the tables
for the main blog were created. I guess I'll have to look into adding
some ajax to my plugin. My only concern is that this should be handled
by Wordpress, not the plugin developers :)

Best,
Dino

On 6/28/2011 8:21 AM, John Blackbourn wrote:

_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Westwood  
View profile  
 More options Jun 28 2011, 8:48 am
From: Peter Westwood <peter.westw...@ftwr.co.uk>
Date: Tue, 28 Jun 2011 13:48:19 +0100
Local: Tues, Jun 28 2011 8:48 am
Subject: Re: [wp-hackers] Plugins and network activations
Hi,

On 28 Jun 2011, at 13:43, Dino Termini wrote:

> thank you for your feedback. I'm actually suggesting my users to install Scribu's plugin before they activate mine network-wide. Unfortunately some of them still report that it didn't help, and that only the tables for the main blog were created. I guess I'll have to look into adding some ajax to my plugin. My only concern is that this should be handled by Wordpress, not the plugin developers :)

The correct solution is to not have a table per blog in a Multisite install.

Your plugin should either work with the existing table structure or introduce a global table because it needs to do something fundamentally different or not expect to work on any reasonably sized multisite install when network activated without manual work to create the tables.

Running through a table creation for every blog on a large multisite install is not scalable and is probably not what you need :)

Cheers
--
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
50BF A954 E072 23DB B50A  A319 56C3 8FFF 9C72 AB79

_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dino Termini  
View profile  
 More options Jun 28 2011, 8:56 am
From: Dino Termini <d...@duechiacchiere.it>
Date: Tue, 28 Jun 2011 08:56:31 -0400
Local: Tues, Jun 28 2011 8:56 am
Subject: Re: [wp-hackers] Plugins and network activations

> The correct solution is to not have a table per blog in a Multisite install.

True, but what about uninstalling the plugin? How do I make sure no
other instances are still referencing the global table?

Thank you,
Dino.
_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tommy  
View profile  
 More options Jun 28 2011, 9:19 am
From: Tommy <t...@tommyleunen.com>
Date: Tue, 28 Jun 2011 09:19:17 -0400
Local: Tues, Jun 28 2011 9:19 am
Subject: Re: [wp-hackers] Plugins and network activations
 For me, I noticed a strange thing about network activation.

 I made a little test with 2 blogs and a network admin
 activation/deactivation (register_activation_hook /
 register_deactivation_hook). In the activation, I create a table for
 each blog, and in the deactivation, I remove the table.

 My results are :
 - The activation is triggered for each blog. (Actually, only main blog
 at this time, but when I go into the dashboard of the second blog, it
 seems to be activate at this time because I see the table into my DB)
 - For the deactivation, only the main blog is triggered, even I go into
 the dashboard of the second blog.

 So, why I didn't have the same behavior for Activation/Deactivation ?

 Thanks.

 Tommy

 On Tue, 28 Jun 2011 08:56:31 -0400, Dino Termini

 <d...@duechiacchiere.it> wrote:
>> The correct solution is to not have a table per blog in a Multisite
>> install.

> True, but what about uninstalling the plugin? How do I make sure no
> other instances are still referencing the global table?

> Thank you,
> Dino.
> _______________________________________________
> wp-hackers mailing list
> wp-hack...@lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dino Termini  
View profile  
 More options Jun 28 2011, 11:54 am
From: Dino Termini <d...@duechiacchiere.it>
Date: Tue, 28 Jun 2011 11:54:20 -0400
Local: Tues, Jun 28 2011 11:54 am
Subject: Re: [wp-hackers] Plugins and network activations

On Jun 28, 2011, at 8:48 AM, Peter Westwood <peter.westw...@ftwr.co.uk> wrote:

> Hi,

> The correct solution is to not have a table per blog in a Multisite install.

Also, how come Wordpress itself does not follow this rule? ;) Why a plugin must scale and wp don't?

Thanks
Dino
_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Little  
View profile  
 More options Jun 28 2011, 12:20 pm
From: Mike Little <wordpr...@zed1.com>
Date: Tue, 28 Jun 2011 17:20:02 +0100
Local: Tues, Jun 28 2011 12:20 pm
Subject: Re: [wp-hackers] Plugins and network activations

WordPress never needs to create new tables for *all* blogs in a network in
one go. The new tables are created for one blog when that blog is created.

There are no scaling issues with that process.

Mike
--
Mike Little
http://zed1.com/
_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dino Termini  
View profile  
 More options Jun 28 2011, 12:25 pm
From: Dino Termini <d...@duechiacchiere.it>
Date: Tue, 28 Jun 2011 12:25:58 -0400
Local: Tues, Jun 28 2011 12:25 pm
Subject: Re: [wp-hackers] Plugins and network activations

> WordPress never needs to create new tables for *all* blogs in a network in
> one go. The new tables are created for one blog when that blog is created.

> There are no scaling issues with that process.

Good point!

D.
_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Schinkel  
View profile  
 More options Jun 28 2011, 1:05 pm
From: Mike Schinkel <mikeschin...@newclarity.net>
Date: Tue, 28 Jun 2011 13:05:19 -0400
Local: Tues, Jun 28 2011 1:05 pm
Subject: Re: [wp-hackers] Plugins and network activations
On Jun 28, 2011, at 8:48 AM, Peter Westwood wrote:

> The correct solution is to not have a table per blog in a Multisite install.

> Your plugin should either work with the existing table structure or introduce a global table because it needs to do something fundamentally different or not expect to work on any reasonably sized multisite install when network activated without manual work to create the tables.

> Running through a table creation for every blog on a large multisite install is not scalable and is probably not what you need :)

I've been thinking about this a lot lately as we're exploring building a SaaS using WordPress as a base.

I definitely agree that the current process does not scale to have to add tables when a plugin needs tables to all sites.  So you proposed one option to create a shared table that has blog_id as a field so only one table needs to be added. But doesn't that effectively create a hybrid architecture where parts of the data are sharded and parts are not?

My understanding is that WordPress uses a sharding approach to enable scalability, yet it is recommending to not use sharding for extensions; isn't that contradictory? If sharding is the appropriate architecture for WordPress' tables why is it not the appropriate architecture for plugin's tables?

Or is this simple a case of "Yes, it's not a great situation but it's all we got at the moment?"  And if that is the case, maybe it would make sense to come up with a better solution (i.e. a way that it is possible to add new tables to other blogs without timeout?)

-Mike
_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Otto  
View profile  
 More options Jun 28 2011, 1:17 pm
From: Otto <o...@ottodestruct.com>
Date: Tue, 28 Jun 2011 12:17:14 -0500
Local: Tues, Jun 28 2011 1:17 pm
Subject: Re: [wp-hackers] Plugins and network activations
On Tue, Jun 28, 2011 at 12:05 PM, Mike Schinkel

<mikeschin...@newclarity.net> wrote:
> I've been thinking about this a lot lately as we're exploring building a SaaS using WordPress as a base.

> I definitely agree that the current process does not scale to have to add tables when a plugin needs tables to all sites.  So you proposed one option to create a shared table that has blog_id as a field so only one table needs to be added. But doesn't that effectively create a hybrid architecture where parts of the data are sharded and parts are not?

> My understanding is that WordPress uses a sharding approach to enable scalability, yet it is recommending to not use sharding for extensions; isn't that contradictory? If sharding is the appropriate architecture for WordPress' tables why is it not the appropriate architecture for plugin's tables?

> Or is this simple a case of "Yes, it's not a great situation but it's all we got at the moment?"  And if that is the case, maybe it would make sense to come up with a better solution (i.e. a way that it is possible to add new tables to other blogs without timeout?)

If you've noticed, WordPress itself avoids changing its tables as much
as possible. Every time they do, they have to write special code to
handle wp.com and its 25 million sites in a scalable upgrade
mechanism.

Scaling will always be hard. You just have to determine the best way
to support it for your specific custom data. There's plenty of
options:

1. Don't use separate tables. This is the best approach, but not
feasible in all cases.
2. Use one global table. Works, but if the dataset is large or the
number of blogs is large, then sharding may be preferred.
3. One or more tables per site. Scaling this is hard for having to
create and/or alter tables. You might be able to get away with a
create-when-not-there approach, as long as your check for "not-there"
is optimized. If not, then you have to give admins a way to
create/upgrade all sites. WordPress does this with a network admin
approach, with the upgrade-network functionality, when the tables have
to be altered. In this case, avoiding alters is the best policy
because of the very-large-sites scaling problems.

-Otto
_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Westwood  
View profile  
 More options Jun 29 2011, 5:58 am
From: Peter Westwood <peter.westw...@ftwr.co.uk>
Date: Wed, 29 Jun 2011 10:58:08 +0100
Local: Wed, Jun 29 2011 5:58 am
Subject: Re: [wp-hackers] Plugins and network activations

On 28 Jun 2011, at 18:05, Mike Schinkel wrote:

> On Jun 28, 2011, at 8:48 AM, Peter Westwood wrote:
>> The correct solution is to not have a table per blog in a Multisite install.

>> Your plugin should either work with the existing table structure or introduce a global table because it needs to do something fundamentally different or not expect to work on any reasonably sized multisite install when network activated without manual work to create the tables.

>> Running through a table creation for every blog on a large multisite install is not scalable and is probably not what you need :)

> I've been thinking about this a lot lately as we're exploring building a SaaS using WordPress as a base.

> I definitely agree that the current process does not scale to have to add tables when a plugin needs tables to all sites.  So you proposed one option to create a shared table that has blog_id as a field so only one table needs to be added. But doesn't that effectively create a hybrid architecture where parts of the data are sharded and parts are not?
> My understanding is that WordPress uses a sharding approach to enable scalability, yet it is recommending to not use sharding for extensions; isn't that contradictory? If sharding is the appropriate architecture for WordPress' tables why is it not the appropriate architecture for plugin's tables?

> Or is this simple a case of "Yes, it's not a great situation but it's all we got at the moment?"  And if that is the case, maybe it would make sense to come up with a better solution (i.e. a way that it is possible to add new tables to other blogs without timeout?)

Yes and no.

If we for example take the example of a "subscribe to comments" plugin in a multisite install a table per blog is probably wrong for a number of reasons:

1) You can't do anything clever like digesting all emails across all blogs easily
2) You can't provide a single manage my subscriptions UI if the data is sharded across every blog's tables.

In a large install some data needs to be sharded and some needs to be global which is exactly what WordPress itself does - some of the tables in a multisite install are global - users, usermeta, ...

Cheers
--
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
50BF A954 E072 23DB B50A  A319 56C3 8FFF 9C72 AB79

_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Schinkel  
View profile  
 More options Jun 29 2011, 10:50 am
From: Mike Schinkel <mikeschin...@newclarity.net>
Date: Wed, 29 Jun 2011 10:50:10 -0400
Local: Wed, Jun 29 2011 10:50 am
Subject: Re: [wp-hackers] Plugins and network activations
On Jun 29, 2011, at 5:58 AM, Peter Westwood wrote:

> If we for example take the example of a "subscribe to comments" plugin in a multisite install a table per blog is probably wrong for a number of reasons:

> 1) You can't do anything clever like digesting all emails across all blogs easily
> 2) You can't provide a single manage my subscriptions UI if the data is sharded across every blog's tables.

> In a large install some data needs to be sharded and some needs to be global which is exactly what WordPress itself does - some of the tables in a multisite install are global - users, usermeta, ...

That make perfect sense. Yes, some data should definitely be global.

But by the same token won't you agree that some should be site-specific, i.e. a post relationships table or a table for taxonomy meta, for example?

-Mike
_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Westwood  
View profile  
 More options Jun 29 2011, 11:05 am
From: Peter Westwood <peter.westw...@ftwr.co.uk>
Date: Wed, 29 Jun 2011 16:05:42 +0100
Local: Wed, Jun 29 2011 11:05 am
Subject: Re: [wp-hackers] Plugins and network activations

On 29 Jun 2011, at 15:50, Mike Schinkel wrote:

> On Jun 29, 2011, at 5:58 AM, Peter Westwood wrote:
>> If we for example take the example of a "subscribe to comments" plugin in a multisite install a table per blog is probably wrong for a number of reasons:

>> 1) You can't do anything clever like digesting all emails across all blogs easily
>> 2) You can't provide a single manage my subscriptions UI if the data is sharded across every blog's tables.

>> In a large install some data needs to be sharded and some needs to be global which is exactly what WordPress itself does - some of the tables in a multisite install are global - users, usermeta, ...

> That make perfect sense. Yes, some data should definitely be global.

> But by the same token won't you agree that some should be site-specific, i.e. a post relationships table or a table for taxonomy meta, for example?

If they contain data you don't want to access globally and don't fit the current schema then yes.

I would recommend that any plugin that relies on them is written to do something along the following lines:

1) Create the tables in single site when activated.
2) Create the tables when a new blog is created in multisite
3) Comes with an example script to go back and create the tables for pre-existing multisite blogs.

It just doesn't make sense to try and do the table creation at the point of network activation.

Cheers
--
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
50BF A954 E072 23DB B50A  A319 56C3 8FFF 9C72 AB79

_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Schinkel  
View profile  
 More options Jun 29 2011, 11:13 am
From: Mike Schinkel <mikeschin...@newclarity.net>
Date: Wed, 29 Jun 2011 11:13:40 -0400
Local: Wed, Jun 29 2011 11:13 am
Subject: Re: [wp-hackers] Plugins and network activations
On Jun 29, 2011, at 11:05 AM, Peter Westwood wrote:

> If they contain data you don't want to access globally and don't fit the current schema then yes.

> I would recommend that any plugin that relies on them is written to do something along the following lines:

> 1) Create the tables in single site when activated.
> 2) Create the tables when a new blog is created in multisite
> 3) Comes with an example script to go back and create the tables for pre-existing multisite blogs.

> It just doesn't make sense to try and do the table creation at the point of network activation.

Thanks for clarifying.  I misunderstood and thought you were saying "Don't create per-site tables."

-Mike
_______________________________________________
wp-hackers mailing list
wp-hack...@lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »