desktop/source/app/app.cxx |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 02f93a9d1763336eb655ec13d1cfd1e114246b34
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Oct 9 13:47:39 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Thu Oct 9 22:06:49 2025 +0200

    tdf#167676: do not run updater tasks in headless mode
    
    Also reorder conditions to only check environment variables after normal
    registry settings.
    
    Change-Id: Idac6d7135da366dabf9285310d445925e9e4d1a9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192113
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index b604ceca4955..3a135aff4585 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1439,12 +1439,13 @@ int Desktop::Main()
     Reference<XDesktop2> xDesktop = css::frame::Desktop::create(xContext);
 
 #if HAVE_FEATURE_UPDATE_MAR
-    const char* pUpdaterTestEnable = std::getenv("LIBO_UPDATER_TEST_ENABLE");
-    if (pUpdaterTestEnable || 
officecfg::Office::Update::Update::Enabled::get())
+    if (!rCmdLineArgs.IsHeadless()
+        && (officecfg::Office::Update::Update::Enabled::get()
+            || std::getenv("LIBO_UPDATER_TEST_ENABLE")))
     {
         // check if we just updated
-        const char* pUpdaterRunning = std::getenv("LIBO_UPDATER_TEST_RUNNING");
-        bool bUpdateRunning = 
officecfg::Office::Update::Update::UpdateRunning::get() || pUpdaterRunning;
+        bool bUpdateRunning = 
officecfg::Office::Update::Update::UpdateRunning::get()
+                              || std::getenv("LIBO_UPDATER_TEST_RUNNING");
         if (bUpdateRunning)
         {
             OUString aSeeAlso = 
officecfg::Office::Update::Update::SeeAlso::get();
@@ -1482,9 +1483,7 @@ int Desktop::Main()
         osl::DirectoryItem aUpdateFile;
         osl::DirectoryItem::get(Updater::getUpdateFileURL(), aUpdateFile);
 
-        const char* pUpdaterTestUpdate = 
std::getenv("LIBO_UPDATER_TEST_UPDATE");
-        const char* pForcedUpdateCheck = 
std::getenv("LIBO_UPDATER_TEST_UPDATE_CHECK");
-        if (pUpdaterTestUpdate || aUpdateFile.is())
+        if (aUpdateFile.is() || std::getenv("LIBO_UPDATER_TEST_UPDATE"))
         {
             OUString aBuildID("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" 
SAL_CONFIGFILE("version") ":buildid}");
             rtl::Bootstrap::expandMacros(aBuildID);
@@ -1506,7 +1505,7 @@ int Desktop::Main()
                 return EXIT_SUCCESS;
             }
         }
-        else if (isTimeForUpdateCheck() || pForcedUpdateCheck)
+        else if (isTimeForUpdateCheck() || 
std::getenv("LIBO_UPDATER_TEST_UPDATE_CHECK"))
         {
             sal_uInt64 nNow = tools::Time::GetSystemTicks();
             Updater::log("Update Check Time: " + OUString::number(nNow));

Reply via email to