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 { ...@@ -125,7 +125,7 @@ class SyncCollections implements Iterator {
* *
* @access public * @access public
* @throws StatusException with SyncCollections::ERROR_WRONG_HIERARCHY if permission check fails * @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 * @return boolean
*/ */
public function LoadAllCollections($overwriteLoaded = false, $loadState = false, $checkPermissions = false) { public function LoadAllCollections($overwriteLoaded = false, $loadState = false, $checkPermissions = false) {
...@@ -161,7 +161,7 @@ class SyncCollections implements Iterator { ...@@ -161,7 +161,7 @@ class SyncCollections implements Iterator {
* *
* @access public * @access public
* @throws StatusException with SyncCollections::ERROR_WRONG_HIERARCHY if permission check fails * @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 * @return boolean
*/ */
public function LoadCollection($folderid, $loadState = false, $checkPermissions = false) { public function LoadCollection($folderid, $loadState = false, $checkPermissions = false) {
...@@ -206,8 +206,7 @@ class SyncCollections implements Iterator { ...@@ -206,8 +206,7 @@ class SyncCollections implements Iterator {
// make sure this folder is fully synched on next Sync request // make sure this folder is fully synched on next Sync request
$this->invalidateFolderStat($spa); $this->invalidateFolderStat($spa);
// rethrow the exception return false;
throw $snfe;
} }
} }
......
...@@ -67,25 +67,19 @@ class Ping extends RequestProcessor { ...@@ -67,25 +67,19 @@ class Ping extends RequestProcessor {
try { try {
$sc->LoadAllCollections(true, true, true); $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 no params are present, indicate to send params, else do hierarchy sync
if (!$params_present) { if (!$params_present) {
$pingstatus = SYNC_PINGSTATUS_FAILINGPARAMS; $pingstatus = SYNC_PINGSTATUS_FAILINGPARAMS;
self::$topCollector->AnnounceInformation("StateNotFoundException: require PingParameters", true); self::$topCollector->AnnounceInformation("StateInvalidException: require PingParameters", true);
} }
else { else {
// we do not have a ping status for this, but SyncCollections should have generated fake changes for the folders which are broken // 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(); $fakechanges = $sc->GetChangedFolderIds();
$foundchanges = true; $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); self::$topCollector->AnnounceInformation("StateInvalidException: force sync", true);
}
} }
catch (StatusException $stex) { catch (StatusException $stex) {
$pingstatus = SYNC_PINGSTATUS_FOLDERHIERSYNCREQUIRED; $pingstatus = SYNC_PINGSTATUS_FOLDERHIERSYNCREQUIRED;
......
...@@ -578,7 +578,7 @@ class Sync extends RequestProcessor { ...@@ -578,7 +578,7 @@ class Sync extends RequestProcessor {
try { try {
$sc->LoadAllCollections(false, true, true); $sc->LoadAllCollections(false, true, true);
} }
catch (StateNotFoundException $snfex) { catch (StateInvalidException $siex) {
$status = SYNC_STATUS_INVALIDSYNCKEY; $status = SYNC_STATUS_INVALIDSYNCKEY;
self::$topCollector->AnnounceInformation("StateNotFoundException", $this->singleFolder); self::$topCollector->AnnounceInformation("StateNotFoundException", $this->singleFolder);
$this->saveMultiFolderInfo("exeption", "StateNotFoundException"); $this->saveMultiFolderInfo("exeption", "StateNotFoundException");
...@@ -725,10 +725,10 @@ class Sync extends RequestProcessor { ...@@ -725,10 +725,10 @@ class Sync extends RequestProcessor {
} }
// compare the folder statistics if the backend supports this // 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! // 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()); $newFolderStat = self::$backend->GetFolderStat(ZPush::GetAdditionalSyncFolderStore($spa->GetFolderId()), $spa->GetFolderId());
if ($newFolderStat === $spa->GetFolderStat()) { if ($spa->HasFolderStat() && $newFolderStat === $spa->GetFolderStat()) {
$changecount = 0; $changecount = 0;
$setupExporter = false; $setupExporter = false;
ZLog::Write(LOGLEVEL_DEBUG, "Sync(): Folder stat from the backend indicates that the folder did not change. Exporter will not run."); 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