Tool for querying active plugins and themes across the network
For years I've struggled with the task of figuring out which sites on the network are using a given theme/plugin. I have found a few existing tools, and I've written a few quick-and-dirty scripts of my own, but they are all extremely slow and somewhat unreliable. The crux of the issue is that WP stores theme and plugin info in individual site `options` tables, and you can't really do queries across these tables.
I've begun work on a tool that syncs theme and plugin data to its own set of network tables, which can then easily be queried to generate reports, etc. https://github.com/cuny-academic-commons/cac-network-info
Currently it supports only themes, and has no feature other than the 'sync' tools. Briefly:
wp cac-network-info database install
installs a database with columns for site_id, template, and stylesheet.
wp cac-network-info sync 5 cunypie.commons.gc.cuny.edu
will copy information from site #5 and cunypie.commons.gc.cuny.edu into the themes table (it supports both of these formats for easy chaining, and it does an internal URL lookup if you pass the URL rather than the blog_id).
wp cac-network-info sync --all-sites
syncs all sites to the table (takes about half an hour on the production site).
There are also mechanisms to ensure that the data is synced whenever a site is created, or on
At some point soon, I'll add parallel support for plugins. This minimum amount of work will let us query a single set of MySQL tables to find out what's active across the network. Down the road, I'll add additional CLI tools that allow you to generate reports, perhaps including export to CSV files.