summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-04-28 01:28:28 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-05-19 03:43:33 +0200
commitff65b97cf29bda2a46e3a19d535d67b062a8f3fa (patch)
tree526dc18021719ce852486be2450a3ea25f960156 /desktop
parente8bcef2c53e7b9d928d4fa138d181daafbc097ad (diff)
log all the updater actions
Change-Id: Ia7b08c4e93d5b3b65b0f44af9c92f5e6f6fafd96
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/updater.cxx40
-rw-r--r--desktop/source/app/updater.hxx3
2 files changed, 42 insertions, 1 deletions
diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index cad36200daaa..b57b3d1879ba 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -233,6 +233,7 @@ void update()
void CreateValidUpdateDir(const update_info& update_info)
{
+ Updater::log(OString("Create Update Dir"));
OUString aInstallDir("$BRAND_BASE_DIR");
rtl::Bootstrap::expandMacros(aInstallDir);
OUString aInstallPath = getPathFromURL(aInstallDir);
@@ -255,6 +256,7 @@ void CreateValidUpdateDir(const update_info& update_info)
{
// TODO: remove the update directory
SAL_WARN("desktop.updater", "failed to update");
+ Updater::log(OUString("failed to create update dir"));
}
else
{
@@ -471,6 +473,7 @@ size_t WriteCallbackFile(void *ptr, size_t size,
std::string download_content(const OString& rURL, bool bFile, OUString& rHash)
{
+ Updater::log("Download: " + rURL);
CURL* curl = curl_easy_init();
if (!curl)
@@ -606,7 +609,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);
try
{
@@ -620,10 +623,16 @@ void update_checker()
// No update currently available
// add entry to updating.log with the message
SAL_WARN("desktop.updater", "Message received from the updater: " << aUpdateInfo.aMessage);
+ Updater::log("Server response: " + aUpdateInfo.aMessage);
}
else
{
download_file(aUpdateInfo.aUpdateFile.aURL, aUpdateInfo.aUpdateFile.nSize, aUpdateInfo.aUpdateFile.aHash, "update.mar");
+ for (auto& lang_update : aUpdateInfo.aLanguageFiles)
+ {
+ OUString aFileName = "update_" + lang_update.aLangCode + ".mar";
+ download_file(lang_update.aUpdateFile.aURL, lang_update.aUpdateFile.nSize, lang_update.aUpdateFile.aHash, aFileName);
+ }
CreateValidUpdateDir(aUpdateInfo);
}
}
@@ -631,22 +640,27 @@ void update_checker()
catch (const invalid_update_info&)
{
SAL_WARN("desktop.updater", "invalid update information");
+ Updater::log(OString("warning: invalid update info"));
}
catch (const error_updater&)
{
SAL_WARN("desktop.updater", "error during the update check");
+ Updater::log(OString("warning: error by the updater"));
}
catch (const invalid_size& e)
{
SAL_WARN("desktop.updater", e.what());
+ Updater::log(OString("warning: invalid size"));
}
catch (const invalid_hash& e)
{
SAL_WARN("desktop.updater", e.what());
+ Updater::log(OString("warning: invalid hash"));
}
catch (...)
{
SAL_WARN("desktop.updater", "unknown error during the update check");
+ Updater::log(OString("warning: unknown exception"));
}
}
@@ -658,6 +672,14 @@ OUString Updater::getUpdateInfoURL()
return aUpdateInfoURL;
}
+OUString Updater::getUpdateInfoLog()
+{
+ OUString aUpdateInfoURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/patch/updating.log");
+ rtl::Bootstrap::expandMacros(aUpdateInfoURL);
+
+ return aUpdateInfoURL;
+}
+
OUString Updater::getPatchDirURL()
{
OUString aPatchDirURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/patch/");
@@ -682,4 +704,20 @@ OUString Updater::getExecutableDirURL()
return aExeDir;
}
+void Updater::log(const OUString& 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(OUStringToOString(rMessage, RTL_TEXTENCODING_UTF8));
+}
+
+void Updater::log(const OString& 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);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/app/updater.hxx b/desktop/source/app/updater.hxx
index b36c1f91b306..f3f28bc638ec 100644
--- a/desktop/source/app/updater.hxx
+++ b/desktop/source/app/updater.hxx
@@ -23,10 +23,13 @@ private:
public:
static OUString getUpdateInfoURL();
+ static OUString getUpdateInfoLog();
static OUString getPatchDirURL();
static OUString getUpdateDirURL();
static OUString getExecutableDirURL();
+ static void log(const OUString& rMessage);
+ static void log(const OString& rMessage);
};
#endif