WordPress Plugin Health Dashboard (Early POC)

In trying to get a better handle on how we’re going to manage our plugins in the future, I found the API for the WordPress.org plugins data. Not like they were hiding it but I’d not seen it before.Consider me Columbus
absent the genocide, slavery, and other terrible things.
Replacing *slug* in the following URL gives you a pretty robust javascript

https://api.wordpress.org/plugins/info/1.0/slug.json

With that option, I could build a little Google Sheet/Scripts viewer that would look up information based on a list of plugin slugs. I could set conditional formatting to do various things for visual cues . . . I could even build a little mini-algorithm to evaluate different aspects and weight them towards a total plugin score.

I’m debating whether it’s worth working into a more sophisticated plugin that will tell me how many sites the plugin is installed on, display that data etc. There are plugins like that out there but they die on large multisite installations.1 I’d also like some way to tie into the vulnerable plugin announcements.

Here are the two little functions that look up and write the plugin’s health based on the slugs being written in column A and a header in row 1.

function writeData(){
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var ss = spreadsheet.getActiveSheet();
  var lastRow = ss.getLastRow();
  var range = ss.getRange('A2:A' + lastRow);
  var slugs = range.getValues();
  for (i in slugs){
   var len = 2+Number(i);
   getData(slugs[i],ss, len); 
  }
}


function getData(slug,ss,len) {
 var url  = 'https://api.wordpress.org/plugins/info/1.0/' + slug + '.json';
 var  result = UrlFetchApp.fetch(url);
    if (result.getResponseCode() == 200) {
        var json = JSON.parse(result.getContentText());
        var version = json.version;
        var updated = json.last_updated;
        var tested = json.tested;
        var rating = json.rating;
        var values = [[version,updated,tested,rating]];        
        var range = ss.getRange('B'+ len + ':E'+ len);
        range.setValues(values);
    }
}


1 I have a functional, if crude, option that paginates through them in a way that doesn’t crash/die.

Comments on this post

No comments.

Leave a Reply

Trackbacks and Pingbacks on this post

No trackbacks.

TrackBack URL