mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
CsyncThread: Activate recursive PROPFIND
This commit is contained in:
parent
ba9ac03b0b
commit
f4929e849e
@ -335,6 +335,18 @@ void CSyncThread::startSync()
|
||||
// maybe move this somewhere else where it can influence a running sync?
|
||||
MirallConfigFile cfg;
|
||||
|
||||
int fileRecordCount = 0;
|
||||
if (!_journal->exists()) {
|
||||
qDebug() << "=====sync looks new (no DB exists), activating recursive PROPFIND if csync supports it";
|
||||
bool no_recursive_propfind = false;
|
||||
csync_set_module_property(_csync_ctx, "no_recursive_propfind", &no_recursive_propfind);
|
||||
} else if ((fileRecordCount = _journal->getFileRecordCount()) < 50) {
|
||||
qDebug() << "=====sync DB has only" << fileRecordCount << "items, enable recursive PROPFIND if csync supports it";
|
||||
bool no_recursive_propfind = false;
|
||||
csync_set_module_property(_csync_ctx, "no_recursive_propfind", &no_recursive_propfind);
|
||||
} else {
|
||||
qDebug() << "=====sync with existing DB";
|
||||
}
|
||||
|
||||
csync_set_module_property(_csync_ctx, "csync_context", _csync_ctx);
|
||||
csync_set_userdata(_csync_ctx, this);
|
||||
|
||||
@ -38,6 +38,11 @@ SyncJournalDb::SyncJournalDb(const QString& path, QObject *parent) :
|
||||
_dbFile.append(".csync_journal.db");
|
||||
}
|
||||
|
||||
bool SyncJournalDb::exists()
|
||||
{
|
||||
return (!_dbFile.isEmpty() && QFile::exists(_dbFile));
|
||||
}
|
||||
|
||||
bool SyncJournalDb::checkConnect()
|
||||
{
|
||||
if( _db.isOpen() ) {
|
||||
@ -225,5 +230,26 @@ SyncJournalFileRecord SyncJournalDb::getFileRecord( const QString& filename )
|
||||
return rec;
|
||||
}
|
||||
|
||||
int SyncJournalDb::getFileRecordCount()
|
||||
{
|
||||
if( !checkConnect() )
|
||||
return 0;
|
||||
|
||||
QSqlQuery query("SELECT COUNT(*) FROM metadata" , _db);
|
||||
|
||||
if (!query.exec()) {
|
||||
QString err = query.lastError().text();
|
||||
qDebug() << "Error creating prepared statement: " << query.lastQuery() << ", Error:" << err;;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (query.next()) {
|
||||
int count = query.value(0).toInt();
|
||||
return count;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Mirall
|
||||
|
||||
@ -30,8 +30,10 @@ public:
|
||||
|
||||
bool setFileRecord( const SyncJournalFileRecord& record );
|
||||
bool deleteFileRecord( const QString& filename );
|
||||
int getFileRecordCount();
|
||||
|
||||
QSqlDatabase *getDB(){ return &_db; }
|
||||
bool exists();
|
||||
bool checkConnect();
|
||||
int64_t getPHash(const QString& ) const;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user