diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index d0750cfecd..b72a6815cc 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -646,8 +646,10 @@ void DocumentBroker::pollThread() if (dataLoss || _docState.disconnected() == DocumentState::Disconnected::Unexpected) { // Quarantine the last copy, if different. - LOG_WRN((dataLoss ? "Data loss " : "Crash ") << "detected, will quarantine last version of [" - << getDocKey() << "] if necessary. Quarantine enabled: " << bool(_quarantine) + LOG_WRN((dataLoss ? "Data loss " : "Crash ") + << "detected, will quarantine last version of [" << getDocKey() + << "] if necessary. Quarantine enabled: " + << (_quarantine && _quarantine->isEnabled()) << ", Storage available: " << bool(_storage)); if (_storage && _quarantine) { diff --git a/wsd/QuarantineUtil.cpp b/wsd/QuarantineUtil.cpp index 74d6aaf692..4f358e9dc1 100644 --- a/wsd/QuarantineUtil.cpp +++ b/wsd/QuarantineUtil.cpp @@ -100,7 +100,7 @@ void Quarantine::initialize(const std::string& path) void Quarantine::removeQuarantine() { - if (!isQuarantineEnabled()) + if (!isEnabled()) return; FileUtil::removeFile(QuarantinePath, true); @@ -108,7 +108,7 @@ void Quarantine::removeQuarantine() std::size_t Quarantine::quarantineSize() { - if (!isQuarantineEnabled()) + if (!isEnabled()) return 0; std::vector files; @@ -125,7 +125,7 @@ std::size_t Quarantine::quarantineSize() void Quarantine::makeQuarantineSpace() { - if (!isQuarantineEnabled()) + if (!isEnabled()) return; LOG_ASSERT_MSG(!Mutex.try_lock(), "Quarantine Mutex must be taken"); @@ -181,7 +181,7 @@ void Quarantine::makeQuarantineSpace() void Quarantine::clearOldQuarantineVersions() { - if (!isQuarantineEnabled()) + if (!isEnabled()) return; LOG_ASSERT_MSG(!Mutex.try_lock(), "Quarantine Mutex must be taken"); @@ -208,7 +208,7 @@ void Quarantine::clearOldQuarantineVersions() bool Quarantine::quarantineFile(const std::string& docPath) { - if (!isQuarantineEnabled()) + if (!isEnabled()) return false; const std::string linkedFilePath = @@ -250,7 +250,7 @@ bool Quarantine::quarantineFile(const std::string& docPath) std::string Quarantine::lastQuarantinedFilePath() const { - if (!isQuarantineEnabled()) + if (!isEnabled()) return std::string(); std::lock_guard lock(Mutex); diff --git a/wsd/QuarantineUtil.hpp b/wsd/QuarantineUtil.hpp index aafbc439f8..057a145cff 100644 --- a/wsd/QuarantineUtil.hpp +++ b/wsd/QuarantineUtil.hpp @@ -25,6 +25,8 @@ public: static void initialize(const std::string& path); + bool isEnabled() const { return !QuarantinePath.empty(); } + /// Quarantines a new version of the document. bool quarantineFile(const std::string& docName); @@ -35,8 +37,6 @@ public: void removeQuarantinedFiles(); private: - bool isQuarantineEnabled() const { return !QuarantinePath.empty(); } - /// Returns quarantine directory size in bytes. std::size_t quarantineSize();