Commit a363aa08 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge branch 'develop' of https://stash.z-hub.io/scm/zp/z-push into...

Merge branch 'develop' of https://stash.z-hub.io/scm/zp/z-push into bugfix/ZP-839-z-push-top-writes-over-several-lines

Conflicts:
	src/lib/request/sync.php
parents f082609f abf4c77c
......@@ -125,7 +125,7 @@ class SyncCollections implements Iterator {
*
* @access public
* @throws StatusException with SyncCollections::ERROR_WRONG_HIERARCHY if permission check fails
* @throws StateNotFoundException if the sync state can not be found ($loadState = true)
* @throws StateInvalidException if the sync state can not be found or relation between states is invalid ($loadState = true)
* @return boolean
*/
public function LoadAllCollections($overwriteLoaded = false, $loadState = false, $checkPermissions = false) {
......@@ -161,7 +161,7 @@ class SyncCollections implements Iterator {
*
* @access public
* @throws StatusException with SyncCollections::ERROR_WRONG_HIERARCHY if permission check fails
* @throws StateNotFoundException if the sync state can not be found ($loadState = true)
* @throws StateInvalidException if the sync state can not be found or relation between states is invalid ($loadState = true)
* @return boolean
*/
public function LoadCollection($folderid, $loadState = false, $checkPermissions = false) {
......@@ -206,8 +206,7 @@ class SyncCollections implements Iterator {
// make sure this folder is fully synched on next Sync request
$this->invalidateFolderStat($spa);
// rethrow the exception
throw $snfe;
return false;
}
}
......
......@@ -67,26 +67,20 @@ class Ping extends RequestProcessor {
try {
$sc->LoadAllCollections(true, true, true);
}
catch (StateNotFoundException $snfex) {
catch (StateInvalidException $siex) {
// if no params are present, indicate to send params, else do hierarchy sync
if (!$params_present) {
$pingstatus = SYNC_PINGSTATUS_FAILINGPARAMS;
self::$topCollector->AnnounceInformation("StateNotFoundException: require PingParameters", true);
self::$topCollector->AnnounceInformation("StateInvalidException: require PingParameters", true);
}
else {
// we do not have a ping status for this, but SyncCollections should have generated fake changes for the folders which are broken
$fakechanges = $sc->GetChangedFolderIds();
$foundchanges = true;
self::$topCollector->AnnounceInformation("StateNotFoundException: force sync", true);
}
}
catch (StateInvalidException $snfex) {
// we do not have a ping status for this, but SyncCollections should have generated fake changes for the folders which are broken
$fakechanges = $sc->GetChangedFolderIds();
$foundchanges = true;
self::$topCollector->AnnounceInformation("StateInvalidException: force sync", true);
}
}
catch (StatusException $stex) {
$pingstatus = SYNC_PINGSTATUS_FOLDERHIERSYNCREQUIRED;
self::$topCollector->AnnounceInformation("StatusException: require HierarchySync", true);
......
......@@ -578,7 +578,7 @@ class Sync extends RequestProcessor {
try {
$sc->LoadAllCollections(false, true, true);
}
catch (StateNotFoundException $snfex) {
catch (StateInvalidException $siex) {
$status = SYNC_STATUS_INVALIDSYNCKEY;
self::$topCollector->AnnounceInformation("StateNotFoundException", $this->singleFolder);
$this->saveMultiFolderInfo("exeption", "StateNotFoundException");
......@@ -725,10 +725,10 @@ class Sync extends RequestProcessor {
}
// compare the folder statistics if the backend supports this
if ($setupExporter && self::$backend->HasFolderStats() && $spa->HasFolderStat()) {
if ($setupExporter && self::$backend->HasFolderStats()) {
// check if the folder stats changed -> if not, don't setup the exporter, there are no changes!
$newFolderStat = self::$backend->GetFolderStat(ZPush::GetAdditionalSyncFolderStore($spa->GetFolderId()), $spa->GetFolderId());
if ($newFolderStat === $spa->GetFolderStat()) {
if ($spa->HasFolderStat() && $newFolderStat === $spa->GetFolderStat()) {
$changecount = 0;
$setupExporter = false;
ZLog::Write(LOGLEVEL_DEBUG, "Sync(): Folder stat from the backend indicates that the folder did not change. Exporter will not run.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment