[wp-hackers] Checking plugin version

Martin Lazarov martin at lazarov.bg
Sat Sep 22 08:42:10 UTC 2012


I'm interested in "Finding out about current WP directory plugin
versions, by querying http://api.wordpress.org".

To query wordshell i need to know plugin slug - how i can get it?

On Sat, Sep 22, 2012 at 8:37 AM, David Anderson <david at wordshell.net> wrote:
>> From: Martin Lazarov<martin at lazarov.bg>
>> Subject: [wp-hackers] Checking plugin version
>>
>>
>> Hi,
>> is there a way to check plugin version? Fox example API or something
>> else i can use from external system (not from wordpress).
>
> Are you talking about...
>
> a) Finding out about current WP directory plugin versions, by querying
> http://api.wordpress.org ?
>
> b) Analysing an plugin file to see what version it is?
>
>
> If b), then here's the regex I use in WordShell (it's a PCRE one, so will
> work from PHP or anything else that uses PCRE):
> head -45 $PLUG | grep -Pi "^([ \t\*])*Version:\s?" | head -1 | cut -d: -f2-
> | sed 's/[^-0-9a-z\.]//gi
>
>
> That's been developed through experience with testing on a few hundred
> plugins so should be fairly reliable. I've not compared it with what
> WordPress does internally (since it's worked reliably I've not needed to).
>
> If a), then unfortunately the API is not well-documented, or easy to use
> from outside PHP since it uses PHP's serialisation format. There's not much
> you can do that I can see, except from reverse-engineering it by reading the
> WordPress source code and/or using tcpdump to do packet capture on a
> WordPress site.
>
> I've been through that a bit, and WordShell has code to parse the API and
> display the description, changelog or download URL, e.g.:
>
> # wordshell akismet --downloadurl
> http://downloads.wordpress.org/plugin/akismet.2.5.6.zip
>
> It would be extremely easy for me to add in a switch to dump out the latest
> version, e.g.
>
> # wordshell akismet --latestversion
> 2.5.6
>
> Drop me a line off-list if you're interested.
>
> David
>
> --
> WordShell - WordPress fast from the CLI - www.wordshell.net
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list