From 9c0049cfae49c8e4ddef9125a69db2ad134c10c6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 7 Jun 2024 13:48:25 +0200 Subject: Merging upstream version 4:24.2.4. Signed-off-by: Daniel Baumann --- desktop/source/app/updater.cxx | 48 ++++++++++++------------------------------ desktop/source/app/updater.hxx | 3 --- 2 files changed, 13 insertions(+), 38 deletions(-) (limited to 'desktop/source/app') diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx index 12bb4969a6..d60c006f6b 100644 --- a/desktop/source/app/updater.cxx +++ b/desktop/source/app/updater.cxx @@ -29,7 +29,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -553,7 +555,7 @@ size_t WriteCallbackFile(void *ptr, size_t size, std::string download_content(const OString& rURL, bool bFile, OUString& rHash) { - Updater::log("Download: " + rURL); + Updater::log("Download: " + OStringToOUString(rURL, osl_getThreadTextEncoding())); std::unique_ptr> curl( curl_easy_init(), [](CURL * p) { curl_easy_cleanup(p); }); @@ -729,7 +731,7 @@ void update_checker() OUString aDownloadCheckURL = aDownloadCheckBaseURL + "update/check/1/" + aProductName + "/" + aBuildID + "/" + aBuildTarget + "/" + aChannel; OString aURL = OUStringToOString(aDownloadCheckURL, RTL_TEXTENCODING_UTF8); - Updater::log("Update check: " + aURL); + Updater::log("Update check: " + OStringToOUString(aURL, osl_getThreadTextEncoding())); try { @@ -779,38 +781,30 @@ void update_checker() catch (const invalid_update_info&) { SAL_WARN("desktop.updater", "invalid update information"); - Updater::log(OString("warning: invalid update info")); + Updater::log("warning: invalid update info"); } catch (const error_updater& e) { SAL_WARN("desktop.updater", "error during the update check: " << e.what()); - Updater::log(OString("warning: error by the updater") + e.what()); + Updater::log("warning: error by the updater" + o3tl::runtimeToOUString(e.what())); } catch (const invalid_size& e) { SAL_WARN("desktop.updater", e.what()); - Updater::log(OString("warning: invalid size")); + Updater::log("warning: invalid size"); } catch (const invalid_hash& e) { SAL_WARN("desktop.updater", e.what()); - Updater::log(OString("warning: invalid hash")); + Updater::log("warning: invalid hash"); } catch (...) { SAL_WARN("desktop.updater", "unknown error during the update check"); - Updater::log(OString("warning: unknown exception")); + Updater::log("warning: unknown exception"); } } -OUString Updater::getUpdateInfoLog() -{ - OUString aUpdateInfoURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/updates/updating.log"); - rtl::Bootstrap::expandMacros(aUpdateInfoURL); - - return aUpdateInfoURL; -} - OUString Updater::getPatchDirURL() { OUString aPatchDirURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/updates/0/"); @@ -843,30 +837,14 @@ OUString Updater::getExecutableDirURL() void Updater::log(const OUString& rMessage) { SAL_INFO("desktop.updater", rMessage); - OUString aUpdateLog = getUpdateInfoLog(); - SvFileStream aLog(aUpdateLog, StreamMode::STD_READWRITE); + OUString dir("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/updates"); + rtl::Bootstrap::expandMacros(dir); + osl::Directory::create(dir); + SvFileStream aLog(dir + "/updating.log", StreamMode::STD_READWRITE); aLog.Seek(aLog.Tell() + aLog.remainingSize()); // make sure we are at the end aLog.WriteLine(OUStringToOString(rMessage, RTL_TEXTENCODING_UTF8)); } -void Updater::log(const OString& rMessage) -{ - SAL_INFO("desktop.updater", rMessage); - OUString aUpdateLog = getUpdateInfoLog(); - SvFileStream aLog(aUpdateLog, StreamMode::STD_READWRITE); - aLog.Seek(aLog.Tell() + aLog.remainingSize()); // make sure we are at the end - aLog.WriteLine(rMessage); -} - -void Updater::log(const char* pMessage) -{ - SAL_INFO("desktop.updater", pMessage); - OUString aUpdateLog = getUpdateInfoLog(); - SvFileStream aLog(aUpdateLog, StreamMode::STD_READWRITE); - aLog.Seek(aLog.Tell() + aLog.remainingSize()); // make sure we are at the end - aLog.WriteOString(pMessage); -} - OUString Updater::getBuildID() { OUString aBuildID("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("version") ":buildid}"); diff --git a/desktop/source/app/updater.hxx b/desktop/source/app/updater.hxx index 7f1ea920fb..3fc7677480 100644 --- a/desktop/source/app/updater.hxx +++ b/desktop/source/app/updater.hxx @@ -18,7 +18,6 @@ void update_checker(); class Updater { public: - static OUString getUpdateInfoLog(); static OUString getPatchDirURL(); static OUString getUpdateFileURL(); static OUString getExecutableDirURL(); @@ -28,8 +27,6 @@ public: static OUString getUpdateChannel(); static void log(const OUString& rMessage); - static void log(const OString& rMessage); - static void log(const char* pMessage); static void removeUpdateFiles(); }; -- cgit v1.2.3