Commit graph

129 commits

Author SHA1 Message Date
Olivier Goffart
bf7ca60bec Move csync in order to merge it with mirall 2014-01-13 14:39:50 +01:00
hefee
7e2dec5228 fixing typo 2013-12-11 18:31:31 +01:00
Olivier Goffart
ba8fa9a403 Do not 'normalize' etag when we read from db
Normalize removes the quote and the -gzip.
We assume that the normalized etag is in the DB
This is how it worked in mirall 1.4

We added normalization in case there is a -gzip saved to the database.
But since this was broken in 1.4 anyway, it will just force a
re-download if -gzip was added. (1.4 anyway is broken with such
server and always do redownload all the time)
2013-12-11 12:50:45 +01:00
Olivier Goffart
1b4e2becb3 Use csync_normalize_etag everywhere.
Technically, we don't need to strip '-gzip' from the etag comming from
the propfind, but it is better to be consistant.
2013-12-11 11:35:55 +01:00
Klaas Freitag
8fd921f796 Rather use unit64_t than ino_t which causes trouble on win32.
This fixes https://github.com/owncloud/mirall/issues/1239
2013-12-05 12:49:01 +01:00
Olivier Goffart
60636cdbd5 inode 0 is invalid: don't try to match it from a DB
Otherwise, a new file with an invalid inode is considered like a rename
of another file with an invalid inode
2013-12-03 12:51:18 +01:00
Klaas Freitag
c22758201f Don't miss to read the fileid from database. 2013-11-27 13:21:48 +01:00
Olivier Goffart
87792b59e6 Fix -gzip removal from etag
Removes when the etag is both "foo-gzip" or "foo"-gzip

