mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
Revert "Remove behavior changes."
This reverts commit 84d06ce9906df7bb6d87bf7093dd11fac6a6057a. Signed-off-by: allexzander <blackslayer4@gmail.com>
This commit is contained in:
parent
d425005a29
commit
b40c2dfe01
10 changed files with 43 additions and 9 deletions
|
@ -1722,7 +1722,7 @@ void SyncJournalDb::deleteStaleFlagsEntries()
|
||||||
|
|
||||||
SqlQuery delQuery("DELETE FROM flags WHERE path != '' AND path NOT IN (SELECT path from metadata);", _db);
|
SqlQuery delQuery("DELETE FROM flags WHERE path != '' AND path NOT IN (SELECT path from metadata);", _db);
|
||||||
if (!delQuery.exec()) {
|
if (!delQuery.exec()) {
|
||||||
qCWarning(lcDb) << QStringLiteral("deleteStaleFlagsEntries") << delQuery.error();
|
sqlFail(QStringLiteral("deleteStaleFlagsEntries"), delQuery);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1865,7 +1865,7 @@ void SyncJournalDb::setPollInfo(const SyncJournalDb::PollInfo &info)
|
||||||
SqlQuery query("DELETE FROM async_poll WHERE path=?", _db);
|
SqlQuery query("DELETE FROM async_poll WHERE path=?", _db);
|
||||||
query.bindValue(1, info._file);
|
query.bindValue(1, info._file);
|
||||||
if (!query.exec()) {
|
if (!query.exec()) {
|
||||||
qCWarning(lcDb) << QStringLiteral("setPollInfo DELETE FROM async_poll") << query.error();
|
sqlFail(QStringLiteral("setPollInfo DELETE FROM async_poll"), query);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SqlQuery query("INSERT OR REPLACE INTO async_poll (path, modtime, filesize, pollpath) VALUES( ? , ? , ? , ? )", _db);
|
SqlQuery query("INSERT OR REPLACE INTO async_poll (path, modtime, filesize, pollpath) VALUES( ? , ? , ? , ? )", _db);
|
||||||
|
@ -1874,7 +1874,7 @@ void SyncJournalDb::setPollInfo(const SyncJournalDb::PollInfo &info)
|
||||||
query.bindValue(3, info._fileSize);
|
query.bindValue(3, info._fileSize);
|
||||||
query.bindValue(4, info._url);
|
query.bindValue(4, info._url);
|
||||||
if (!query.exec()) {
|
if (!query.exec()) {
|
||||||
qCWarning(lcDb) << QStringLiteral("setPollInfo INSERT OR REPLACE INTO async_poll") << query.error();
|
sqlFail(QStringLiteral("setPollInfo INSERT OR REPLACE INTO async_poll"), query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1963,7 +1963,7 @@ void SyncJournalDb::avoidRenamesOnNextSync(const QByteArray &path)
|
||||||
query.bindValue(1, path);
|
query.bindValue(1, path);
|
||||||
|
|
||||||
if (!query.exec()) {
|
if (!query.exec()) {
|
||||||
qCWarning(lcDb) << QStringLiteral("avoidRenamesOnNextSync path: %1").arg(QString::fromUtf8(path)) << query.error();
|
sqlFail(QStringLiteral("avoidRenamesOnNextSync path: %1").arg(QString::fromUtf8(path)), query);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We also need to remove the ETags so the update phase refreshes the directory paths
|
// We also need to remove the ETags so the update phase refreshes the directory paths
|
||||||
|
@ -1991,7 +1991,7 @@ void SyncJournalDb::schedulePathForRemoteDiscovery(const QByteArray &fileName)
|
||||||
query.bindValue(1, argument);
|
query.bindValue(1, argument);
|
||||||
|
|
||||||
if (!query.exec()) {
|
if (!query.exec()) {
|
||||||
qCWarning(lcDb) << QStringLiteral("schedulePathForRemoteDiscovery path: %11").arg(QString::fromUtf8(fileName)) << query.error();
|
sqlFail(QStringLiteral("schedulePathForRemoteDiscovery path: %1").arg(QString::fromUtf8(fileName)), query);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent future overwrite of the etags of this folder and all
|
// Prevent future overwrite of the etags of this folder and all
|
||||||
|
@ -2023,7 +2023,7 @@ void SyncJournalDb::forceRemoteDiscoveryNextSyncLocked()
|
||||||
deleteRemoteFolderEtagsQuery.prepare("UPDATE metadata SET md5='_invalid_' WHERE type=2;");
|
deleteRemoteFolderEtagsQuery.prepare("UPDATE metadata SET md5='_invalid_' WHERE type=2;");
|
||||||
|
|
||||||
if (!deleteRemoteFolderEtagsQuery.exec()) {
|
if (!deleteRemoteFolderEtagsQuery.exec()) {
|
||||||
qCWarning(lcDb) << QStringLiteral("forceRemoteDiscoveryNextSyncLocked") << deleteRemoteFolderEtagsQuery.error();
|
sqlFail(QStringLiteral("forceRemoteDiscoveryNextSyncLocked"), deleteRemoteFolderEtagsQuery);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2233,7 +2233,7 @@ void SyncJournalDb::clearFileTable()
|
||||||
query.prepare("DELETE FROM metadata;");
|
query.prepare("DELETE FROM metadata;");
|
||||||
|
|
||||||
if (!query.exec()) {
|
if (!query.exec()) {
|
||||||
qCWarning(lcDb) << QStringLiteral("clearFileTable") << query.error();
|
sqlFail(QStringLiteral("clearFileTable"), query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2250,7 +2250,7 @@ void SyncJournalDb::markVirtualFileForDownloadRecursively(const QByteArray &path
|
||||||
query.bindValue(1, path);
|
query.bindValue(1, path);
|
||||||
|
|
||||||
if (!query.exec()) {
|
if (!query.exec()) {
|
||||||
qCWarning(lcDb) << QStringLiteral("markVirtualFileForDownloadRecursively UPDATE metadata SET type=5 path: %1").arg(QString::fromUtf8(path)) << query.error();
|
sqlFail(QStringLiteral("markVirtualFileForDownloadRecursively UPDATE metadata SET type=5 path: %1").arg(QString::fromUtf8(path)), query);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We also must make sure we do not read the files from the database (same logic as in schedulePathForRemoteDiscovery)
|
// We also must make sure we do not read the files from the database (same logic as in schedulePathForRemoteDiscovery)
|
||||||
|
@ -2261,7 +2261,7 @@ void SyncJournalDb::markVirtualFileForDownloadRecursively(const QByteArray &path
|
||||||
query.bindValue(1, path);
|
query.bindValue(1, path);
|
||||||
|
|
||||||
if (!query.exec()) {
|
if (!query.exec()) {
|
||||||
qCWarning(lcDb) << QStringLiteral("markVirtualFileForDownloadRecursively UPDATE metadata SET md5='_invalid_' path: %1").arg(QString::fromUtf8(path)) << query.error();
|
sqlFail(QStringLiteral("markVirtualFileForDownloadRecursively UPDATE metadata SET md5='_invalid_' path: %1").arg(QString::fromUtf8(path)), query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2395,6 +2395,8 @@ SyncJournalDb::PinStateInterface::rawList()
|
||||||
|
|
||||||
if (!query.exec()) {
|
if (!query.exec()) {
|
||||||
qCWarning(lcDb) << "SQL Error" << "PinStateInterface::rawList" << query.error();
|
qCWarning(lcDb) << "SQL Error" << "PinStateInterface::rawList" << query.error();
|
||||||
|
_db->close();
|
||||||
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QPair<QByteArray, PinState>> result;
|
QVector<QPair<QByteArray, PinState>> result;
|
||||||
|
|
|
@ -618,6 +618,7 @@ void Folder::implicitlyHydrateFile(const QString &relativepath)
|
||||||
;
|
;
|
||||||
if (!_journal.getFileRecord(relativepath.toUtf8(), &record)) {
|
if (!_journal.getFileRecord(relativepath.toUtf8(), &record)) {
|
||||||
qCWarning(lcFolder) << "could not get file from local DB" << relativepath;
|
qCWarning(lcFolder) << "could not get file from local DB" << relativepath;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!record.isValid()) {
|
if (!record.isValid()) {
|
||||||
qCInfo(lcFolder) << "Did not find file in db";
|
qCInfo(lcFolder) << "Did not find file in db";
|
||||||
|
@ -633,6 +634,7 @@ void Folder::implicitlyHydrateFile(const QString &relativepath)
|
||||||
const auto result = _journal.setFileRecord(record);
|
const auto result = _journal.setFileRecord(record);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
qCWarning(lcFolder) << "Error when setting the file record to the database" << record._path << result.error();
|
qCWarning(lcFolder) << "Error when setting the file record to the database" << record._path << result.error();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the file's pin state if it's contradictory to being hydrated
|
// Change the file's pin state if it's contradictory to being hydrated
|
||||||
|
|
|
@ -915,6 +915,7 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
|
||||||
// Not locally, not on the server. The entry is stale!
|
// Not locally, not on the server. The entry is stale!
|
||||||
qCInfo(lcDisco) << "Stale DB entry";
|
qCInfo(lcDisco) << "Stale DB entry";
|
||||||
if (!_discoveryData->_statedb->deleteFileRecord(path._original, true)) {
|
if (!_discoveryData->_statedb->deleteFileRecord(path._original, true)) {
|
||||||
|
_discoveryData->fatalError(tr("Error while deleting file record %1 from the database").arg(path._original));
|
||||||
qCWarning(lcDisco) << "Failed to delete a file record from the local DB" << path._original;
|
qCWarning(lcDisco) << "Failed to delete a file record from the local DB" << path._original;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1199,6 +1199,13 @@ void PropagateDirectory::slotSubJobsFinished(SyncFileItem::Status status)
|
||||||
if (_item->_instruction == CSYNC_INSTRUCTION_RENAME && _item->_originalFile != _item->_renameTarget) {
|
if (_item->_instruction == CSYNC_INSTRUCTION_RENAME && _item->_originalFile != _item->_renameTarget) {
|
||||||
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile, true)) {
|
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile, true)) {
|
||||||
qCWarning(lcDirectory) << "could not delete file from local DB" << _item->_originalFile;
|
qCWarning(lcDirectory) << "could not delete file from local DB" << _item->_originalFile;
|
||||||
|
_state = Finished;
|
||||||
|
status = _item->_status = SyncFileItem::FatalError;
|
||||||
|
_item->_errorString = tr("could not delete file %1 from local DB").arg(_item->_originalFile);
|
||||||
|
qCInfo(lcPropagator) << "PropagateDirectory::slotSubJobsFinished"
|
||||||
|
<< "emit finished" << status;
|
||||||
|
emit finished(status);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -461,6 +461,8 @@ void PropagateDownloadFile::start()
|
||||||
SyncJournalFileRecord parentRec;
|
SyncJournalFileRecord parentRec;
|
||||||
if (!propagator()->_journal->getFileRecord(parentPath, &parentRec)) {
|
if (!propagator()->_journal->getFileRecord(parentPath, &parentRec)) {
|
||||||
qCWarning(lcPropagateDownload) << "could not get file from local DB" << parentPath;
|
qCWarning(lcPropagateDownload) << "could not get file from local DB" << parentPath;
|
||||||
|
done(SyncFileItem::NormalError, tr("could not get file %1 from local DB").arg(parentPath));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto account = propagator()->account();
|
const auto account = propagator()->account();
|
||||||
|
@ -507,6 +509,8 @@ void PropagateDownloadFile::startAfterIsEncryptedIsChecked()
|
||||||
|
|
||||||
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile)) {
|
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile)) {
|
||||||
qCWarning(lcPropagateDownload) << "could not delete file from local DB" << _item->_originalFile;
|
qCWarning(lcPropagateDownload) << "could not delete file from local DB" << _item->_originalFile;
|
||||||
|
done(SyncFileItem::NormalError, tr("Could not delete file record %1 from local DB").arg(_item->_originalFile));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMetadata(false);
|
updateMetadata(false);
|
||||||
|
@ -1245,6 +1249,8 @@ void PropagateDownloadFile::downloadFinished()
|
||||||
|
|
||||||
if (!propagator()->_journal->deleteFileRecord(virtualFile)) {
|
if (!propagator()->_journal->deleteFileRecord(virtualFile)) {
|
||||||
qCWarning(lcPropagateDownload) << "could not delete file from local DB" << virtualFile;
|
qCWarning(lcPropagateDownload) << "could not delete file from local DB" << virtualFile;
|
||||||
|
done(SyncFileItem::NormalError, tr("Could not delete file record %1 from local DB").arg(virtualFile));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the pin state to the new location
|
// Move the pin state to the new location
|
||||||
|
|
|
@ -115,6 +115,8 @@ void PropagateRemoteDelete::slotDeleteJobFinished()
|
||||||
|
|
||||||
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile, _item->isDirectory())) {
|
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile, _item->isDirectory())) {
|
||||||
qCWarning(lcPropagateRemoteDelete) << "could not delete file from local DB" << _item->_originalFile;
|
qCWarning(lcPropagateRemoteDelete) << "could not delete file from local DB" << _item->_originalFile;
|
||||||
|
done(SyncFileItem::NormalError, tr("Could not delete file record %1 from local DB").arg(_item->_originalFile));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
propagator()->_journal->commit("Remote Remove");
|
propagator()->_journal->commit("Remote Remove");
|
||||||
|
|
|
@ -247,6 +247,8 @@ void PropagateRemoteMove::finalize()
|
||||||
SyncJournalFileRecord oldRecord;
|
SyncJournalFileRecord oldRecord;
|
||||||
if (!propagator()->_journal->getFileRecord(_item->_originalFile, &oldRecord)) {
|
if (!propagator()->_journal->getFileRecord(_item->_originalFile, &oldRecord)) {
|
||||||
qCWarning(lcPropagateRemoteMove) << "could not get file from local DB" << _item->_originalFile;
|
qCWarning(lcPropagateRemoteMove) << "could not get file from local DB" << _item->_originalFile;
|
||||||
|
done(SyncFileItem::NormalError, tr("could not get file %1 from local DB").arg(_item->_originalFile));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
auto &vfs = propagator()->syncOptions()._vfs;
|
auto &vfs = propagator()->syncOptions()._vfs;
|
||||||
auto pinState = vfs->pinState(_item->_originalFile);
|
auto pinState = vfs->pinState(_item->_originalFile);
|
||||||
|
@ -257,6 +259,8 @@ void PropagateRemoteMove::finalize()
|
||||||
// Delete old db data.
|
// Delete old db data.
|
||||||
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile)) {
|
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile)) {
|
||||||
qCWarning(lcPropagateRemoteMove) << "could not delete file from local DB" << _item->_originalFile;
|
qCWarning(lcPropagateRemoteMove) << "could not delete file from local DB" << _item->_originalFile;
|
||||||
|
done(SyncFileItem::NormalError, tr("Could not delete file record %1 from local DB").arg(_item->_originalFile));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!vfs->setPinState(_item->_originalFile, PinState::Inherited)) {
|
if (!vfs->setPinState(_item->_originalFile, PinState::Inherited)) {
|
||||||
qCWarning(lcPropagateRemoteMove) << "Could not set pin state of" << _item->_originalFile << "to inherited";
|
qCWarning(lcPropagateRemoteMove) << "Could not set pin state of" << _item->_originalFile << "to inherited";
|
||||||
|
|
|
@ -130,6 +130,8 @@ void PropagateLocalRemove::start()
|
||||||
propagator()->reportProgress(*_item, 0);
|
propagator()->reportProgress(*_item, 0);
|
||||||
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile, _item->isDirectory())) {
|
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile, _item->isDirectory())) {
|
||||||
qCWarning(lcPropagateLocalRename) << "could not delete file from local DB" << _item->_originalFile;
|
qCWarning(lcPropagateLocalRename) << "could not delete file from local DB" << _item->_originalFile;
|
||||||
|
done(SyncFileItem::NormalError, tr("Could not delete file record %1 from local DB").arg(_item->_originalFile));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
propagator()->_journal->commit("Local remove");
|
propagator()->_journal->commit("Local remove");
|
||||||
done(SyncFileItem::Success);
|
done(SyncFileItem::Success);
|
||||||
|
@ -249,9 +251,13 @@ void PropagateLocalRename::start()
|
||||||
SyncJournalFileRecord oldRecord;
|
SyncJournalFileRecord oldRecord;
|
||||||
if (!propagator()->_journal->getFileRecord(_item->_originalFile, &oldRecord)) {
|
if (!propagator()->_journal->getFileRecord(_item->_originalFile, &oldRecord)) {
|
||||||
qCWarning(lcPropagateLocalRename) << "could not get file from local DB" << _item->_originalFile;
|
qCWarning(lcPropagateLocalRename) << "could not get file from local DB" << _item->_originalFile;
|
||||||
|
done(SyncFileItem::NormalError, tr("could not get file %1 from local DB").arg(_item->_originalFile));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile)) {
|
if (!propagator()->_journal->deleteFileRecord(_item->_originalFile)) {
|
||||||
qCWarning(lcPropagateLocalRename) << "could not delete file from local DB" << _item->_originalFile;
|
qCWarning(lcPropagateLocalRename) << "could not delete file from local DB" << _item->_originalFile;
|
||||||
|
done(SyncFileItem::NormalError, tr("Could not delete file record %1 from local DB").arg(_item->_originalFile));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto &vfs = propagator()->syncOptions()._vfs;
|
auto &vfs = propagator()->syncOptions()._vfs;
|
||||||
|
|
|
@ -381,6 +381,9 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
|
||||||
|
|
||||||
// Updating the db happens on success
|
// Updating the db happens on success
|
||||||
if (!_journal->setFileRecord(rec)) {
|
if (!_journal->setFileRecord(rec)) {
|
||||||
|
item->_status = SyncFileItem::Status::NormalError;
|
||||||
|
item->_instruction = CSYNC_INSTRUCTION_ERROR;
|
||||||
|
item->_errorString = tr("Could not set file record to local DB: %1").arg(rec.path());
|
||||||
qCWarning(lcEngine) << "Could not set file record to local DB" << rec.path();
|
qCWarning(lcEngine) << "Could not set file record to local DB" << rec.path();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,6 +291,7 @@ void OCC::HydrationJob::finalize(OCC::VfsCfApi *vfs)
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
if (!_journal->getFileRecord(_folderPath, &record)) {
|
if (!_journal->getFileRecord(_folderPath, &record)) {
|
||||||
qCWarning(lcHydration) << "could not get file from local DB" << _folderPath;
|
qCWarning(lcHydration) << "could not get file from local DB" << _folderPath;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
Q_ASSERT(record.isValid());
|
Q_ASSERT(record.isValid());
|
||||||
if (!record.isValid()) {
|
if (!record.isValid()) {
|
||||||
|
|
Loading…
Reference in a new issue