Jump to content

How to Test the Update Check Feature from a Developer Build

From The Document Foundation Wiki


Configure the build with --enable-online-update, of course.

There is a testing update server at the fake URL http://update-test.libreoffice.org/check.php. To make that work on your machine, it needs to resolve update-test.libreoffice.org to the same IP address as update.libreoffice.org, namely 195.135.221.70. On Unix-like systems that can be done by adding a line

 195.135.221.70 update-test.libreoffice.org

to /etc/hosts, for example.

That testing update server runs a copy of [1] patched with

diff --git a/check.php b/check.php
index 64c23f1..0c612a5 100644
--- a/check.php
+++ b/check.php
@@ -273,8 +273,7 @@ $update_map = array(
 function print_update_xml($buildid, $os, $arch, $lang, $pkgfmt) {
     global $build_hash_to_version, $update_map, $localize_map, $debug;
 
-    if(!array_key_exists($buildid, $build_hash_to_version)
-       || $buildid == $update_map['stable']['gitid']
+    if($buildid == $update_map['stable']['gitid']
        || $buildid == $update_map['latest']['gitid']
     ) {
         error('No update for your LibreOffice version.');
@@ -295,7 +294,8 @@ function print_update_xml($buildid, $os, $arch, $lang, $pkgfmt) {
 #    print "ver : " . $build_hash_to_version[$buildid] . " - " .
 #    	   $update_map['latest']['version'] . "\n";
 
-    $user_ver = explode( '.', $build_hash_to_version[$buildid] );
+    $userver = '0.0.0.0';
+    $user_ver = explode( '.', $userver );
     $latest_ver = explode( '.', $update_map['latest']['version'] );
 
     if ($latest_ver[2] >= $user_ver[2]) { # third digit at index 2
@@ -305,7 +305,7 @@ function print_update_xml($buildid, $os, $arch, $lang, $pkgfmt) {
     }
 
     # don't downgrade RC/prerelease users
-    if(version_compare($new['version'], substr($build_hash_to_version[$buildid], 0, 5), '<')) {
+    if(version_compare($new['version'], substr($userver, 0, 5), '<')) {
          error('No update for your LibreOffice version.');
     }
 

which fakes the incoming LibreOffice version to be 0.0.0.0 (unless it happens to have an “official” buildid that is listed in $build_hash_to_version in check.php), so the update server considers it older than its latest version (which happens to be 4.1.2).

To run a LibreOffice installation against that testing update server, change the UpdateURL= line in its version ini-file (e.g., program/versionrc on Linux) from using http://update.libreoffice.org/ to using http://update-test.libreoffice.org/. Since 8fc7e560db11f424362c8effdeb61eb8d1526256, on platforms other than Windows, for an (implicitly) --without-package-format build the “?pkgfmt=” at the end of that line will be empty; complete it manually with the correct package format (e.g., “deb” or “rpm” for Linux, “dmg” for macOS X).

Then, let the automatic, timer-triggered check kick in or run it manually via Help ▸ Check for Updates....