wsd/LOOLWSD.cpp |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 4d0ae969e12225fe875270b8fb2d3b0e08e35e44
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Tue May 26 15:12:13 2020 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Wed May 27 12:56:02 2020 +0200

    wsd: expose version-hash programmatically
    
    Passing --version-hash to loolwsd now prints the
    hash and exits. This is designed to be used with
    proxy.php to check the version running.
    
    Also, include the version and hash in the
    hosting/capabilities JSON response.
    
    Note that --version still prints/logs the version
    and doesn't exit. It seems that is designed to
    log it before running, and so it might be used
    in the wild. Changing the behavior in minor upgrade
    might break some production servers that have
    --version added to their execution command-line.
    
    Change-Id: I30e6945f797a902ed4b3aae6f5f1b8518000946b
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94911
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index a5212dffc..57b7c926f 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1407,7 +1407,11 @@ void LOOLWSD::defineOptions(OptionSet& optionSet)
                         .required(false)
                         .repeatable(false));
 
-    optionSet.addOption(Option("version", "", "Display version information.")
+    optionSet.addOption(Option("version-hash", "", "Display product 
version-hash information.")
+                        .required(false)
+                        .repeatable(false));
+
+    optionSet.addOption(Option("version", "", "Display version and hash 
information.")
                         .required(false)
                         .repeatable(false));
 
@@ -1484,6 +1488,13 @@ void LOOLWSD::handleOption(const std::string& optionName,
         displayHelp();
         std::exit(EX_OK);
     }
+    else if (optionName == "version-hash")
+    {
+        std::string version, hash;
+        Util::getVersionInfo(version, hash);
+        std::cout << hash << std::endl;
+        std::exit(EX_OK);
+    }
     else if (optionName == "version")
         DisplayVersion = true;
     else if (optionName == "port")
@@ -3250,6 +3261,12 @@ private:
         // Set the product name
         capabilities->set("productName", APP_NAME);
 
+        // Set the product version
+        capabilities->set("productVersion", LOOLWSD_VERSION);
+
+        // Set the product version hash
+        capabilities->set("productVersionHash", LOOLWSD_VERSION_HASH);
+
         // Set that this is a proxy.php-enabled instance
         capabilities->set("hasProxyPrefix", LOOLWSD::IsProxyPrefixEnabled);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to