Skip to content

Commit

Permalink
Increase logging around file removal events
Browse files Browse the repository at this point in the history
To better see what is going on when and if files are removed by the
client.

See also: #260, #1433, #2913
  • Loading branch information
Felix Weilbach committed Mar 19, 2021
1 parent b3d5b49 commit fcb0f2d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/libsync/discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
// Not modified locally (ParentNotChanged)
if (noServerEntry) {
// not on the server: Removed on the server, delete locally
qCInfo(lcDisco) << "File" << item->_file << "is not anymore on server. Going to delete it locally.";
item->_instruction = CSYNC_INSTRUCTION_REMOVE;
item->_direction = SyncFileItem::Down;
} else if (dbEntry._type == ItemTypeVirtualFileDehydration) {
Expand All @@ -739,6 +740,7 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
} else if (!serverModified) {
// Removed locally: also remove on the server.
if (!dbEntry._serverHasIgnoredFiles) {
qCInfo(lcDisco) << "File" << item->_file << "was deleted locally. Going to delete it on the server.";
item->_instruction = CSYNC_INSTRUCTION_REMOVE;
item->_direction = SyncFileItem::Up;
}
Expand Down Expand Up @@ -777,6 +779,7 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
} else if (!typeChange && ((dbEntry._modtime == localEntry.modtime && dbEntry._fileSize == localEntry.size) || localEntry.isDirectory)) {
// Local file unchanged.
if (noServerEntry) {
qCInfo(lcDisco) << "File" << item->_file << "is not anymore on server. Going to delete it locally.";
item->_instruction = CSYNC_INSTRUCTION_REMOVE;
item->_direction = SyncFileItem::Down;
} else if (dbEntry._type == ItemTypeVirtualFileDehydration || localEntry.type == ItemTypeVirtualFileDehydration) {
Expand Down
2 changes: 2 additions & 0 deletions src/libsync/propagateremotedelete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Q_LOGGING_CATEGORY(lcPropagateRemoteDelete, "nextcloud.sync.propagator.remotedel

void PropagateRemoteDelete::start()
{
qCInfo(lcPropagateRemoteDelete) << "Start propagate remote delete job";

if (propagator()->_abortRequested)
return;

Expand Down
4 changes: 3 additions & 1 deletion src/libsync/propagatorjobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ bool PropagateLocalRemove::removeRecursively(const QString &path)

void PropagateLocalRemove::start()
{
qCInfo(lcPropagateLocalRemove) << "Start propagate local remove job";

_moveToTrash = propagator()->syncOptions()._moveFilesToTrash;

if (propagator()->_abortRequested)
return;

const QString filename = propagator()->fullLocalPath(_item->_file);
qCDebug(lcPropagateLocalRemove) << filename;
qCInfo(lcPropagateLocalRemove) << "Going to delete:" << filename;

if (propagator()->localFileNameClash(_item->_file)) {
done(SyncFileItem::NormalError, tr("Could not remove %1 because of a local file name clash").arg(QDir::toNativeSeparators(filename)));
Expand Down

0 comments on commit fcb0f2d

Please sign in to comment.