h5p / h5p-wordpress-plugin

Adds support for H5P Content in WordPress.
https://wordpress.org/plugins/h5p/
71 stars 74 forks source link

Multisite Enhancements #41

Open SteelWagstaff opened 7 years ago

SteelWagstaff commented 7 years ago

We're running H5P on a Wordpress multisite (an instance of Pressbooks, actually), and would like to have a greater ability to centralize, manage, and share H5P activities across the network, without having to activate H5P for each individual site and install the H5P libraries over and over again each time a new site activates H5P.

Here’s an ideal scenario or our use case:

  1. When H5P is network activated on a multisite network, a single instance of the necessary libraries is installed and a shared H5P activity library is created for all sites on the network to use (the multisite behaves like a single supersite, essentially).

  2. When a user creates a new H5P activity in a specific book/site in the network, that particular H5P activity receives a hard-coded tag that corresponds to the book/site’s identity in some way (perhaps the URL or the site title). They can add additional tags, but they can’t remove this tag. For example, if the book was “Portuguese" at http://testsite.com/portuguese, any time a user logged into the Portuguese admin panel created an H5P activity, it would automatically be tagged ‘Portuguese’, giving the user a reliable filter to find only those activities in the library that were created in/for that book/site.

  3. When a user attempts to insert an H5P activity from the wordpress interface, the selection screen automatically loads with the hard-coded tag selected (so that the activities are already filtered by book/site). This tag can be removed/deselected by the user, however, allowing them to see all the H5P activities created and published on the network. For example, a user in the Portuguese book/site would click ‘Add H5P’ activity and the tag ‘Portuguese’ would automatically be selected, so that the user would only see H5P activities created on/for that book/site. If desired, however, they could X out Portuguese, and see any/all H5P activities created on the network, allowing them to insert an H5P activity created on/for another site in the network.

  4. When users use the ‘Insert H5P’ button on the WYSIWYG, the embed code for the H5P activity is inserted rather than an id-specific shortcode. This way, if the wordpress title is exported or moved to a different server, the H5P activity will remain embedded and functional, without having to reimport/upload all of the H5P activities to the new server in exactly the same order.

timothyylim commented 7 years ago

Thanks for the extremely detailed description of the functionality you're envisioning.

I can't promise when exactly the Core Team will have time to improve the multi-site support for H5P but it's definitely something that needs to happen soon.

I've duplicated your request in the feature requests section in h5p.org:

https://h5p.org/node/36005

and perhaps a developer from the community or the Core Team will pick it up.

mrjarbenne commented 7 years ago

Does it make sense to potentially split these up into different issues. I would love to see number one tackled, and wouldn't want development of that facet to be burdened by 2-4. Separating these into separate issues would help to focus conversation around the development.

SteelWagstaff commented 7 years ago

I'd be fine with that. Anything that could help move this along with be positive in my opinion.

timothyylim commented 7 years ago

@mrjarbenne , feel free to split off 1) into a new feature request:

https://h5p.org/forum/16

SteelWagstaff commented 7 years ago

@icc, @mrjarbenne, and @timothyylim, I went ahead and created a feature request at h5p.org for item #1: https://h5p.org/node/65938

SteelWagstaff commented 7 years ago

Hi @icc and others--I just wanted to check in on the status of this request. It appears that since version 1.7.2 we can now network enable H5P on multisite and allow each individual site to create H5P activities and install libraries on/for their own sites (thank you!). However, I'm not sure whether it is possible for us to centrally manage and maintain the various H5P libraries we use on that multisite. Here's our use case: we have a single WP multisite instance and want to make H5P available for all of the many sites on our network. We'd prefer to install and update the various H5P libraries for all the sites from a single place, rather than requiring each site admin to download and update their own individual libraries. Is that possible with the way the H5P for Wordpress plugin is currently written? If it's not, can anyone offer me a few pointers as to how it might be achieved to see whether this is something we could look into contributing a pull request for?

icc commented 6 years ago

Currently, each sub-site is treated as a separate site, the installed libraries are not shared or manageable from the network admin. Enabling/achieving this requires some hours of work, steady hands and a lot of testing. (All library paths and table prefixes must be updated and a setup process/configuration must be offered)

This is probably the ideal way for many multi-sites but it requires that extra effort and resources to achieve.

dac514 commented 6 years ago

Chiming in for Pressbooks.

Firstly, from a database design design POV, the H5P approach is nice. IMHO the data model is reasonable for anyone who's worked with relational databases. Kudos for a sane schema.

Unfortunately, from a WordPress point of view it is undesirable. Here's a recent horror story from the trenches of Pressbooks that better explains the situation.

TLDR: Each WP blog is 10 tables. If you run 50,000 sites then you are responsible for a half a million database tables. Reliable sources have told me WordPress dot com uses the same WP Multisite technology but instead of half a million tables it’s over a billion tables.

Network activating the H5P plugin, as is, more than doubles the table count.

Obviously, splitting and sharding and all that good stuff, but a WP plugin designed for Multisite needs to take this kind of scale into account.

We cannot activate this plugin at the network level without causing big devops headaches. The trade off is not worth it for us.

PS: This is supposed to happen soon: "Introduce shared wp_blogmeta database table for multisite installation" https://core.trac.wordpress.org/ticket/37923

icc commented 6 years ago

I understand your concern and unfortunately, there hasn't been put a whole lot of effort into optimizing the H5P plugin for multisite setups. It behaves more or less like default. Meaning, there's still a lot that can be done and I know a couple of users have also requested a shared content type management for all sites.

What do you think would be an optimal setup for your use-case. Shared tables with an extra field for site_id?

dac514 commented 6 years ago

Yeah maybe.

Looking at the schema I think the simplest approach is to extend content_id by adding a blog_id column to wp_h5p_contents. _(wp_blogs.blogid)

Then, all content from every site could be shared in 13 tables.