• Resolved quenenni

    (@quenenni)


    Hello,

    I’m hosting lots of wordpress with different versions and of course, tons of plugins / themes (lots of different version too).

    We’re trying to implement scripts to get all WP versions and plugins / themes versions in order to detect the ones that are not up-to-dated.

    I already tried the excellent wpsan tool (https://github.com/wpscanteam), but unfortunately, it only work with an url and not within the system (with a internal path as param) and that’s just not possible with all the WP we have.

    I already built a script to have all the WP versions and another one to have all the plugins versions and they work nice and quick.

    Now, I would like to know the last version of each plugin we are using to be able to compare with the one we have. I checked the plugin API but couldn’t make it work.
    All my attemps gave me the answer:
    O:8:"stdClass":1:{s:5:"error";s:22:"Action not implemented";}

    As far as I understand, we have to use it from inside a WP.

    Does anyone know if it possible to call the API from an external script (outside a WP instance).
    I using Python, but if it’s only possible with PHP, I can manage that.

    My search on the net returned nothing.
    Maybe someone knows where I can find an example on how to do it.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter quenenni

    (@quenenni)

    Yeepee.. I found the solution.
    (the problem is always to find the right words to use in the search)

    wordpress-plugin-api-latest-download
    It’s in Php, but that’s much much better than nothing.
    I’ll try to make it work with Python.

    Thread Starter quenenni

    (@quenenni)

    In case someone else want to do the same, here is a easy way to achieve that (in Python):

    This example is for the plugin akismet.
    You just have to change the name at the end of the url var to match the plugin you want.

    Also, you can get different format from the server.
    You just have to change the extension (.json / .xml / .php)

    #! /usr/bin/env python
    
    from urllib2 import urlopen
    import json
    
    url = 'https://api.www.ads-software.com/plugins/info/1.0/akismet.json'
    response = urlopen(url).read()
    
    try:
        json_response = json.loads(response)
    
    # This to print everything
    #    print json.dumps(json_response, sort_keys=True, indent=4)
    
        print "Version: ", json_response['version']
        print "requires: ", json_response['requires']
        print "tested: ", json_response['tested']
        print "last_updated: ", json_response['last_updated']
    
    except (ValueError, KeyError, TypeError):
        print "error"

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get plugins version from outside a WP instance’ is closed to new replies.