Commit graph

190 commits

Author SHA1 Message Date
Klaas Freitag
e4604b406f SyncEngine: finalize properly on error with syncjournal 2016-04-06 17:20:48 +02:00
Klaas Freitag
7b1f02fcda SelectiveSync: Verify if the list could be read from journal.
If there is a read error from the database while trying to get
the list from database, make sure to not behave badly because
the list is empty.
2016-04-06 15:01:28 +02:00
Olivier Goffart
3334067d9f Merge branch '2.1'
Conflicts:
	src/gui/socketapi.cpp
2016-04-04 16:58:49 +02:00
Olivier Goffart
434d16941b SyncEngine: fixed restoring files when they are moved in a new directory
Imagine tgus scenario on a read only share that you move file from
one location to a new directory in the read only share.
Creating the read only directory fails for permission error.
But we should also restore the files that have been moved.

IL issue 542
2016-04-04 10:41:12 +02:00
Jocelyn Turcotte
82190eaa81 Refactor the overlay icon logic to show errors as a warning for parent folders #3634
This also remove all smartness from the SocketApi about the status
of a file and solely use info from the current and last sync.
This simplifies the logic a lot and prevents any discrepancy between
the status shown in the activity log and the one displayed on the
overlay icon of a file.

The main benefit of the additional simplicity is that we are able
to push all new status of a file reliably (including warnings for
parent folders) to properly update the icon on overlay implementations
that don't allow us invalidating the status cache, like on OS X.

Both errors and warning from the last sync are now kept in a set,
which is used to also affect parent folders of an error.

To make sure that errors don't become warning icons on a second
sync, SyncFileItem::_hasBlacklistEntry is also interpreted as an error.
This also renames StatusIgnore to StatusWarning to match this semantic.

SyncEngine::aboutToPropagate is used in favor of SyncEngine::syncItemDiscovered
since the latter is emitted before file permission warnings are set on the
SyncFileItem. SyncEngine::finished is not used since we have all the
needed information in SyncEngine::itemCompleted.
2016-03-28 14:29:48 +02:00
Jocelyn Turcotte
69aa39f1f6 Don's use SyncFileStatus for Folder::createGuiLog
SyncFileStatus' purpose is to track overlay icon status.
Instead of putting comments and default: clauses in switch
on both sides about unused enums, use different enums.

This also remove STATUS_NEW which is the equivalent of
STATUS_SYNC in all shell extension implementations, and
remove STATUS_UPDATED and STATUS_STAT_ERROR which have
the same semantic as STATUS_UPTODATE and STATUS__ERROR.
2016-03-28 14:29:47 +02:00
Jocelyn Turcotte
da7b9916e5 Move the SocketApi business logic to a libsync SyncFileStatusTracker class
This will allow testing this code and avoid going through too many
layers to get notified and a file status changed.
2016-03-28 14:29:47 +02:00
Jocelyn Turcotte
2d2c7bc9b8 Move the SyncEngine construction to the Folder constructor
The SyncEngine is now created only once, at construction of the
Folder, instead of being reconstructed on each sync.
2016-03-28 13:26:38 +02:00
Luca Niccoli
6735126c09 Fix crash due to destruction order 2016-03-18 16:41:48 +01:00
Olivier Goffart
80b5f3f43d Never overwrite the size from the db when updating the metadata
the size on the server might be different from the size on the client
with certain backend so it should be ignored.

(cherry picked from commit 9222db6df9b19a21e1bea5a238d745d96a6385e3)
2016-03-17 10:48:49 +01:00
Markus Goetz
9460aa7f21 SyncEngine: Also emit item in other code path
Else a user of this library cannot build a complete list of items.
2016-03-14 18:12:07 +01:00
Jocelyn Turcotte
e91a5c85ff Move the Logger reference back into src/gui 2016-03-03 20:26:48 +01:00
Jocelyn Turcotte
b8227afcaa Move the csync_context creation in SyncEngine
The creation doesn't need to be separated from the SyncEngine anymore.
This allows the SyncEngine to be created in fewer steps if we want to
use it in tests.

This moves most of the direct csync code from Folder into the SyncEngine.
The exclude file logic for the context has been wrapped using the
existing ExcludedFiles class as well.
2016-02-25 20:53:13 +01:00
Olivier Goffart
b3d57f3c7c Cleanup syncengine after the new option not to ask confirmation when everything is removed
Cleanup after pull reuqest  #4389

