зеркало из https://github.com/nextcloud/desktop.git
Merge pull request #3919 from phil-davis/libsynctypos
libsync comment and message typos for master
This commit is contained in:
Коммит
6d6903ef62
|
@ -81,7 +81,7 @@ protected:
|
||||||
QByteArray _responseTimestamp;
|
QByteArray _responseTimestamp;
|
||||||
QElapsedTimer _durationTimer;
|
QElapsedTimer _durationTimer;
|
||||||
quint64 _duration;
|
quint64 _duration;
|
||||||
bool _timedout; // set to true when the timeout slot is recieved
|
bool _timedout; // set to true when the timeout slot is received
|
||||||
|
|
||||||
// Automatically follows redirects. Note that this only works for
|
// Automatically follows redirects. Note that this only works for
|
||||||
// GET requests that don't set up any HTTP body or other flags.
|
// GET requests that don't set up any HTTP body or other flags.
|
||||||
|
|
|
@ -181,7 +181,7 @@ void Account::clearCookieJar()
|
||||||
|
|
||||||
/*! This shares our official cookie jar (containing all the tasty
|
/*! This shares our official cookie jar (containing all the tasty
|
||||||
authentication cookies) with another QNAM while making sure
|
authentication cookies) with another QNAM while making sure
|
||||||
of not loosing its ownership. */
|
of not losing its ownership. */
|
||||||
void Account::lendCookieJarTo(QNetworkAccessManager *guest)
|
void Account::lendCookieJarTo(QNetworkAccessManager *guest)
|
||||||
{
|
{
|
||||||
auto jar = _am->cookieJar();
|
auto jar = _am->cookieJar();
|
||||||
|
|
|
@ -141,7 +141,7 @@ public:
|
||||||
const QList< QPair<QString, QString> > &queryItems = (QList<QPair<QString, QString>>()));
|
const QList< QPair<QString, QString> > &queryItems = (QList<QPair<QString, QString>>()));
|
||||||
|
|
||||||
/** Returns a new settings pre-set in a specific group. The Settings will be created
|
/** Returns a new settings pre-set in a specific group. The Settings will be created
|
||||||
with the given parent. If no parents is specified, the caller must destroy the settings */
|
with the given parent. If no parent is specified, the caller must destroy the settings */
|
||||||
static std::unique_ptr<QSettings> settingsWithGroup(const QString& group, QObject* parent = 0);
|
static std::unique_ptr<QSettings> settingsWithGroup(const QString& group, QObject* parent = 0);
|
||||||
|
|
||||||
// to be called by credentials only
|
// to be called by credentials only
|
||||||
|
|
|
@ -294,7 +294,7 @@ void BandwidthManager::relativeDownloadMeasuringTimerExpired()
|
||||||
|
|
||||||
// We want to wait twice as long since we want to give all
|
// We want to wait twice as long since we want to give all
|
||||||
// devices the same quota we used now since we don't want
|
// devices the same quota we used now since we don't want
|
||||||
// any upload to timeout
|
// any download to timeout
|
||||||
_relativeDownloadDelayTimer.setInterval(realWaitTimeMsec);
|
_relativeDownloadDelayTimer.setInterval(realWaitTimeMsec);
|
||||||
_relativeDownloadDelayTimer.start();
|
_relativeDownloadDelayTimer.start();
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ void BandwidthManager::relativeDownloadDelayTimerExpired()
|
||||||
_relativeLimitCurrentMeasuredJob->setBandwidthLimited(false);
|
_relativeLimitCurrentMeasuredJob->setBandwidthLimited(false);
|
||||||
_relativeLimitCurrentMeasuredJob->setChoked(false);
|
_relativeLimitCurrentMeasuredJob->setChoked(false);
|
||||||
|
|
||||||
// choke all other UploadDevices
|
// choke all other download jobs
|
||||||
Q_FOREACH(GETFileJob *gfj, _downloadJobList) {
|
Q_FOREACH(GETFileJob *gfj, _downloadJobList) {
|
||||||
if (gfj != _relativeLimitCurrentMeasuredJob) {
|
if (gfj != _relativeLimitCurrentMeasuredJob) {
|
||||||
gfj->setBandwidthLimited(true);
|
gfj->setBandwidthLimited(true);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The Capabilities class represent the capabilities of an ownCloud
|
* @brief The Capabilities class represents the capabilities of an ownCloud
|
||||||
* server
|
* server
|
||||||
* @ingroup libsync
|
* @ingroup libsync
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
|
|
||||||
/* Server poll interval in milliseconds */
|
/* Server poll interval in milliseconds */
|
||||||
int remotePollInterval( const QString& connection = QString() ) const;
|
int remotePollInterval( const QString& connection = QString() ) const;
|
||||||
/* Set poll interval. Value in microseconds has to be larger than 5000 */
|
/* Set poll interval. Value in milliseconds has to be larger than 5000 */
|
||||||
void setRemotePollInterval(int interval, const QString& connection = QString() );
|
void setRemotePollInterval(int interval, const QString& connection = QString() );
|
||||||
|
|
||||||
/* Force sync interval, in milliseconds */
|
/* Force sync interval, in milliseconds */
|
||||||
|
|
|
@ -25,8 +25,8 @@ namespace OCC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a job-like class to check that the server is up and that we are connected.
|
* This is a job-like class to check that the server is up and that we are connected.
|
||||||
* There is two entry point: checkServerAndAuth and checkAuthentication
|
* There are two entry points: checkServerAndAuth and checkAuthentication
|
||||||
* checkAutentication is the quick version that only do the propfind
|
* checkAuthentication is the quick version that only does the propfind
|
||||||
* while checkServerAndAuth is doing the 3 calls.
|
* while checkServerAndAuth is doing the 3 calls.
|
||||||
*
|
*
|
||||||
* We cannot use the capabilites call to test the login and the password because of
|
* We cannot use the capabilites call to test the login and the password because of
|
||||||
|
@ -53,7 +53,7 @@ namespace OCC {
|
||||||
|
|
|
|
||||||
+-> slotAuthFailed --> X
|
+-> slotAuthFailed --> X
|
||||||
|
|
|
|
||||||
+-> slotAuthSuccess --+--> X (depending if comming from checkServerAndAuth or not)
|
+-> slotAuthSuccess --+--> X (depending if coming from checkServerAndAuth or not)
|
||||||
|
|
|
|
||||||
+---------------------------+
|
+---------------------------+
|
||||||
|
|
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ void HttpCredentials::invalidateToken()
|
||||||
// clear the session cookie.
|
// clear the session cookie.
|
||||||
_account->clearCookieJar();
|
_account->clearCookieJar();
|
||||||
|
|
||||||
// let QNAM fogets about the password
|
// let QNAM forget about the password
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||||
_account->networkAccessManager()->clearAccessCache();
|
_account->networkAccessManager()->clearAccessCache();
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace OCC {
|
||||||
class Account;
|
class Account;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Discovery Phase was once called "update" phase in csync therms.
|
* The Discovery Phase was once called "update" phase in csync terms.
|
||||||
* Its goal is to look at the files in one of the remote and check comared to the db
|
* Its goal is to look at the files in one of the remote and check compared to the db
|
||||||
* if the files are new, or changed.
|
* if the files are new, or changed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ bool FileSystem::fileEquals(const QString& fn1, const QString& fn2)
|
||||||
do {
|
do {
|
||||||
int r = f1.read(buffer1, BufferSize);
|
int r = f1.read(buffer1, BufferSize);
|
||||||
if (f2.read(buffer2, BufferSize) != r) {
|
if (f2.read(buffer2, BufferSize) != r) {
|
||||||
// this should normaly not happen: the file are supposed to have the same size.
|
// this should normally not happen: the files are supposed to have the same size.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (r <= 0) {
|
if (r <= 0) {
|
||||||
|
@ -244,8 +244,8 @@ bool FileSystem::uncheckedRenameReplace(const QString& originFileName,
|
||||||
success = orig.fileEngine()->rename(destinationFileName);
|
success = orig.fileEngine()->rename(destinationFileName);
|
||||||
// qDebug() << "Renaming " << tmpFile.fileName() << " to " << fn;
|
// qDebug() << "Renaming " << tmpFile.fileName() << " to " << fn;
|
||||||
#else
|
#else
|
||||||
// We want a rename that also overwite. QFile::rename does not overwite.
|
// We want a rename that also overwites. QFile::rename does not overwite.
|
||||||
// Qt 5.1 has QSaveFile::renameOverwrite we cold use.
|
// Qt 5.1 has QSaveFile::renameOverwrite we could use.
|
||||||
// ### FIXME
|
// ### FIXME
|
||||||
success = true;
|
success = true;
|
||||||
bool destExists = fileExists(destinationFileName);
|
bool destExists = fileExists(destinationFileName);
|
||||||
|
|
|
@ -85,7 +85,7 @@ bool OWNCLOUDSYNC_EXPORT rename(const QString& originFileName,
|
||||||
QString* errorString = NULL);
|
QString* errorString = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if \a fileName chas changed given previous size and mtime
|
* @brief Check if \a fileName has changed given previous size and mtime
|
||||||
*
|
*
|
||||||
* Nonexisting files are covered through mtime: they have an mtime of -1.
|
* Nonexisting files are covered through mtime: they have an mtime of -1.
|
||||||
*
|
*
|
||||||
|
@ -131,7 +131,7 @@ bool uncheckedRenameReplace(const QString &originFileName,
|
||||||
* Replacement for QFile::open(ReadOnly) followed by a seek().
|
* Replacement for QFile::open(ReadOnly) followed by a seek().
|
||||||
* This version sets a more permissive sharing mode on Windows.
|
* This version sets a more permissive sharing mode on Windows.
|
||||||
*
|
*
|
||||||
* Warning: The resuting file may have an empty fileName and be unsuitable for use
|
* Warning: The resulting file may have an empty fileName and be unsuitable for use
|
||||||
* with QFileInfo! Calling seek() on the QFile with >32bit signed values will fail!
|
* with QFileInfo! Calling seek() on the QFile with >32bit signed values will fail!
|
||||||
*/
|
*/
|
||||||
bool openAndSeekFileSharedRead(QFile* file, QString* error, qint64 seek);
|
bool openAndSeekFileSharedRead(QFile* file, QString* error, qint64 seek);
|
||||||
|
|
|
@ -193,7 +193,7 @@ void Logger::enterNextLogFile()
|
||||||
dir.mkpath(".");
|
dir.mkpath(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find out what is the file with the highest nymber if any
|
// Find out what is the file with the highest number if any
|
||||||
QStringList files = dir.entryList(QStringList("owncloud.log.*"),
|
QStringList files = dir.entryList(QStringList("owncloud.log.*"),
|
||||||
QDir::Files);
|
QDir::Files);
|
||||||
QRegExp rx("owncloud.log.(\\d+)");
|
QRegExp rx("owncloud.log.(\\d+)");
|
||||||
|
|
|
@ -311,7 +311,7 @@ void LsColJob::start()
|
||||||
|
|
||||||
// TODO: Instead of doing all in this slot, we should iteratively parse in readyRead(). This
|
// TODO: Instead of doing all in this slot, we should iteratively parse in readyRead(). This
|
||||||
// would allow us to be more asynchronous in processing while data is coming from the network,
|
// would allow us to be more asynchronous in processing while data is coming from the network,
|
||||||
// not in all in one big blobb at the end.
|
// not all in one big blob at the end.
|
||||||
bool LsColJob::finished()
|
bool LsColJob::finished()
|
||||||
{
|
{
|
||||||
QString contentType = reply()->header(QNetworkRequest::ContentTypeHeader).toString();
|
QString contentType = reply()->header(QNetworkRequest::ContentTypeHeader).toString();
|
||||||
|
@ -432,7 +432,7 @@ bool CheckServerJob::finished()
|
||||||
|
|
||||||
mergeSslConfigurationForSslButton(reply()->sslConfiguration(), account());
|
mergeSslConfigurationForSslButton(reply()->sslConfiguration(), account());
|
||||||
|
|
||||||
// The serverInstalls to /owncloud. Let's try that if the file wasn't found
|
// The server installs to /owncloud. Let's try that if the file wasn't found
|
||||||
// at the original location
|
// at the original location
|
||||||
if ((reply()->error() == QNetworkReply::ContentNotFoundError) && (!_subdirFallback)) {
|
if ((reply()->error() == QNetworkReply::ContentNotFoundError) && (!_subdirFallback)) {
|
||||||
_subdirFallback = true;
|
_subdirFallback = true;
|
||||||
|
|
|
@ -200,7 +200,7 @@ private slots:
|
||||||
* \code
|
* \code
|
||||||
* _job = new JsonApiJob(account, QLatin1String("ocs/v1.php/foo/bar"), this);
|
* _job = new JsonApiJob(account, QLatin1String("ocs/v1.php/foo/bar"), this);
|
||||||
* connect(job, SIGNAL(jsonRecieved(QVariantMap)), ...)
|
* connect(job, SIGNAL(jsonRecieved(QVariantMap)), ...)
|
||||||
* The recieved QVariantMap is empty in case of error or otherwise is a map as parsed by QtJson
|
* The received QVariantMap is empty in case of error or otherwise is a map as parsed by QtJson
|
||||||
* \encode
|
* \encode
|
||||||
*
|
*
|
||||||
* @ingroup libsync
|
* @ingroup libsync
|
||||||
|
|
|
@ -74,7 +74,7 @@ qint64 freeSpaceLimit()
|
||||||
OwncloudPropagator::~OwncloudPropagator()
|
OwncloudPropagator::~OwncloudPropagator()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/* The maximum number of active job in parallel */
|
/* The maximum number of active jobs in parallel */
|
||||||
int OwncloudPropagator::maximumActiveJob()
|
int OwncloudPropagator::maximumActiveJob()
|
||||||
{
|
{
|
||||||
static int max = qgetenv("OWNCLOUD_MAX_PARALLEL").toUInt();
|
static int max = qgetenv("OWNCLOUD_MAX_PARALLEL").toUInt();
|
||||||
|
@ -182,7 +182,7 @@ bool PropagateItemJob::checkForProblemsWithShared(int httpStatusCode, const QStr
|
||||||
// don't try to recover pushing new files
|
// don't try to recover pushing new files
|
||||||
return false;
|
return false;
|
||||||
} else if (downloadItem->_instruction == CSYNC_INSTRUCTION_SYNC) {
|
} else if (downloadItem->_instruction == CSYNC_INSTRUCTION_SYNC) {
|
||||||
// we modified the file locally, jsut create a conflict then
|
// we modified the file locally, just create a conflict then
|
||||||
downloadItem->_instruction = CSYNC_INSTRUCTION_CONFLICT;
|
downloadItem->_instruction = CSYNC_INSTRUCTION_CONFLICT;
|
||||||
|
|
||||||
// HACK to avoid continuation: See task #1448: We do not know the _modtime from the
|
// HACK to avoid continuation: See task #1448: We do not know the _modtime from the
|
||||||
|
@ -249,7 +249,7 @@ PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItemPtr &item) {
|
||||||
if (item->_isDirectory) {
|
if (item->_isDirectory) {
|
||||||
if (item->_direction == SyncFileItem::Down) return new PropagateLocalMkdir(this, item);
|
if (item->_direction == SyncFileItem::Down) return new PropagateLocalMkdir(this, item);
|
||||||
else return new PropagateRemoteMkdir(this, item);
|
else return new PropagateRemoteMkdir(this, item);
|
||||||
} //fall trough
|
} //fall through
|
||||||
case CSYNC_INSTRUCTION_SYNC:
|
case CSYNC_INSTRUCTION_SYNC:
|
||||||
case CSYNC_INSTRUCTION_CONFLICT:
|
case CSYNC_INSTRUCTION_CONFLICT:
|
||||||
if (item->_isDirectory) {
|
if (item->_isDirectory) {
|
||||||
|
@ -295,7 +295,7 @@ void OwncloudPropagator::start(const SyncFileItemVector& items)
|
||||||
ConfigFile cfg;
|
ConfigFile cfg;
|
||||||
const QString checksumType = cfg.transmissionChecksum().toUpper();
|
const QString checksumType = cfg.transmissionChecksum().toUpper();
|
||||||
|
|
||||||
/* if the checksum type is empty, it is not send. No error */
|
/* if the checksum type is empty, it is not sent. No error */
|
||||||
if( !checksumType.isEmpty() ) {
|
if( !checksumType.isEmpty() ) {
|
||||||
if( checksumType == checkSumAdlerUpperC ||
|
if( checksumType == checkSumAdlerUpperC ||
|
||||||
checksumType == checkSumMD5C ||
|
checksumType == checkSumMD5C ||
|
||||||
|
@ -306,8 +306,8 @@ void OwncloudPropagator::start(const SyncFileItemVector& items)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This builds all the job needed for the propagation.
|
/* This builds all the jobs needed for the propagation.
|
||||||
* Each directories is a PropagateDirectory job, which contains the files in it.
|
* Each directory is a PropagateDirectory job, which contains the files in it.
|
||||||
* In order to do that we loop over the items. (which are sorted by destination)
|
* In order to do that we loop over the items. (which are sorted by destination)
|
||||||
* When we enter a directory, we can create the directory job and push it on the stack. */
|
* When we enter a directory, we can create the directory job and push it on the stack. */
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ void OwncloudPropagator::start(const SyncFileItemVector& items)
|
||||||
continue;
|
continue;
|
||||||
} else if (item->_instruction == CSYNC_INSTRUCTION_NEW && item->_isDirectory) {
|
} else if (item->_instruction == CSYNC_INSTRUCTION_NEW && item->_isDirectory) {
|
||||||
// create a new directory within a deleted directory? That can happen if the directory
|
// create a new directory within a deleted directory? That can happen if the directory
|
||||||
// etag were not fetched properly on the previous sync because the sync was aborted
|
// etag was not fetched properly on the previous sync because the sync was aborted
|
||||||
// while uploading this directory (which is now removed). We can ignore it.
|
// while uploading this directory (which is now removed). We can ignore it.
|
||||||
if( delDirJob ) {
|
if( delDirJob ) {
|
||||||
delDirJob->increaseAffectedCount();
|
delDirJob->increaseAffectedCount();
|
||||||
|
@ -355,7 +355,7 @@ void OwncloudPropagator::start(const SyncFileItemVector& items)
|
||||||
dir->_firstJob.reset(createJob(item));
|
dir->_firstJob.reset(createJob(item));
|
||||||
if (item->_instruction == CSYNC_INSTRUCTION_REMOVE) {
|
if (item->_instruction == CSYNC_INSTRUCTION_REMOVE) {
|
||||||
// We do the removal of directories at the end, because there might be moves from
|
// We do the removal of directories at the end, because there might be moves from
|
||||||
// this directories that will happen later.
|
// these directories that will happen later.
|
||||||
directoriesToRemove.append(dir);
|
directoriesToRemove.append(dir);
|
||||||
removedDirectory = item->_file + "/";
|
removedDirectory = item->_file + "/";
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ bool OwncloudPropagator::isInSharedDirectory(const QString& file)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if we should use the legacy jobs.
|
* Return true if we should use the legacy jobs.
|
||||||
* Some feature are not supported by QNAM and therefore we still use the legacy jobs
|
* Some features are not supported by QNAM and therefore we still use the legacy jobs
|
||||||
* for this case.
|
* for this case.
|
||||||
*/
|
*/
|
||||||
bool OwncloudPropagator::useLegacyJobs()
|
bool OwncloudPropagator::useLegacyJobs()
|
||||||
|
@ -422,7 +422,7 @@ bool OwncloudPropagator::useLegacyJobs()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_downloadLimit.fetchAndAddAcquire(0) != 0 || _uploadLimit.fetchAndAddAcquire(0) != 0) {
|
if (_downloadLimit.fetchAndAddAcquire(0) != 0 || _uploadLimit.fetchAndAddAcquire(0) != 0) {
|
||||||
// QNAM bandwith limiting only work with version of Qt greater or equal to 5.3.3
|
// QNAM bandwith limiting only works with versions of Qt greater or equal to 5.3.3
|
||||||
// (It needs Qt commits 097b641 and b99fa32)
|
// (It needs Qt commits 097b641 and b99fa32)
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,3,3)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,3,3)
|
||||||
return false;
|
return false;
|
||||||
|
@ -505,7 +505,7 @@ bool OwncloudPropagator::localFileNameClash( const QString& relFile )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// On Linux, the file system is case sensitive, but this code is usefull for testing.
|
// On Linux, the file system is case sensitive, but this code is useful for testing.
|
||||||
// Just check that there is no other file with the same name and different casing.
|
// Just check that there is no other file with the same name and different casing.
|
||||||
QFileInfo fileInfo(file);
|
QFileInfo fileInfo(file);
|
||||||
const QString fn = fileInfo.fileName();
|
const QString fn = fileInfo.fileName();
|
||||||
|
@ -670,10 +670,10 @@ void PropagateDirectory::slotSubJobFinished(SyncFileItem::Status status)
|
||||||
totalJobs++;
|
totalJobs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We finished to processing all the jobs
|
// We finished processing all the jobs
|
||||||
// check if we finished
|
// check if we finished
|
||||||
if (_jobsFinished >= totalJobs) {
|
if (_jobsFinished >= totalJobs) {
|
||||||
Q_ASSERT(!_runningNow); // how can we finished if there are still jobs running now
|
Q_ASSERT(!_runningNow); // how can we be finished if there are still jobs running now
|
||||||
finalize();
|
finalize();
|
||||||
} else {
|
} else {
|
||||||
emit ready();
|
emit ready();
|
||||||
|
|
|
@ -55,7 +55,7 @@ class OwncloudPropagator;
|
||||||
* @brief the base class of propagator jobs
|
* @brief the base class of propagator jobs
|
||||||
*
|
*
|
||||||
* This can either be a job, or a container for jobs.
|
* This can either be a job, or a container for jobs.
|
||||||
* If it is a composite jobs, it then inherits from PropagateDirectory
|
* If it is a composite job, it then inherits from PropagateDirectory
|
||||||
*
|
*
|
||||||
* @ingroup libsync
|
* @ingroup libsync
|
||||||
*/
|
*/
|
||||||
|
@ -78,12 +78,12 @@ public:
|
||||||
|
|
||||||
/** Jobs can be run in parallel to this job */
|
/** Jobs can be run in parallel to this job */
|
||||||
FullParallelism,
|
FullParallelism,
|
||||||
/** This job do not support parallelism, and no other job shall
|
/** This job does not support parallelism, and no other job shall
|
||||||
be started until this one has finished */
|
be started until this one has finished */
|
||||||
WaitForFinished,
|
WaitForFinished,
|
||||||
|
|
||||||
/** This job support paralelism with other jobs in the same directory, but it should
|
/** This job supports parallelism with other jobs in the same directory, but it should
|
||||||
not be paralelized with jobs in other directories (typically a move operation) */
|
not be parallelized with jobs in other directories (typically a move operation) */
|
||||||
WaitForFinishedInParentDirectory
|
WaitForFinishedInParentDirectory
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ public:
|
||||||
const QString _remoteFolder; // folder. (same as remoteDir but without the WebDAV path)
|
const QString _remoteFolder; // folder. (same as remoteDir but without the WebDAV path)
|
||||||
|
|
||||||
SyncJournalDb * const _journal;
|
SyncJournalDb * const _journal;
|
||||||
bool _finishedEmited; // used to ensure that finished is only emit once
|
bool _finishedEmited; // used to ensure that finished is only emitted once
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -309,7 +309,7 @@ public:
|
||||||
/** We detected that another sync is required after this one */
|
/** We detected that another sync is required after this one */
|
||||||
bool _anotherSyncNeeded;
|
bool _anotherSyncNeeded;
|
||||||
|
|
||||||
/* The maximum number of active job in parallel */
|
/* The maximum number of active jobs in parallel */
|
||||||
int maximumActiveJob();
|
int maximumActiveJob();
|
||||||
|
|
||||||
bool isInSharedDirectory(const QString& file);
|
bool isInSharedDirectory(const QString& file);
|
||||||
|
@ -355,7 +355,7 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
/** Emit the finished signal and make sure it is only emit once */
|
/** Emit the finished signal and make sure it is only emitted once */
|
||||||
void emitFinished() {
|
void emitFinished() {
|
||||||
if (!_finishedEmited)
|
if (!_finishedEmited)
|
||||||
emit finished();
|
emit finished();
|
||||||
|
|
|
@ -47,7 +47,7 @@ inline QByteArray getEtagFromReply(QNetworkReply *reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fiven an error from the network, map to a SyncFileItem::Status error
|
* Given an error from the network, map to a SyncFileItem::Status error
|
||||||
*/
|
*/
|
||||||
inline SyncFileItem::Status classifyError(QNetworkReply::NetworkError nerror,
|
inline SyncFileItem::Status classifyError(QNetworkReply::NetworkError nerror,
|
||||||
int httpCode,
|
int httpCode,
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace OCC {
|
||||||
|
|
||||||
// Always coming in with forward slashes.
|
// Always coming in with forward slashes.
|
||||||
// In csync_excluded_no_ctx we ignore all files with longer than 254 chars
|
// In csync_excluded_no_ctx we ignore all files with longer than 254 chars
|
||||||
// This function also adds a dot at the begining of the filename to hide the file on OS X and Linux
|
// This function also adds a dot at the beginning of the filename to hide the file on OS X and Linux
|
||||||
QString OWNCLOUDSYNC_EXPORT createDownloadTmpFileName(const QString &previous) {
|
QString OWNCLOUDSYNC_EXPORT createDownloadTmpFileName(const QString &previous) {
|
||||||
QString tmpFileName;
|
QString tmpFileName;
|
||||||
QString tmpPath;
|
QString tmpPath;
|
||||||
|
@ -57,7 +57,7 @@ QString OWNCLOUDSYNC_EXPORT createDownloadTmpFileName(const QString &previous) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DOES NOT take owncership of the device.
|
// DOES NOT take ownership of the device.
|
||||||
GETFileJob::GETFileJob(AccountPtr account, const QString& path, QFile *device,
|
GETFileJob::GETFileJob(AccountPtr account, const QString& path, QFile *device,
|
||||||
const QMap<QByteArray, QByteArray> &headers, const QByteArray &expectedEtagForResume,
|
const QMap<QByteArray, QByteArray> &headers, const QByteArray &expectedEtagForResume,
|
||||||
quint64 resumeStart, QObject* parent)
|
quint64 resumeStart, QObject* parent)
|
||||||
|
@ -171,7 +171,7 @@ void GETFileJob::slotMetaDataChanged()
|
||||||
if (start != _resumeStart) {
|
if (start != _resumeStart) {
|
||||||
qDebug() << Q_FUNC_INFO << "Wrong content-range: "<< ranges << " while expecting start was" << _resumeStart;
|
qDebug() << Q_FUNC_INFO << "Wrong content-range: "<< ranges << " while expecting start was" << _resumeStart;
|
||||||
if (ranges.isEmpty()) {
|
if (ranges.isEmpty()) {
|
||||||
// device don't support range, just stry again from scratch
|
// device doesn't support range, just try again from scratch
|
||||||
_device->close();
|
_device->close();
|
||||||
if (!_device->open(QIODevice::WriteOnly)) {
|
if (!_device->open(QIODevice::WriteOnly)) {
|
||||||
_errorString = _device->errorString();
|
_errorString = _device->errorString();
|
||||||
|
@ -548,9 +548,9 @@ void PropagateDownloadFileQNAM::slotChecksumFail( const QString& errMsg )
|
||||||
QString makeConflictFileName(const QString &fn, const QDateTime &dt)
|
QString makeConflictFileName(const QString &fn, const QDateTime &dt)
|
||||||
{
|
{
|
||||||
QString conflictFileName(fn);
|
QString conflictFileName(fn);
|
||||||
// Add _conflict-XXXX before the extention.
|
// Add _conflict-XXXX before the extension.
|
||||||
int dotLocation = conflictFileName.lastIndexOf('.');
|
int dotLocation = conflictFileName.lastIndexOf('.');
|
||||||
// If no extention, add it at the end (take care of cases like foo/.hidden or foo.bar/file)
|
// If no extension, add it at the end (take care of cases like foo/.hidden or foo.bar/file)
|
||||||
if (dotLocation <= conflictFileName.lastIndexOf('/') + 1) {
|
if (dotLocation <= conflictFileName.lastIndexOf('/') + 1) {
|
||||||
dotLocation = conflictFileName.size();
|
dotLocation = conflictFileName.size();
|
||||||
}
|
}
|
||||||
|
@ -571,9 +571,9 @@ namespace { // Anonymous namespace for the recall feature
|
||||||
static QString makeRecallFileName(const QString &fn)
|
static QString makeRecallFileName(const QString &fn)
|
||||||
{
|
{
|
||||||
QString recallFileName(fn);
|
QString recallFileName(fn);
|
||||||
// Add _recall-XXXX before the extention.
|
// Add _recall-XXXX before the extension.
|
||||||
int dotLocation = recallFileName.lastIndexOf('.');
|
int dotLocation = recallFileName.lastIndexOf('.');
|
||||||
// If no extention, add it at the end (take care of cases like foo/.hidden or foo.bar/file)
|
// If no extension, add it at the end (take care of cases like foo/.hidden or foo.bar/file)
|
||||||
if (dotLocation <= recallFileName.lastIndexOf('/') + 1) {
|
if (dotLocation <= recallFileName.lastIndexOf('/') + 1) {
|
||||||
dotLocation = recallFileName.size();
|
dotLocation = recallFileName.size();
|
||||||
}
|
}
|
||||||
|
@ -640,7 +640,7 @@ void PropagateDownloadFileQNAM::downloadFinished()
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystem::setModTime(_tmpFile.fileName(), _item->_modtime);
|
FileSystem::setModTime(_tmpFile.fileName(), _item->_modtime);
|
||||||
// We need to fetch the time again because some file system such as FAT have a less than a second
|
// We need to fetch the time again because some file systems such as FAT have worse than a second
|
||||||
// Accuracy, and we really need the time from the file system. (#3103)
|
// Accuracy, and we really need the time from the file system. (#3103)
|
||||||
_item->_modtime = FileSystem::getModTime(_tmpFile.fileName());
|
_item->_modtime = FileSystem::getModTime(_tmpFile.fileName());
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class GETFileJob : public AbstractNetworkJob {
|
||||||
time_t _lastModified;
|
time_t _lastModified;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// DOES NOT take owncership of the device.
|
// DOES NOT take ownership of the device.
|
||||||
explicit GETFileJob(AccountPtr account, const QString& path, QFile *device,
|
explicit GETFileJob(AccountPtr account, const QString& path, QFile *device,
|
||||||
const QMap<QByteArray, QByteArray> &headers, const QByteArray &expectedEtagForResume,
|
const QMap<QByteArray, QByteArray> &headers, const QByteArray &expectedEtagForResume,
|
||||||
quint64 resumeStart, QObject* parent = 0);
|
quint64 resumeStart, QObject* parent = 0);
|
||||||
|
|
|
@ -109,7 +109,7 @@ void PropagateRemoteDelete::slotDeleteJobFinished()
|
||||||
// is ok. This will happen for files that are in the DB but not on
|
// is ok. This will happen for files that are in the DB but not on
|
||||||
// the server or the local file system.
|
// the server or the local file system.
|
||||||
if (httpStatus != 204 && httpStatus != 404) {
|
if (httpStatus != 204 && httpStatus != 404) {
|
||||||
// Normaly we expect "204 No Content"
|
// Normally we expect "204 No Content"
|
||||||
// If it is not the case, it might be because of a proxy or gateway intercepting the request, so we must
|
// If it is not the case, it might be because of a proxy or gateway intercepting the request, so we must
|
||||||
// throw an error.
|
// throw an error.
|
||||||
done(SyncFileItem::NormalError, tr("Wrong HTTP code returned by server. Expected 204, but received \"%1 %2\".")
|
done(SyncFileItem::NormalError, tr("Wrong HTTP code returned by server. Expected 204, but received \"%1 %2\".")
|
||||||
|
|
|
@ -55,7 +55,7 @@ void PropagateRemoteMkdir::slotMkcolJobFinished()
|
||||||
_item->_httpErrorCode = _job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
_item->_httpErrorCode = _job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
|
||||||
if (_item->_httpErrorCode == 405) {
|
if (_item->_httpErrorCode == 405) {
|
||||||
// This happens when the directory already exist. Nothing to do.
|
// This happens when the directory already exists. Nothing to do.
|
||||||
} else if (err != QNetworkReply::NoError) {
|
} else if (err != QNetworkReply::NoError) {
|
||||||
SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode,
|
SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode,
|
||||||
&_propagator->_anotherSyncNeeded);
|
&_propagator->_anotherSyncNeeded);
|
||||||
|
@ -66,7 +66,7 @@ void PropagateRemoteMkdir::slotMkcolJobFinished()
|
||||||
done(status, errorString);
|
done(status, errorString);
|
||||||
return;
|
return;
|
||||||
} else if (_item->_httpErrorCode != 201) {
|
} else if (_item->_httpErrorCode != 201) {
|
||||||
// Normaly we expect "201 Created"
|
// Normally we expect "201 Created"
|
||||||
// If it is not the case, it might be because of a proxy or gateway intercepting the request, so we must
|
// If it is not the case, it might be because of a proxy or gateway intercepting the request, so we must
|
||||||
// throw an error.
|
// throw an error.
|
||||||
done(SyncFileItem::NormalError, tr("Wrong HTTP code returned by server. Expected 201, but received \"%1 %2\".")
|
done(SyncFileItem::NormalError, tr("Wrong HTTP code returned by server. Expected 201, but received \"%1 %2\".")
|
||||||
|
|
|
@ -69,13 +69,13 @@ void PropagateRemoteMove::start()
|
||||||
QString targetFile(_propagator->getFilePath(_item->_renameTarget));
|
QString targetFile(_propagator->getFilePath(_item->_renameTarget));
|
||||||
|
|
||||||
if (_item->_file == _item->_renameTarget) {
|
if (_item->_file == _item->_renameTarget) {
|
||||||
// The parents has been renamed already so there is nothing more to do.
|
// The parent has been renamed already so there is nothing more to do.
|
||||||
finalize();
|
finalize();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_item->_file == QLatin1String("Shared") ) {
|
if (_item->_file == QLatin1String("Shared") ) {
|
||||||
// Before owncloud 7, there was no permissions system. At the time all the shared files were
|
// Before owncloud 7, there was no permissions system. At the time all the shared files were
|
||||||
// in a directory called "Shared" and were not supposed to be moved, otherwise bad things happens
|
// in a directory called "Shared" and were not supposed to be moved, otherwise bad things happened
|
||||||
|
|
||||||
QString versionString = _propagator->account()->serverVersion();
|
QString versionString = _propagator->account()->serverVersion();
|
||||||
if (versionString.contains('.') && versionString.split('.')[0].toInt() < 7) {
|
if (versionString.contains('.') && versionString.split('.')[0].toInt() < 7) {
|
||||||
|
@ -138,7 +138,7 @@ void PropagateRemoteMove::slotMoveJobFinished()
|
||||||
_item->_responseTimeStamp = _job->responseTimestamp();
|
_item->_responseTimeStamp = _job->responseTimestamp();
|
||||||
|
|
||||||
if (_item->_httpErrorCode != 201 ) {
|
if (_item->_httpErrorCode != 201 ) {
|
||||||
// Normaly we expect "201 Created"
|
// Normally we expect "201 Created"
|
||||||
// If it is not the case, it might be because of a proxy or gateway intercepting the request, so we must
|
// If it is not the case, it might be because of a proxy or gateway intercepting the request, so we must
|
||||||
// throw an error.
|
// throw an error.
|
||||||
done(SyncFileItem::NormalError, tr("Wrong HTTP code returned by server. Expected 201, but received \"%1 %2\".")
|
done(SyncFileItem::NormalError, tr("Wrong HTTP code returned by server. Expected 201, but received \"%1 %2\".")
|
||||||
|
|
|
@ -425,8 +425,8 @@ void PropagateUploadFileQNAM::startNextChunk()
|
||||||
if (! _jobs.isEmpty() && _currentChunk + _startChunk >= _chunkCount - 1) {
|
if (! _jobs.isEmpty() && _currentChunk + _startChunk >= _chunkCount - 1) {
|
||||||
// Don't do parallel upload of chunk if this might be the last chunk because the server cannot handle that
|
// Don't do parallel upload of chunk if this might be the last chunk because the server cannot handle that
|
||||||
// https://github.com/owncloud/core/issues/11106
|
// https://github.com/owncloud/core/issues/11106
|
||||||
// We return now and when the _jobs will be finished we will proceed the last chunk
|
// We return now and when the _jobs are finished we will proceed with the last chunk
|
||||||
// NOTE: Some other part of the code such as slotUploadProgress assume also that the last chunk
|
// NOTE: Some other parts of the code such as slotUploadProgress also assume that the last chunk
|
||||||
// is sent last.
|
// is sent last.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -445,15 +445,15 @@ void PropagateUploadFileQNAM::startNextChunk()
|
||||||
// (albeit users are not supposed to mess up with it)
|
// (albeit users are not supposed to mess up with it)
|
||||||
|
|
||||||
// We use a special tag header so that the server may decide to store this file away in some admin stage area
|
// We use a special tag header so that the server may decide to store this file away in some admin stage area
|
||||||
// And not directly in the user's area (what would trigger redownloads etc).
|
// And not directly in the user's area (which would trigger redownloads etc).
|
||||||
headers["OC-Tag"] = ".sys.admin#recall#";
|
headers["OC-Tag"] = ".sys.admin#recall#";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_item->_etag.isEmpty() && _item->_etag != "empty_etag" &&
|
if (!_item->_etag.isEmpty() && _item->_etag != "empty_etag" &&
|
||||||
_item->_instruction != CSYNC_INSTRUCTION_NEW // On new files never send a If-Match
|
_item->_instruction != CSYNC_INSTRUCTION_NEW // On new files never send a If-Match
|
||||||
) {
|
) {
|
||||||
// We add quotes because the owncloud server always add quotes around the etag, and
|
// We add quotes because the owncloud server always adds quotes around the etag, and
|
||||||
// csync_owncloud.c's owncloud_file_id always strip the quotes.
|
// csync_owncloud.c's owncloud_file_id always strips the quotes.
|
||||||
headers["If-Match"] = '"' + _item->_etag + '"';
|
headers["If-Match"] = '"' + _item->_etag + '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ void PropagateUploadFileQNAM::startNextChunk()
|
||||||
qint64 currentChunkSize = fileSize;
|
qint64 currentChunkSize = fileSize;
|
||||||
if (_chunkCount > 1) {
|
if (_chunkCount > 1) {
|
||||||
int sendingChunk = (_currentChunk + _startChunk) % _chunkCount;
|
int sendingChunk = (_currentChunk + _startChunk) % _chunkCount;
|
||||||
// XOR with chunk size to make sure everything goes well if chunk size change between runs
|
// XOR with chunk size to make sure everything goes well if chunk size changes between runs
|
||||||
uint transid = _transferId ^ chunkSize();
|
uint transid = _transferId ^ chunkSize();
|
||||||
qDebug() << "Upload chunk" << sendingChunk << "of" << _chunkCount << "transferid(remote)=" << transid;
|
qDebug() << "Upload chunk" << sendingChunk << "of" << _chunkCount << "transferid(remote)=" << transid;
|
||||||
path += QString("-chunking-%1-%2-%3").arg(transid).arg(_chunkCount).arg(sendingChunk);
|
path += QString("-chunking-%1-%2-%3").arg(transid).arg(_chunkCount).arg(sendingChunk);
|
||||||
|
@ -475,7 +475,7 @@ void PropagateUploadFileQNAM::startNextChunk()
|
||||||
currentChunkSize = chunkSize();
|
currentChunkSize = chunkSize();
|
||||||
if (sendingChunk == _chunkCount - 1) { // last chunk
|
if (sendingChunk == _chunkCount - 1) { // last chunk
|
||||||
currentChunkSize = (fileSize % chunkSize());
|
currentChunkSize = (fileSize % chunkSize());
|
||||||
if( currentChunkSize == 0 ) { // if the last chunk pretents to be 0, its actually the full chunk size.
|
if( currentChunkSize == 0 ) { // if the last chunk pretends to be 0, its actually the full chunk size.
|
||||||
currentChunkSize = chunkSize();
|
currentChunkSize = chunkSize();
|
||||||
}
|
}
|
||||||
if( !_item->_checksum.isEmpty() ) {
|
if( !_item->_checksum.isEmpty() ) {
|
||||||
|
@ -555,7 +555,7 @@ void PropagateUploadFileQNAM::slotPutFinished()
|
||||||
_propagator->_activeJobs--;
|
_propagator->_activeJobs--;
|
||||||
|
|
||||||
if (_finished) {
|
if (_finished) {
|
||||||
// We have send the finished signal already. We don't need to handle any remaining jobs
|
// We have sent the finished signal already. We don't need to handle any remaining jobs
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +601,7 @@ void PropagateUploadFileQNAM::slotPutFinished()
|
||||||
}
|
}
|
||||||
|
|
||||||
_item->_httpErrorCode = job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
_item->_httpErrorCode = job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
// The server needs some time to process the request and provide with a poll URL
|
// The server needs some time to process the request and provide us with a poll URL
|
||||||
if (_item->_httpErrorCode == 202) {
|
if (_item->_httpErrorCode == 202) {
|
||||||
_finished = true;
|
_finished = true;
|
||||||
QString path = QString::fromUtf8(job->reply()->rawHeader("OC-Finish-Poll"));
|
QString path = QString::fromUtf8(job->reply()->rawHeader("OC-Finish-Poll"));
|
||||||
|
@ -655,7 +655,7 @@ void PropagateUploadFileQNAM::slotPutFinished()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_finished = true;
|
_finished = true;
|
||||||
done(SyncFileItem::NormalError, tr("The server did not acknowledge the last chunk. (No e-tag were present)"));
|
done(SyncFileItem::NormalError, tr("The server did not acknowledge the last chunk. (No e-tag was present)"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,8 +692,8 @@ void PropagateUploadFileQNAM::slotPutFinished()
|
||||||
|
|
||||||
if (job->reply()->rawHeader("X-OC-MTime") != "accepted") {
|
if (job->reply()->rawHeader("X-OC-MTime") != "accepted") {
|
||||||
// X-OC-MTime is supported since owncloud 5.0. But not when chunking.
|
// X-OC-MTime is supported since owncloud 5.0. But not when chunking.
|
||||||
// Normaly Owncloud 6 always put X-OC-MTime
|
// Normally Owncloud 6 always puts X-OC-MTime
|
||||||
qWarning() << "Server do not support X-OC-MTime" << job->reply()->rawHeader("X-OC-MTime");
|
qWarning() << "Server does not support X-OC-MTime" << job->reply()->rawHeader("X-OC-MTime");
|
||||||
#ifdef USE_NEON
|
#ifdef USE_NEON
|
||||||
PropagatorJob *newJob = new UpdateMTimeAndETagJob(_propagator, _item);
|
PropagatorJob *newJob = new UpdateMTimeAndETagJob(_propagator, _item);
|
||||||
QObject::connect(newJob, SIGNAL(itemCompleted(SyncFileItem, PropagatorJob)),
|
QObject::connect(newJob, SIGNAL(itemCompleted(SyncFileItem, PropagatorJob)),
|
||||||
|
@ -746,7 +746,7 @@ void PropagateUploadFileQNAM::slotUploadProgress(qint64 sent, qint64 total)
|
||||||
|
|
||||||
// amount is the number of bytes already sent by all the other chunks that were sent
|
// amount is the number of bytes already sent by all the other chunks that were sent
|
||||||
// not including this one.
|
// not including this one.
|
||||||
// FIXME: this assume all chunks have the same size, which is true only if the last chunk
|
// FIXME: this assumes all chunks have the same size, which is true only if the last chunk
|
||||||
// has not been finished (which should not happen because the last chunk is sent sequentially)
|
// has not been finished (which should not happen because the last chunk is sent sequentially)
|
||||||
quint64 amount = progressChunk * chunkSize();
|
quint64 amount = progressChunk * chunkSize();
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ private slots:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This job implements the assynchronous PUT
|
* @brief This job implements the asynchronous PUT
|
||||||
*
|
*
|
||||||
* If the server replies to a PUT with a OC-Finish-Poll url, we will query this url until the server
|
* If the server replies to a PUT with a OC-Finish-Poll url, we will query this url until the server
|
||||||
* replies with an etag. https://github.com/owncloud/core/issues/12097
|
* replies with an etag. https://github.com/owncloud/core/issues/12097
|
||||||
|
@ -171,7 +171,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* This is the next chunk that we need to send. Starting from 0 even if _startChunk != 0
|
* This is the next chunk that we need to send. Starting from 0 even if _startChunk != 0
|
||||||
* (In other words, _startChunk + _currentChunk is really the number of the chunk we need to send next)
|
* (In other words, _startChunk + _currentChunk is really the number of the chunk we need to send next)
|
||||||
* (In other words, _currentChunk is the number of chunk that we already sent or start sending)
|
* (In other words, _currentChunk is the number of the chunk that we already sent or started sending)
|
||||||
*/
|
*/
|
||||||
int _currentChunk;
|
int _currentChunk;
|
||||||
int _chunkCount; /// Total number of chunks for this file
|
int _chunkCount; /// Total number of chunks for this file
|
||||||
|
|
|
@ -204,8 +204,8 @@ void PropagateUploadFileLegacy::start()
|
||||||
if( state == HBF_SUCCESS ) {
|
if( state == HBF_SUCCESS ) {
|
||||||
QByteArray previousEtag;
|
QByteArray previousEtag;
|
||||||
if (!_item->_etag.isEmpty() && _item->_etag != "empty_etag") {
|
if (!_item->_etag.isEmpty() && _item->_etag != "empty_etag") {
|
||||||
// We add quotes because the owncloud server always add quotes around the etag, and
|
// We add quotes because the owncloud server always adds quotes around the etag, and
|
||||||
// csync_owncloud.c's owncloud_file_id always strip the quotes.
|
// csync_owncloud.c's owncloud_file_id always strips the quotes.
|
||||||
previousEtag = '"' + _item->_etag + '"';
|
previousEtag = '"' + _item->_etag + '"';
|
||||||
trans->previous_etag = previousEtag.data();
|
trans->previous_etag = previousEtag.data();
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ void PropagateUploadFileLegacy::start()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString errMsg = tr("Local file changed during sync, syncing once it arrived completely");
|
const QString errMsg = tr("Local file changed during sync, syncing once it arrives completely");
|
||||||
done( SyncFileItem::SoftError, errMsg );
|
done( SyncFileItem::SoftError, errMsg );
|
||||||
} else if( state == HBF_USER_ABORTED ) {
|
} else if( state == HBF_USER_ABORTED ) {
|
||||||
const QString errMsg = tr("Sync was aborted by user.");
|
const QString errMsg = tr("Sync was aborted by user.");
|
||||||
|
@ -273,7 +273,7 @@ void PropagateUploadFileLegacy::start()
|
||||||
_propagator->_journal->commit("upload file start");
|
_propagator->_journal->commit("upload file start");
|
||||||
|
|
||||||
if (hbf_validate_source_file(trans.data()) == HBF_SOURCE_FILE_CHANGE) {
|
if (hbf_validate_source_file(trans.data()) == HBF_SOURCE_FILE_CHANGE) {
|
||||||
/* Did the source file changed since the upload ?
|
/* Has the source file changed since the upload ?
|
||||||
* This is different from the previous check because the previous check happens between
|
* This is different from the previous check because the previous check happens between
|
||||||
* chunks while this one happens when the whole file has been uploaded.
|
* chunks while this one happens when the whole file has been uploaded.
|
||||||
*
|
*
|
||||||
|
@ -299,7 +299,7 @@ void PropagateUploadFileLegacy::start()
|
||||||
qDebug() << "Remove the invalid file from server:" << rc;
|
qDebug() << "Remove the invalid file from server:" << rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString errMsg = tr("Local file changed during sync, syncing once it arrived completely");
|
const QString errMsg = tr("Local file changed during sync, syncing once it arrives completely");
|
||||||
done( SyncFileItem::SoftError, errMsg );
|
done( SyncFileItem::SoftError, errMsg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -506,7 +506,7 @@ void PropagateDownloadFileLegacy::install_content_reader( ne_request *req, void
|
||||||
if (start != that->_resumeStart) {
|
if (start != that->_resumeStart) {
|
||||||
qDebug() << Q_FUNC_INFO << "Wrong content-range: "<< ranges << " while expecting start was" << that->_resumeStart;
|
qDebug() << Q_FUNC_INFO << "Wrong content-range: "<< ranges << " while expecting start was" << that->_resumeStart;
|
||||||
if (start == 0) {
|
if (start == 0) {
|
||||||
// device don't support range, just stry again from scratch
|
// device doesn't support range, just try again from scratch
|
||||||
that->_file->close();
|
that->_file->close();
|
||||||
if (!that->_file->open(QIODevice::WriteOnly)) {
|
if (!that->_file->open(QIODevice::WriteOnly)) {
|
||||||
that->abortTransfer(req, that->_file->errorString());
|
that->abortTransfer(req, that->_file->errorString());
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace OCC {
|
||||||
/**
|
/**
|
||||||
* Code inspired from Qt5's QDir::removeRecursively
|
* Code inspired from Qt5's QDir::removeRecursively
|
||||||
* The code will update the database in case of error.
|
* The code will update the database in case of error.
|
||||||
* If everything goes well (no error, returns true), the caller is responsible of removing the entries
|
* If everything goes well (no error, returns true), the caller is responsible for removing the entries
|
||||||
* in the database. But in case of error, we need to remove the entries from the database of the files
|
* in the database. But in case of error, we need to remove the entries from the database of the files
|
||||||
* that were deleted.
|
* that were deleted.
|
||||||
*
|
*
|
||||||
|
@ -208,7 +208,7 @@ void PropagateLocalRename::start()
|
||||||
SyncJournalFileRecord record(*_item, targetFile);
|
SyncJournalFileRecord record(*_item, targetFile);
|
||||||
record._path = _item->_renameTarget;
|
record._path = _item->_renameTarget;
|
||||||
|
|
||||||
if (!_item->_isDirectory) { // Directory are saved at the end
|
if (!_item->_isDirectory) { // Directories are saved at the end
|
||||||
_propagator->_journal->setFileRecord(record);
|
_propagator->_journal->setFileRecord(record);
|
||||||
}
|
}
|
||||||
_propagator->_journal->commit("localRename");
|
_propagator->_journal->commit("localRename");
|
||||||
|
|
|
@ -140,7 +140,7 @@ QString SyncEngine::csyncErrorToString(CSYNC_STATUS err)
|
||||||
errStr = tr("A HTTP transmission error happened.");
|
errStr = tr("A HTTP transmission error happened.");
|
||||||
break;
|
break;
|
||||||
case CSYNC_STATUS_PERMISSION_DENIED:
|
case CSYNC_STATUS_PERMISSION_DENIED:
|
||||||
errStr = tr("CSync failed due to not handled permission deniend.");
|
errStr = tr("CSync failed due to unhandled permission denied.");
|
||||||
break;
|
break;
|
||||||
case CSYNC_STATUS_NOT_FOUND:
|
case CSYNC_STATUS_NOT_FOUND:
|
||||||
errStr = tr("CSync failed to access") + " "; // filename gets added.
|
errStr = tr("CSync failed to access") + " "; // filename gets added.
|
||||||
|
@ -319,7 +319,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets a default-contructed SyncFileItemPtr or the one from the first walk (=local walk)
|
// Gets a default-constructed SyncFileItemPtr or the one from the first walk (=local walk)
|
||||||
SyncFileItemPtr item = _syncItemMap.value(key);
|
SyncFileItemPtr item = _syncItemMap.value(key);
|
||||||
if (!item)
|
if (!item)
|
||||||
item = SyncFileItemPtr(new SyncFileItem);
|
item = SyncFileItemPtr(new SyncFileItem);
|
||||||
|
@ -374,7 +374,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
|
||||||
// record the seen files to be able to clean the journal later
|
// record the seen files to be able to clean the journal later
|
||||||
_seenFiles.insert(item->_file);
|
_seenFiles.insert(item->_file);
|
||||||
if (!renameTarget.isEmpty()) {
|
if (!renameTarget.isEmpty()) {
|
||||||
// Yes, this record both the rename renameTarget and the original so we keep both in case of a rename
|
// Yes, this records both the rename renameTarget and the original so we keep both in case of a rename
|
||||||
_seenFiles.insert(renameTarget);
|
_seenFiles.insert(renameTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,8 +464,8 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
|
||||||
// Or for files that were detected as "resolved conflict".
|
// Or for files that were detected as "resolved conflict".
|
||||||
// They should have been a conflict because they both were new, or both
|
// They should have been a conflict because they both were new, or both
|
||||||
// had their local mtime or remote etag modified, but the size and mtime
|
// had their local mtime or remote etag modified, but the size and mtime
|
||||||
// is the same on the server. This typically happen when the database is removed.
|
// is the same on the server. This typically happens when the database is removed.
|
||||||
// Nothing will be done for those file, but we still need to update the database.
|
// Nothing will be done for those files, but we still need to update the database.
|
||||||
|
|
||||||
// Even if the mtime is different on the server, we always want to keep the mtime from
|
// Even if the mtime is different on the server, we always want to keep the mtime from
|
||||||
// the file system in the DB, this is to avoid spurious upload on the next sync
|
// the file system in the DB, this is to avoid spurious upload on the next sync
|
||||||
|
@ -475,7 +475,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
|
||||||
item->_should_update_metadata = false;
|
item->_should_update_metadata = false;
|
||||||
}
|
}
|
||||||
if (item->_isDirectory && file->should_update_metadata) {
|
if (item->_isDirectory && file->should_update_metadata) {
|
||||||
// Because we want still to update etags of directories
|
// Because we want to still update etags of directories
|
||||||
dir = SyncFileItem::None;
|
dir = SyncFileItem::None;
|
||||||
} else {
|
} else {
|
||||||
// No need to do anything.
|
// No need to do anything.
|
||||||
|
@ -509,7 +509,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
|
||||||
dir = remote ? SyncFileItem::Down : SyncFileItem::Up;
|
dir = remote ? SyncFileItem::Down : SyncFileItem::Up;
|
||||||
if (!remote && file->instruction == CSYNC_INSTRUCTION_SYNC) {
|
if (!remote && file->instruction == CSYNC_INSTRUCTION_SYNC) {
|
||||||
// An upload of an existing file means that the file was left unchanged on the server
|
// An upload of an existing file means that the file was left unchanged on the server
|
||||||
// This count as a NONE for detecting if all the file on the server were changed
|
// This counts as a NONE for detecting if all the files on the server were changed
|
||||||
_hasNoneFiles = true;
|
_hasNoneFiles = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1075,7 +1075,7 @@ void SyncEngine::checkForPermission()
|
||||||
// delete jobs intact. It is not physically tried to remove this files
|
// delete jobs intact. It is not physically tried to remove this files
|
||||||
// underneath, propagator sees that.
|
// underneath, propagator sees that.
|
||||||
if( (*it)->_isDirectory ) {
|
if( (*it)->_isDirectory ) {
|
||||||
// put a more descriptive message if really a top level share dir is removed.
|
// put a more descriptive message if a top level share dir really is removed.
|
||||||
if( it == _syncedItems.begin() || !(path.startsWith((*(it-1))->_file)) ) {
|
if( it == _syncedItems.begin() || !(path.startsWith((*(it-1))->_file)) ) {
|
||||||
(*it)->_errorString = tr("Local files and share folder removed.");
|
(*it)->_errorString = tr("Local files and share folder removed.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ public:
|
||||||
auto data1 = d1.constData();
|
auto data1 = d1.constData();
|
||||||
auto data2 = d2.constData();
|
auto data2 = d2.constData();
|
||||||
|
|
||||||
// Find the lenght of the largest prefix
|
// Find the length of the largest prefix
|
||||||
int prefixL = 0;
|
int prefixL = 0;
|
||||||
auto minSize = std::min(d1.size(), d2.size());
|
auto minSize = std::min(d1.size(), d2.size());
|
||||||
while (prefixL < minSize && data1[prefixL] == data2[prefixL]) { prefixL++; }
|
while (prefixL < minSize && data1[prefixL] == data2[prefixL]) { prefixL++; }
|
||||||
|
@ -124,7 +124,7 @@ public:
|
||||||
|| !_errorString.isEmpty();
|
|| !_errorString.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables usefull for everybody
|
// Variables useful for everybody
|
||||||
QString _file;
|
QString _file;
|
||||||
QString _renameTarget;
|
QString _renameTarget;
|
||||||
Type _type BITFIELD(3);
|
Type _type BITFIELD(3);
|
||||||
|
@ -137,7 +137,7 @@ public:
|
||||||
/// without the status being FileIgnored.
|
/// without the status being FileIgnored.
|
||||||
bool _hasBlacklistEntry BITFIELD(1);
|
bool _hasBlacklistEntry BITFIELD(1);
|
||||||
|
|
||||||
// Variables usefull to report to the user
|
// Variables useful to report to the user
|
||||||
Status _status BITFIELD(4);
|
Status _status BITFIELD(4);
|
||||||
bool _isRestoration BITFIELD(1); // The original operation was forbidden, and this is a restoration
|
bool _isRestoration BITFIELD(1); // The original operation was forbidden, and this is a restoration
|
||||||
bool _should_update_metadata BITFIELD(1);
|
bool _should_update_metadata BITFIELD(1);
|
||||||
|
|
|
@ -79,7 +79,7 @@ void SyncJournalDb::startTransaction()
|
||||||
_transaction = 1;
|
_transaction = 1;
|
||||||
// qDebug() << "XXX Transaction start!";
|
// qDebug() << "XXX Transaction start!";
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Database Transaction is running, do not starting another one!";
|
qDebug() << "Database Transaction is running, not starting another one!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ bool SyncJournalDb::checkConnect()
|
||||||
return sqlFail("Set PRAGMA case_sensitivity", pragma1);
|
return sqlFail("Set PRAGMA case_sensitivity", pragma1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Because insert are so slow, e do everything in a transaction, and one need to call commit */
|
/* Because insert is so slow, we do everything in a transaction, and only need one call to commit */
|
||||||
startTransaction();
|
startTransaction();
|
||||||
|
|
||||||
SqlQuery createQuery(_db);
|
SqlQuery createQuery(_db);
|
||||||
|
@ -334,7 +334,7 @@ bool SyncJournalDb::checkConnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we are upgrading from a client version older than 1.5 is found,
|
* If we are upgrading from a client version older than 1.5,
|
||||||
* we cannot read from the database because we need to fetch the files id and etags.
|
* we cannot read from the database because we need to fetch the files id and etags.
|
||||||
*
|
*
|
||||||
* If 1.8.0 caused missing data in the local tree, so we also don't read from DB
|
* If 1.8.0 caused missing data in the local tree, so we also don't read from DB
|
||||||
|
@ -789,7 +789,7 @@ bool SyncJournalDb::postSyncCleanup(const QSet<QString>& filepathsToKeep,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incoroporate results back into main DB
|
// Incorporate results back into main DB
|
||||||
walCheckpoint();
|
walCheckpoint();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1341,7 +1341,7 @@ void SyncJournalDb::avoidRenamesOnNextSync(const QString& path)
|
||||||
|
|
||||||
void SyncJournalDb::avoidReadFromDbOnNextSync(const QString& fileName)
|
void SyncJournalDb::avoidReadFromDbOnNextSync(const QString& fileName)
|
||||||
{
|
{
|
||||||
//Make sure that on the next sync, filName is not read from the DB but use the PROPFIND to
|
// Make sure that on the next sync, fileName is not read from the DB but uses the PROPFIND to
|
||||||
// get the info from the server
|
// get the info from the server
|
||||||
// We achieve that by clearing the etag of the parents directory recursively
|
// We achieve that by clearing the etag of the parents directory recursively
|
||||||
|
|
||||||
|
@ -1352,7 +1352,7 @@ void SyncJournalDb::avoidReadFromDbOnNextSync(const QString& fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
SqlQuery query(_db);
|
SqlQuery query(_db);
|
||||||
// This query will match entries for whitch the path is a prefix of fileName
|
// This query will match entries for which the path is a prefix of fileName
|
||||||
query.prepare("UPDATE metadata SET md5='_invalid_' WHERE ?1 LIKE(path||'/%') AND type == 2;"); // CSYNC_FTW_TYPE_DIR == 2
|
query.prepare("UPDATE metadata SET md5='_invalid_' WHERE ?1 LIKE(path||'/%') AND type == 2;"); // CSYNC_FTW_TYPE_DIR == 2
|
||||||
query.bindValue(1, fileName);
|
query.bindValue(1, fileName);
|
||||||
if( !query.exec() ) {
|
if( !query.exec() ) {
|
||||||
|
|
|
@ -27,9 +27,9 @@ class SyncJournalFileRecord;
|
||||||
class SyncJournalErrorBlacklistRecord;
|
class SyncJournalErrorBlacklistRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Class that handle the sync database
|
* @brief Class that handles the sync database
|
||||||
*
|
*
|
||||||
* This class is thread safe. All public function are locking the mutex.
|
* This class is thread safe. All public functions lock the mutex.
|
||||||
* @ingroup libsync
|
* @ingroup libsync
|
||||||
*/
|
*/
|
||||||
class OWNCLOUDSYNC_EXPORT SyncJournalDb : public QObject
|
class OWNCLOUDSYNC_EXPORT SyncJournalDb : public QObject
|
||||||
|
@ -97,11 +97,11 @@ public:
|
||||||
* For the sync engine, those folders are considered as if they were not there, so the local
|
* For the sync engine, those folders are considered as if they were not there, so the local
|
||||||
* folders will be deleted */
|
* folders will be deleted */
|
||||||
SelectiveSyncBlackList = 1,
|
SelectiveSyncBlackList = 1,
|
||||||
/** When a shared flder has a size bigger than a configured size, it is by default not sync'ed
|
/** When a shared folder has a size bigger than a configured size, it is by default not sync'ed
|
||||||
* Unless it is in the white list, in which case the folder is sync'ed and all its children.
|
* Unless it is in the white list, in which case the folder is sync'ed and all its children.
|
||||||
* If a folder is both on the black and the white list, the black list wins */
|
* If a folder is both on the black and the white list, the black list wins */
|
||||||
SelectiveSyncWhiteList = 2,
|
SelectiveSyncWhiteList = 2,
|
||||||
/** List of big sync folder that have not been confirmed by the user yet and that the UI
|
/** List of big sync folders that have not been confirmed by the user yet and that the UI
|
||||||
* should notify about */
|
* should notify about */
|
||||||
SelectiveSyncUndecidedList = 3
|
SelectiveSyncUndecidedList = 3
|
||||||
};
|
};
|
||||||
|
@ -111,7 +111,7 @@ public:
|
||||||
void setSelectiveSyncList(SelectiveSyncListType type, const QStringList &list);
|
void setSelectiveSyncList(SelectiveSyncListType type, const QStringList &list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure that on the next sync, filName is not read from the DB but use the PROPFIND to
|
* Make sure that on the next sync, fileName is not read from the DB but uses the PROPFIND to
|
||||||
* get the info from the server
|
* get the info from the server
|
||||||
*/
|
*/
|
||||||
void avoidReadFromDbOnNextSync(const QString& fileName);
|
void avoidReadFromDbOnNextSync(const QString& fileName);
|
||||||
|
@ -126,7 +126,7 @@ public:
|
||||||
bool postSyncCleanup(const QSet<QString>& filepathsToKeep,
|
bool postSyncCleanup(const QSet<QString>& filepathsToKeep,
|
||||||
const QSet<QString>& prefixesToKeep);
|
const QSet<QString>& prefixesToKeep);
|
||||||
|
|
||||||
/* Because sqlite transactions is really slow, we encapsulate everything in big transactions
|
/* Because sqlite transactions are really slow, we encapsulate everything in big transactions
|
||||||
* Commit will actually commit the transaction and create a new one.
|
* Commit will actually commit the transaction and create a new one.
|
||||||
*/
|
*/
|
||||||
void commit(const QString &context, bool startTrans = true);
|
void commit(const QString &context, bool startTrans = true);
|
||||||
|
|
|
@ -40,7 +40,7 @@ SyncJournalFileRecord::SyncJournalFileRecord(const SyncFileItem &item, const QSt
|
||||||
// use the "old" inode coming with the item for the case where the
|
// use the "old" inode coming with the item for the case where the
|
||||||
// filesystem stat fails. That can happen if the the file was removed
|
// filesystem stat fails. That can happen if the the file was removed
|
||||||
// or renamed meanwhile. For the rename case we still need the inode to
|
// or renamed meanwhile. For the rename case we still need the inode to
|
||||||
// detect the rename tough.
|
// detect the rename though.
|
||||||
_inode = item._inode;
|
_inode = item._inode;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
|
@ -195,8 +195,8 @@ Theme::Theme() :
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this option return true, the client only supports one folder to sync.
|
// If this option returns true, the client only supports one folder to sync.
|
||||||
// The Add-Button is removed accoringly.
|
// The Add-Button is removed accordingly.
|
||||||
bool Theme::singleSyncFolder() const {
|
bool Theme::singleSyncFolder() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace Utility
|
||||||
*/
|
*/
|
||||||
OWNCLOUDSYNC_EXPORT bool hasDarkSystray();
|
OWNCLOUDSYNC_EXPORT bool hasDarkSystray();
|
||||||
|
|
||||||
// convinience OS detection methods
|
// convenience OS detection methods
|
||||||
OWNCLOUDSYNC_EXPORT bool isWindows();
|
OWNCLOUDSYNC_EXPORT bool isWindows();
|
||||||
OWNCLOUDSYNC_EXPORT bool isMac();
|
OWNCLOUDSYNC_EXPORT bool isMac();
|
||||||
OWNCLOUDSYNC_EXPORT bool isUnix();
|
OWNCLOUDSYNC_EXPORT bool isUnix();
|
||||||
|
@ -98,7 +98,7 @@ namespace Utility
|
||||||
// if false, the two cases are two different files.
|
// if false, the two cases are two different files.
|
||||||
OWNCLOUDSYNC_EXPORT bool fsCasePreserving();
|
OWNCLOUDSYNC_EXPORT bool fsCasePreserving();
|
||||||
|
|
||||||
// Call the given command with the switch --version and retrun the first line
|
// Call the given command with the switch --version and rerun the first line
|
||||||
// of the output.
|
// of the output.
|
||||||
// If command is empty, the function calls the running application which, on
|
// If command is empty, the function calls the running application which, on
|
||||||
// Linux, might have changed while this one is running.
|
// Linux, might have changed while this one is running.
|
||||||
|
@ -116,7 +116,7 @@ namespace Utility
|
||||||
quint64 addLapTime( const QString& lapName );
|
quint64 addLapTime( const QString& lapName );
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
// out helpers, return the masured times.
|
// out helpers, return the measured times.
|
||||||
QDateTime startTime() const;
|
QDateTime startTime() const;
|
||||||
QDateTime timeOfLap( const QString& lapName ) const;
|
QDateTime timeOfLap( const QString& lapName ) const;
|
||||||
quint64 durationOfLap( const QString& lapName ) const;
|
quint64 durationOfLap( const QString& lapName ) const;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче