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

New commits:
commit d966be9f27086ac9b5ca62830347d27e6d90e44f
Author: Pranav Kant <[email protected]>
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 <[email protected]>
    Tested-by: Jan Holesovsky <[email protected]>

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)
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to