[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - wsd/DocumentBroker.cpp wsd/Storage.cpp

Pranav Kant pranavk at collabora.co.uk
Tue Jun 20 12:03:53 UTC 2017


 wsd/DocumentBroker.cpp |   13 -------------
 wsd/Storage.cpp        |    4 ++++
 2 files changed, 4 insertions(+), 13 deletions(-)

New commits:
commit d966be9f27086ac9b5ca62830347d27e6d90e44f
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed May 31 23:04:32 2017 +0530

    Remove superfluous WOPI calls to getFileInfo to check timestamp
    
    One can add the timetamp information in the PutFile call itself. This
    way we can avoid making an extra CheckFileInfo call here.
    
    Change-Id: Iae180262e648c36b9cfeb6d5fabdf5d243b93afb
    (cherry picked from commit 15a4474572a231f6a3f3ef713d2e69cea0af7297)
    Reviewed-on: https://gerrit.libreoffice.org/38526
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 0d43adca..138b9bb7 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -613,19 +613,6 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId,
         _lastSaveTime = std::chrono::steady_clock::now();
         _poll->wakeup();
 
-        // Calling getWOPIFileInfo() or getLocalFileInfo() has the side-effect of updating
-        // StorageBase::_fileInfo. Get the timestamp of the document as persisted in its storage
-        // from there.
-        // FIXME: Yes, of course we should turn this stuff into a virtual function and avoid this
-        // dynamic_cast dance.
-        if (dynamic_cast<WopiStorage*>(_storage.get()) != nullptr)
-        {
-            auto wopiFileInfo = static_cast<WopiStorage*>(_storage.get())->getWOPIFileInfo(accessToken);
-        }
-        else if (dynamic_cast<LocalStorage*>(_storage.get()) != nullptr)
-        {
-            auto localFileInfo = static_cast<LocalStorage*>(_storage.get())->getLocalFileInfo();
-        }
         // So set _documentLastModifiedTime then
         _documentLastModifiedTime = _storage->getFileInfo()._modifiedTime;
 
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index 2bef868c..5725c58e 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -291,6 +291,10 @@ StorageBase::SaveResult LocalStorage::saveLocalFileToStorage(const std::string&
         {
             LOG_INF("Copying " << _jailedFilePath << " to " << _uri.getPath());
             Poco::File(_jailedFilePath).copyTo(_uri.getPath());
+
+            // update its fileinfo object. This is used later to check if someone else changed the
+            // document while we are/were editing it
+            _fileInfo._modifiedTime = Poco::File(_uri.getPath()).getLastModified();
         }
     }
     catch (const Poco::Exception& exc)


More information about the Libreoffice-commits mailing list