Do not make the SyncEngine depends on the ConfigFile
2016-02-22 16:14:22 +01:00
Markus Goetz
a76ba06817 Merge pull request #4389 from Bottswana/deleteprompt
Add option to disable the delete all files prompt
2016-02-22 15:44:50 +01:00
Markus Goetz
5d7aa792e7 SyncEngine: Improve error message for ignored files/folders #4143 2016-02-22 11:13:29 +01:00
Olivier Goffart
c93ecfbfb5 Merge branch restore_backup 2016-02-10 17:47:06 +01:00
James Botting
d8af949a6a Alter sync engine to check new setting before displaying prompt 2016-01-24 18:45:29 +00:00
Olivier Goffart
47710d167a SyncEngine: fix inode after move if the file has moved on the file system
This is the fix for issue #4370

Step to reproduce the bug:
 1) have lots of files in directory "dir1"
 2) do mkdir dir2 && mv dir1/* dir2
 3) DURING the sync (which takes time because of the many moves) do mkdir dir3 && mv dir2/* dir3/
 4) observe that files are PUT in the next sync

The problem is that SyncJournalFileRecord::SyncJournalFileRecord will fail to
get the inode after the forst move because the files are already moved on the
filesystem.  Normaly it should use the inode from the discovery phase in that
case but that is not working because it comes from the remote node in case of
moves, so the code in SyncEngine::treewalkFile would not set the inode.

Test in https://github.com/owncloud/smashbox/pull/143
2016-01-20 13:49:12 +01:00
Olivier Goffart
bbedeed1c5 SyncEngine: For server older than 8.1, ignore invalid char in new directories
Server older than 8.1 cannot cope with invalid char in the filename
so we must not send them from the client. We were already checking
for new files, but not for renames or new directories.

https://github.com/owncloud/enterprise/issues/1009
2016-01-13 17:53:12 +01:00
Christian Kamm
abf5a5ad1e Propagation: Fix dir <-> file changes propagating to server #4302
* Ensure every time a file becomes a directory or the other way around
  the item is flagged as INSTRUCTION_TYPE_CHANGE.
* Delete the badly-typed entity if necessary in the propagation jobs.
2016-01-08 05:38:08 +01:00
Daniel Molkentin
9c7066ac47 Translation cleanups
- Disambiguation
- Remove potentially illigitmate concatenations
2016-01-06 16:50:59 +01:00
Jocelyn Turcotte
62df938465 Rename SyncFileStatus::STATUS_SYNC to STATUS_UPTODATE
Also use STATUS_UPDATED instead to match SyncFileItem::Success in the SocketAPI.
2016-01-05 15:41:15 +01:00
Jocelyn Turcotte
6e3809528e Fix OK statuses not being broadcasted during a sync #3944
Since the presence of any path in SyncEngine::_syncedItems
would translate in a SYNC status, platforms that don't refresh
all their status cache after an UPDATE_VIEW message like OS X
or Windows would keep displaying that status even after all
files are successfully synchronized.

- Read SyncFileItem::_status to determine the status to display mid-sync
- Match moved paths also to _renameTarget since this might be the
  path to match
- Make sure that PropagateDirectory jobs also set SyncFileItem::_status
  properly
2016-01-05 15:08:26 +01:00
Christian Kamm
2662203fb7 Windows: Fix deleting and replacing of read-only files #4308 2016-01-05 13:15:59 +01:00
Olivier Goffart
1bb76f5343 Attempt to recover from backup restoration on the server
If all the files bring us to past timestamp, it is possibly a backup
restoration in the server. In which case we want don't want to just
overwrite newer files with the older ones.

Issue #2325
2016-01-05 12:14:18 +01:00
Christian Kamm
2458f07ca1 Checksums: Reuse the discovery checksum where possible 2015-11-23 14:13:10 +01:00
Christian Kamm
6cf5fc7f7d Permissions: Keep more user permissions
t4.pl discovered that it'd needlessly override permissions sometimes
2015-11-23 13:24:05 +01:00
Christian Kamm
a25f094c4c Checksums: Don't reupload if size and checksum are unchanged #3235
* Compute the content checksum (in addition to the optional
  transmission checksum) during upload (.eml files only)

* Add hook to compute and compare the checksum in csync_update

* Add content checksum to database, remove transmission checksum
2015-11-23 11:59:56 +01:00
Olivier Goffart
0020211857 owncloudcmd: Don't do a check that file are older than 2s (#4160)
This is required for the smashbox test to pass
2015-11-20 15:16:09 +01:00
Klaas Freitag
62d26814b2 SyncEngine: Handle 403 Forbidden properly.
A 403 is a reply code sent from the file firewall to indicate that
this directory is forbidden to use for the user.

The patch handles it by setting the state to IGNORED.

This addresses #3490
2015-11-18 15:31:55 +01:00
Christian Kamm
17dd199cba Checksums: Treat more carefully in db #4034
In particular, preserve them on local rename or remote move.
2015-11-10 15:05:00 +01:00
Christian Kamm
175ad6fb77 Reflect read-only permissions in filesystem #3244 2015-11-10 10:14:25 +01:00
Olivier Goffart
0c467ef5b4 Sync engine: fix signal/slot connection 2015-10-30 13:21:34 +01:00
Olivier Goffart
c3cf6aef7d SyncEngine: Don't whipe the white list if the sync was aborted
Issue #4018
2015-10-29 16:47:39 +01:00
Olivier Goffart
38a8e5ee03 Discovery: conding style: use const references for function parameters 2015-10-29 16:47:36 +01:00
ckamm
251679253a Merge pull request #3951 from ckamm/checksum
Checksums stored in database #3735
2015-10-29 10:40:24 +01:00
Christian Kamm
496b1e907d Checksum: Don't lose it on metadata update #3735
Also improve tests.
2015-10-28 14:49:55 +01:00
Markus Goetz
a6c9e8c5b4 Merge branch 'kill_legacy_propagator' 2015-10-28 11:06:50 +01:00
Markus Goetz
9337927722 legacy propagator: Remove more code 2015-10-28 10:59:02 +01:00
Olivier Goffart
cf242871ea SyncEngine: keep a static pointer to the codec
The QTextCodec for UTF-8 is not going to change during the application life time.
So no need to look it up for every file
2015-10-21 16:38:26 +02:00
Olivier Goffart
9c388787bb csync_update: Don't fetch the etag in the local discovery from the DB
We don't need it, and it's slow.
This saves a lot of DB queries

(Also replaced a strlen>0 with a faster check)
2015-10-21 16:38:26 +02:00
Markus Goetz
c8590c4468 Remove legacy propagator and neon
The code was already uneeded/unbuilt on Windows and OS X.
2015-10-20 17:57:43 +02:00
Markus Goetz
ccec186b98 ETagJob: Depth 0 for server >= 8.1 #3730 2015-10-19 15:31:27 +02:00
Olivier Goffart
df135a0bb2 Merge branch '2.0'
Conflicts:
	src/gui/folder.cpp
2015-10-19 10:57:37 +02:00
Olivier Goffart
0c59c85127 SyncEngine: Folders with ignored files should not count when counting none files
If there is a any none files, we do not show the dialog saying that all
files have been removed. If a directory contiains ignored files, we still
want to show this message box even if the directory will not be deleted
2015-10-16 11:43:52 +02:00
Phil Davis
f0e17fd9c0 libtypos comment and message typos for master 2015-10-05 09:05:09 +05:45
Christian Kamm
efefc2d986 Merge branch '2.0'
Conflicts:
	doc/images/menu.png
	doc/images/settings_network.png
2015-10-02 15:44:50 +02:00
Christian Kamm
cf9e5ffb0b Remove dead code
no_recursive_propfind does not exist anymore.
2015-10-02 15:17:19 +02:00
Christian Kamm
36e8e9ebf5 Propagator: Download disk space checks #2939
* There's a critical 50 MB threshold under which syncs abort
  (OWNCLOUD_CRITICAL_FREE_SPACE)
* The sync client always keeps 250 MB free
  (OWNCLOUD_FREE_SPACE)
2015-10-01 12:59:05 +02:00
Christian Kamm
12dc372b21 Sync: An initial diskspace check #2939
* Before each sync, check that there are at least
  250 MB of space available and abort otherwise.
* Can be overridden with OWNCLOUD_MIN_FREE_SPACE
2015-10-01 10:25:35 +02:00
Daniel Molkentin
f1a9e669b4 SyncEngine: fix typo 2015-09-14 13:57:51 +02:00
Klaas Freitag
df534753b1 csync_update: Handle permission denied as soft error in discovery.
For that, treat the not accessible directory as if it were ignored.

This will fix #3767
2015-09-09 14:12:13 +02:00
Daniel Molkentin
66f340734c Consistency: Use folder instead of directory in user visible strings 2015-09-07 08:51:40 +02:00
Christian Kamm
5bd631e8e7 Rename jobCompleted -> itemCompleted.
Because that's what's going on. A job can 'complete an item' or 'finish'.
Note that several jobs could complete the same item: a new directory
will complete on the PropagateRemoteMkdir and the PropagateDirectory
jobs.
2015-08-11 15:19:09 +02:00
Christian Kamm
fe42c1a818 Activity: Skip PropagateDirectory jobs #3580
Previously, PropagateDirectory jobs didn't emit the completed() signal.
Now that they do, we need to make sure to not add extra lines to the
protocol widget for them.

To accomplish that, the jobCompleted() signal now also contains the job
that completed the item.
2015-08-11 15:19:09 +02:00
Markus Goetz
6110a99afc SyncEngine: Fix previous cherry-pick 2015-08-11 11:35:12 +02:00
Olivier Goffart
9dcce01e54 csync: ignore files/folder for which stat fails
instead of pretending it suicceed and not recursing in it.

This fixes a bug in which a folder with a too long name would be properly
created, then removed on the server in the next sync.

(cherry picked from commit 4bbf7669091cde7ec726b1708d8c54427b68f016)

Conflicts:
	csync/src/csync.h
	csync/src/csync_exclude.h
	csync/src/csync_update.c
2015-08-11 11:17:20 +02:00
Markus Goetz
7985c0d7f1 Merge pull request #3531 from jturcotte/master
Remove need for UPDATE_VIEW to refetch the status #2340
2015-08-06 11:03:28 +02:00
Markus Goetz
f6cd2c79d5 CSync: Proper error for invalid filenames #2777 #3128 #2240 2015-08-04 22:13:38 +02:00
Jocelyn Turcotte
78b63c34cb Do not add all remote directories to the SyncItemVector
To allow forwarding all OK states of sync jobs to the socket API
we need to make sure that the vector doesn't contain unneeded items.

This initially was intended to force updating the metadata for parent
folders, but since then the should_update_metadata flag check was
added both here and in PropagateDirectory::finalize where the metadata
is actually updated for parent folders. We can safely remove the inclusion
of all remote directory items.
2015-07-31 21:59:58 +02:00
Jocelyn Turcotte
26d137cac6 SocketApi: Remove an unneeded emit syncItemDiscovered
The signal is emitted in this case if the instruction is NONE
but in the only ultimately connected slot to this signal,
SocketApi::slotSyncItemDiscovered, we return early according
to the same condition.

The emission of the same signal at the end of treewalkFile remains
and take care of the normal cases.
2015-07-31 21:59:58 +02:00
Olivier Goffart
0ccaae9a22 Confirm feature: Confirm for any folder, not only shared ones
issue #3148
2015-07-27 09:54:20 +02:00
Klaas Freitag
3a5f66e976 SyncEngine: Remove bogus logging. 2015-07-15 15:54:41 +02:00
Klaas Freitag
9461e4ccd1 Sync: Only copy the hasIgnoredFlag for the remote side.
Also added some documentation about the handling.
2015-07-15 15:53:58 +02:00
Klaas Freitag
b0aedef4b0 Sync: Store information about ignored files on the server in database.
That allows better handling of remove requests that should not be done
because the directory is not empty on the remote side (as it contains
ignored files).
2015-07-15 15:49:27 +02:00
Klaas Freitag
7aa2b50828 csync_update: Handling hidden files as excluded files, as intended. 2015-07-15 15:20:46 +02:00
Christian Kamm
7edb57e46c Fix error message for invalid chars in filename #3432 2015-07-15 10:38:33 +02:00
Olivier Goffart
45180a024d Rename should_update_etag to should_update_metadata
This should avoid some confusion
2015-07-09 15:05:37 +02:00
Olivier Goffart
575ca50aac csync: Do not ignore hard links anymore
There is no reason to ignore them. Downloading a file that is hardlinked
will break the link.

Will solve syncing NTFS directories #3241
2015-07-01 13:05:08 +02:00
Olivier Goffart
2e177590a6 libsync: Remove some Theme dependency
Theme will eventually be moved to the GUI

Theme::appNameGUI and QApplicaiton::applicationName are the same, it is currently
set in the constructor of ConfigFile
2015-06-15 17:39:28 +02:00
Olivier Goffart
11c8415cd6 Coverity do not support non-static data initializer
Fixes #3337
2015-06-12 13:57:17 +02:00
Olivier Goffart
16786eed54 Merge pull request #3281 from owncloud/confirm
Confirm feature (sync engine part only)
2015-06-10 13:39:52 +02:00
Olivier Goffart
e135d4cccf Merge remote-tracking branch 'origin/1.8' 2015-06-10 13:42:02 +02:00
Klaas Freitag
fc2ceb88fb Rename thread to SyncEngine Thread to avoid confusion about Neon. 2015-06-06 10:49:47 +02:00
Olivier Goffart
a621223cc8 SyncEngine: add an api to set the maximum size of new shared folder that do not require confirmation 2015-05-26 14:41:01 +02:00
Olivier Goffart
7bb2834d8b Confirm feature (The sync engine part) 2015-05-26 12:34:07 +02:00
Olivier Goffart
10d9e53159 Confirm feature: Use selective sync in the database 2015-05-26 12:34:07 +02:00
Olivier Goffart
6b27d2e703 Merge remote-tracking branch 'origin/1.8' 2015-05-26 12:28:31 +02:00
Markus Goetz
3556ed416c SyncJournalDB: Simplify code 2015-05-13 13:15:53 +02:00
Markus Goetz
e5e2ce2b22 SyncEngine: Force re-read of folder Etags for upgrades from 1.8.0 and 1.8.1
This is a better fix than the previous one for the local-files-missing bug
because it does not depend on the sync run to run fully through.
2015-05-13 12:54:49 +02:00
Markus Goetz
08184d07cf Merge branch '1.9' 2015-05-12 23:03:45 +02:00
Olivier Goffart
76166c6252 SyncEngine: Fix comment
A comment should descibe the code, and not a patch.
2015-05-12 17:53:02 +02:00
Daniel Molkentin
f315423811 Merge remote-tracking branch 'origin/1.8'
Conflicts:
	VERSION.cmake
2015-05-06 10:04:22 +02:00
Klaas Freitag
d63abef718 SyncEngine: Handle upgrade case from 1.8.0
If 1.8.0 caused missing data in the local tree, this patch gets it
back. For that, the usage of the journal for remote repository is
disabled at the first start.
2015-05-04 13:40:25 +02:00
Christian Kamm
96ecdb866d Time estimate: Refactor remaining time guess. #2328 2015-04-22 11:20:31 +02:00
Christian Kamm
7d68c628db Time estimation: Use a consistent check for size dependence. #2328 2015-04-22 10:45:41 +02:00
Jocelyn Turcotte
12d7484b85 Pass SyncFileItems by pointer instead of by value
Use a QSharedPointer to keep the same ownership and
continue passing the SyncFileItems as a const& when
ownership isn't taken. This allows sharing the same
allocations between the jobs and the result vectors.

This saves about 20MB of memory (off 120MB) once all
jobs are created.
2015-04-18 14:26:40 +02:00
Olivier Goffart
8bb4af067a Propagate download: Fix restoring files for which the conflict file exists
For issue #3106

1) Always use the actual timestamp from the file in the file system
to create the conflict file.  This is important because if one edit a
file several time, they should have different name. Also it makes more
sens to have the mtime of the modified file.

2) Give the correct size to the job so we know when the temporary file
is complete in case of resuming.
2015-04-16 11:36:01 +02:00
Christian Kamm
adcf40afc3 Discovery: Speed up initial run. #2796 2015-04-08 15:43:49 +02:00
Christian Kamm
d986011067 Sync: Fix sync of deletions during 503. #2894 2015-04-08 10:50:08 +02:00
Markus Goetz
9b9f0bdd4d SyncEngine: Show more timing measurements #3064 2015-04-02 15:18:46 +02:00
Olivier Goffart
dafc2d2b73 Sync engine: Check the blacklist for the right tree
When the operation is download, we have a INSTRUCTION_NONE for the local
tree, but we should not check the blacklist just yet.
2015-03-24 12:23:04 +01:00
Christian Kamm
9249d6c2f9 Logging: Print instruction when job completed. 2015-03-12 10:26:44 +01:00
Markus Goetz
b622981b23 SyncEngine: Show a debug msg only when relevant 2015-03-06 09:28:50 +01:00
Markus Goetz
3f712dce02 ETags: For Folder and RequestEtagJob, always use Concatenation 2015-03-05 17:49:12 +01:00
Markus Goetz
2eaeaf33fa Discovery: Change abort code a bit
Now pressing pause in the UI will not show an error to the user.
2015-03-05 16:50:33 +01:00
Olivier Goffart
ccbeb86140 Fix build of the legacy propagator 2015-03-03 10:05:38 +01:00
Markus Goetz
fe574dbbf9 Discovery: Free some memory before propagate (#2902) 2015-03-02 15:08:21 +01:00
Christian Kamm
b03209ccef Inform user about ignored long files. #2882 2015-02-27 12:12:39 +01:00