Search code examples
joomla

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 ...


Solution

  • 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