Jobst
Jobst

Reputation: 559

Lastest Joomla release version number for use in scripts

In wordpress there is an API https://codex.wordpress.org/WordPress.org_API that allows to get the latest release version number so it can be used in scripts, i.e. in crontab.

I am running many websites and I am trying to automate a few things, e.g. print versions current installed versions (which I know how to do), but I want to print the current release version so I know when to update.

Is there anything simlar for Joomla?

I know I could parse "https://downloads.joomla.org/latest" but that is a little awkward ...

Upvotes: 0

Views: 48

Answers (2)

Jobst
Jobst

Reputation: 559

Here is a way doing this in bash:

wget -q -O - http://update.joomla.org/core/list.xml | grep "extension name=" | awk '{print $5}' | sed -e 's/"//g' | sed -e 's/version=//' | tail -1

just in case ....

Upvotes: 0

Jake Sterling
Jake Sterling

Reputation: 83

You can use the following site to get the latest version.

http://update.joomla.org/core/list.xml

Assuming you are using PHP, you can parse it like:

$xml = simplexml_load_file('compress.zlib://http://update.joomla.org/core/list.xml') or die();
$i = 0;
$num = count($xml);
foreach ($xml->extension as $item) {
    if ($i == $num - 1) {
        $version= $item['version'];
    }
    $i++;
}

The latest version will then be set to $version

Upvotes: 1

Related Questions