Commit abf4c77c authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #154 in ZP/z-push from...

Merge pull request #154 in ZP/z-push from bugfix/ZP-840-ping-loop-if-exporter-state-is-not to develop

* commit 'a1541482':
  ZP-840 Rename exception variable.
  ZP-840 Renamed exception variable.
  ZP-840 Catch StateInvalidException when in partial mode.
  ZP-840 Do not throw StateNotFoundException as this messes up Ping. Just treat it as StateInvalid (which is true, FD indicates a state that is not available), do not catch both types in Ping as only StateInvalidException will be thrown.
parents 84b0404c a1541482
...@@ -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;
......
...@@ -566,9 +566,9 @@ class Sync extends RequestProcessor { ...@@ -566,9 +566,9 @@ 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", true); self::$topCollector->AnnounceInformation("StateInvalidException", true);
} }
catch (StatusException $stex) { catch (StatusException $stex) {
$status = SYNC_STATUS_FOLDERHIERARCHYCHANGED; $status = SYNC_STATUS_FOLDERHIERARCHYCHANGED;
......
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