[wp-hackers] Checking plugin version
chris at lod.com
Sat Sep 22 11:50:52 UTC 2012
To get the plugin ver you can do something like this
$url = 'http://api.wordpress.org/plugins/info/1.0/wordpress-seo/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
$result = unserialize($result);
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Martin Lazarov
Sent: Saturday, September 22, 2012 4:42 AM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Checking plugin version
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
>> 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:
> | 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
> It would be extremely easy for me to add in a switch to dump out the
> latest version, e.g.
> # wordshell akismet --latestversion
> Drop me a line off-list if you're interested.
> WordShell - WordPress fast from the CLI - www.wordshell.net
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
wp-hackers mailing list
wp-hackers at lists.automattic.com
More information about the wp-hackers