Add to patch for
https://github.com/owncloud/mirall/issues/1195
2013-11-26 11:55:47 +01:00
Olivier Goffart
e146de9ea2 Remove -gzip from the etag
Both from what comes from the server (https://github.com/owncloud/mirall/issues/1195)
Or what was in the db if upgrading from old database
2013-11-25 16:19:59 +01:00
Olivier Goffart
11a131fa90 csync_statedb_query: Allow null fields in the database
The fileid defaults to null for old database.
Since commit 4b8f2a287f,  we query
 the file id to get the etag.
c_strlist_add cannot append null entries, so it would just discard
the md5 instead
2013-11-14 14:41:36 +01:00
Olivier Goffart
4d146e87d1 Remove INVALID_FILE_ID and consider empty file id as invalid 2013-11-14 13:43:26 +01:00
Klaas Freitag
4b8f2a287f Retrieve file_id together with etag from db if read from db. 2013-11-14 11:32:03 +01:00
Klaas Freitag
3cc2593f62 Handle invalid file_id correctly. 2013-11-14 11:31:30 +01:00
Olivier Goffart
908888a44e Rename 'md5' to 'etag'
'md5' always has been the etag. The name md5 for it is misleading.
It is still called "md5" in the database to keep compatibility
2013-11-13 14:29:31 +01:00
Klaas Freitag
95cc4c310b Read all data incl. file_id in get_stat_by_inode. 2013-11-06 11:29:56 +01:00
Klaas Freitag
f196fb582a Check for empty file Id before querying. 2013-10-28 14:34:30 +01:00
Klaas Freitag
7e9490545b Add a function to query the journal by the file_id. 2013-10-25 13:14:25 +02:00
Klaas Freitag
a52fd99a95 Removed database writing code.
All this is now done in the Qt based propagator class.
2013-10-23 17:51:16 +02:00
Klaas Freitag
e7b94e437e Merge remote-tracking branch 'freitag/dav' into ocsync 2013-10-23 14:37:12 +02:00
Klaas Freitag
74c6426075 Fix call to atoll, just pass the buffer 2013-10-22 17:58:18 +02:00
Klaas Freitag
e16560249c Use atoll to convert inode from db query results. 2013-10-22 17:49:49 +02:00
Klaas Freitag
9cb3af801a Fixes for win32 after upstream merge. 2013-09-10 12:59:29 +02:00
Klaas Freitag
4cc1ef3624 Merge remote-tracking branch 'freitag/dav' into ocsync
Conflicts:
	src/csync_propagate.c
	src/csync_statedb.c
2013-09-04 15:51:38 +02:00
Klaas Freitag
8b224e2c0a Don't warn about a finished sqlite3 query. 2013-09-03 11:47:19 +02:00
Olivier Goffart
835813a86f Fix the tests after merge 2013-08-18 20:13:27 +02:00
Olivier Goffart
56d5359f5b Fix compilation after merge
Still untetested
2013-08-18 18:55:32 +02:00
Markus Goetz
b923554935 Revert "DB: Don't use metadata_tmp table"
Let's not do this in the release branch

This reverts commit 79f72a1211.
2013-08-18 17:13:19 +02:00
Markus Goetz
6474780d80 Revert "DB: More easy IO mode"
This reverts commit ea6caed5a3.
2013-08-18 17:12:59 +02:00
Markus Goetz
79f72a1211 DB: Don't use metadata_tmp table
Not sure why this was ever needed
2013-08-18 17:05:04 +02:00
Olivier Goffart
2afdc9d095 Adapt to new multybyte api after merge
(Search and replace)
2013-08-18 16:43:46 +02:00
Olivier Goffart
b5ed352aa3 Merge remote-tracking branch 'origin/master' into ocsync
Only confluct resolution, do not compile or works

Conflicts:
	CMakeLists.txt
	CPackConfig.cmake
	ConfigureChecks.cmake
	client/csync_client.c
	cmake/Modules/DefineCompilerFlags.cmake
	cmake/Modules/DefineInstallationPaths.cmake
	cmake/Modules/FindIconv.cmake
	cmake/Modules/FindIniparser.cmake
	cmake/Modules/FindNeon.cmake
	config.h.cmake
	config/CMakeLists.txt
	config/ocsync.conf
	doc/CMakeLists.txt
	modules/csync_owncloud.c
	modules/csync_sftp2.c
	src/CMakeLists.txt
	src/csync.c
	src/csync.h
	src/csync_config.c
	src/csync_exclude.c
	src/csync_lock.c
	src/csync_macros.h
	src/csync_misc.c
	src/csync_misc.h
	src/csync_private.h
	src/csync_propagate.c
	src/csync_statedb.c
	src/csync_statedb.h
	src/csync_update.c
	src/csync_util.c
	src/csync_util.h
	src/std/c_dir.c
	src/std/c_file.c
	src/std/c_private.h
	src/std/c_string.c
	src/std/c_string.h
	src/std/c_time.c
	src/vio/csync_vio.c
	src/vio/csync_vio.h
	src/vio/csync_vio_file_stat.h
	src/vio/csync_vio_local.c
	src/vio/csync_vio_method.h
	tests/CMakeLists.txt
	tests/csync_tests/check_csync_statedb_load.c
	tests/csync_tests/check_csync_statedb_query.c
	tests/csync_tests/check_csync_treewalk.c
	tests/csync_tests/check_csync_update.c
	tests/ownCloud/HTTP/DAV.pm
	tests/ownCloud/ownCloud/Test.pm
	tests/std_tests/check_std_c_str.c
	tests/vio_tests/check_vio.c
2013-08-18 16:21:18 +02:00
Markus Goetz
ea6caed5a3 DB: More easy IO mode
We move the DB anyway at the end, no need to be so harsh
2013-08-18 16:10:30 +02:00
Olivier Goffart
868f8029a2 Close the database file in all cases.
If the database was empty, we forgot to close the file descriptor,
making it impssible to remove the database and replace it with the real
one
2013-08-16 12:23:26 +02:00
Olivier Goffart
14219a1ea5 Log error of sqlite3_close 2013-08-15 18:39:26 +02:00
Olivier Goffart
38a5ff42e0 show the errno in the debug when renaming the db fails 2013-08-15 13:51:57 +02:00
Klaas Freitag
2d3272182b Add correct cast to 64 bit type. 2013-08-07 16:58:46 +02:00
Olivier Goffart
6ad2920809 Load the statedb in csync_update rather than in csync_init.
This also allow to reduce duplicate code in csync_commit, and ease the
error reporting of csync_commit

csync_commit is supposed to be done after the previous sync, it is
better to open the statedb before the sync
2013-08-06 12:12:52 +02:00
Daniel Molkentin
8d99364d63 Eliminate all warnings
- use proper casts
- use aproproate types
- offer to build with -Werror
- make printf attribute hinting gnu format style
- remove unused helper methods
- begin to use inttyes.h macros where suitable
- move var declarations to the beginning of the method
- properly use _FILE_OFFSET_BITS
- silence variables unused depending on the define
2013-07-31 13:12:10 +02:00
Andreas Schneider
d80da2a088 LICENSE: Change license of libcsync from GPL to LGPL.
All contributors have agreed to change the license of libcsync to LGPL.
2013-07-29 14:04:37 +02:00
Klaas Freitag
45cdcb7502 Add a progress callback for overall and individual file up and download
progress.
2013-07-19 12:26:48 +02:00
Klaas Freitag
32559175c9 Use correct stat struct on all platforms. 2013-07-16 12:22:52 +02:00
Klaas Freitag
207ee9955f Dealloc the query cache in statedb_close 2013-07-12 16:37:33 +02:00
Klaas Freitag
365fb2a5fe Optimize the get_stat_by_hash function. 2013-07-12 16:22:58 +02:00
Klaas Freitag
4489eb6cc0 Allow newly created database in test. 2013-07-09 17:31:06 +02:00
Klaas Freitag
b7d549e5a0 Check for zero size database file. 2013-07-09 17:30:40 +02:00
Olivier Goffart
a25fbb6160 Save the right filename in the DB when there are new files on a renamed folder 2013-07-09 16:30:09 +02:00
Klaas Freitag
3a51c9ce8b Added rename function to csync library. 2013-07-09 11:11:49 +02:00
Andreas Schneider
8f7900ee8f statedb: Make sure we call sqlite3_close on a valid pointer. 2013-07-04 12:26:22 +02:00
Andreas Schneider
bfdd73a0bc statedb: Fix a build error. 2013-07-04 12:16:47 +02:00
Klaas Freitag
cb65273ef9 statedb: Check db integrity and only overwrite the old on success. 2013-07-04 11:40:23 +02:00