How to obtain the version number of the latest available Nextcloud release?

Dear all,

I want to obtain the information if an Nextcloud update is available. If there is then I would like to get the version number of the latest stable Nextcloud server release from within my backup script. This script runs on a daily basis and sends the log that contains some additional information plus attachment via email.

This is the environment:
Nextcloud version: 12.0.5.3
Operating system and version: armbian 5.37; Debian GNU/Linux 8 (jessie) 4.13.16-sunxi
Apache or nginx version: Apache 2.4.10
PHP version: 5.6.33

In the last couple of days I found out following methods to do so:

  1. Using the script updater.phar
    -> It does what I aim for but I don’t want to run the automated update process (at least not yet). However, there is no option to only output the available update retrieved via the updater server. So, I am only interested in the initial part of the program.

  2. Initiate query URL to receive the latest version information using https://updates.nextcloud.org/updater_server/?version=
    -> Seems to be exactly what I want to achieve. From what I learned this is the same method as updater.phar queries the official Nextcloud project server.

  3. Parsing of https://github.com/nextcloud/server/releases.atom
    -> I consider this as suboptimal due to the additional burden of parsing the retrieved data.

Option 2 is the way I implemented in my backup script. Unfortunately, I could neither find much information on how to build that url nor the server response if (a) no updates are available or if (b) updates are available. I spent quite some time on trying to reengineer the query string from specific content of version.php and php version number.

Googling on this topic brought me to Xela’s revealing blog post [1] that contains a nice script which does exactly what I was looking for.

It would be great if similar information on how to query the updater server is discussed in the administrator documentation for Nextcloud maintenance reasons.

Thanks a lot and keep up the great work!!!
Cheers,
George

[1] https://spielwiese.la-evento.com/xelasblog/archives/75-Mailbenachrichtigung-bei-verfuegbaren-Nextcloud-Updates.html

Get the latest version from here or here and compare it with sudo -u www-data php occ --version?

Thanks for your suggestions.

Of course, I could parse the content of a website to find out the latest version and compare it to the one of the actual installation. However, it is more convenient to use the existing query URL which does all in one shot once you know the structure of the query string.

The point I am trying to make is that it would be great to discuss this information in future releases of the Admin documentation. It is a nice feature and shouldn‘t be hidden. Since it is not straight forward to use it would be appreciated if a couple of words in the official documentation about the usage will be added.

1 Like