Commit 1ace7d29 authored by skummer's avatar skummer

ZP-174 #comment when <Folders/> are requested for push, perform only policy...

ZP-174 #comment when <Folders/> are requested for push, perform only policy checks, fixed typo #time 1h

git-svn-id: https://z-push.org/svn/z-push/trunk@1446 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 6b2eda06
...@@ -414,22 +414,19 @@ class SyncCollections implements Iterator { ...@@ -414,22 +414,19 @@ class SyncCollections implements Iterator {
} }
$checkClasses = implode("/", $classes); $checkClasses = implode("/", $classes);
// is there something to check?
if (empty($this->collections) || ($onlyPingable && empty($classes)))
throw new StatusException("SyncCollections->CheckForChanges(): no collections available", self::ERROR_NO_COLLECTIONS);
$pingTracking = new PingTracking(); $pingTracking = new PingTracking();
$this->changes = array(); $this->changes = array();
$changesAvailable = false; $changesAvailable = false;
ZPush::GetTopCollector()->SetAsPushConnection(); ZPush::GetTopCollector()->SetAsPushConnection();
ZPush::GetTopCollector()->AnnounceInformation(sprintf("lifetime %ds", $lifetime), true); ZPush::GetTopCollector()->AnnounceInformation(sprintf("lifetime %ds", $lifetime), true);
ZLog::Write(LOGLEVEL_INFO, sprintf("SyncCollections->CheckForChanges(): Waiting for changes... (lifetime %d seconds)", $lifetime)); ZLog::Write(LOGLEVEL_INFO, sprintf("SyncCollections->CheckForChanges(): Waiting for %s changes... (lifetime %d seconds)", (empty($classes))?'policy':'store', $lifetime));
// use changes sink where available // use changes sink where available
$changesSink = false; $changesSink = false;
$forceRealExport = 0; $forceRealExport = 0;
if (ZPush::GetBackend()->HasChangesSink()) { // do not create changessink if there are no folders
if (!empty($classes) && ZPush::GetBackend()->HasChangesSink()) {
$changesSink = true; $changesSink = true;
// initialize all possible folders // initialize all possible folders
......
...@@ -60,7 +60,7 @@ class Sync extends RequestProcessor { ...@@ -60,7 +60,7 @@ class Sync extends RequestProcessor {
$sc = new SyncCollections(); $sc = new SyncCollections();
$status = SYNC_STATUS_SUCCESS; $status = SYNC_STATUS_SUCCESS;
$wbxmlproblem = false; $wbxmlproblem = false;
$emtpysync = false; $emptysync = false;
// Start Synchronize // Start Synchronize
if(self::$decoder->getElementStartTag(SYNC_SYNCHRONIZE)) { if(self::$decoder->getElementStartTag(SYNC_SYNCHRONIZE)) {
...@@ -513,7 +513,7 @@ class Sync extends RequestProcessor { ...@@ -513,7 +513,7 @@ class Sync extends RequestProcessor {
} }
// we did not receive a SYNCHRONIZE block - assume empty sync // we did not receive a SYNCHRONIZE block - assume empty sync
else { else {
$emtpysync = true; $emptysync = true;
} }
// END SYNCHRONIZE // END SYNCHRONIZE
...@@ -526,7 +526,7 @@ class Sync extends RequestProcessor { ...@@ -526,7 +526,7 @@ class Sync extends RequestProcessor {
} }
// Partial & Empty Syncs need saved data to proceed with synchronization // Partial & Empty Syncs need saved data to proceed with synchronization
if ($status == SYNC_STATUS_SUCCESS && (! $sc->HasCollections() || $partial === true )) { if ($status == SYNC_STATUS_SUCCESS && ($emptysync === true || $partial === true) ) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): Partial or Empty sync requested. Retrieving data of synchronized folders.")); ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): Partial or Empty sync requested. Retrieving data of synchronized folders."));
// Load all collections - do not overwrite existing (received!), laod states and check permissions // Load all collections - do not overwrite existing (received!), laod states and check permissions
...@@ -559,7 +559,7 @@ class Sync extends RequestProcessor { ...@@ -559,7 +559,7 @@ class Sync extends RequestProcessor {
} }
// HEARTBEAT & Empty sync // HEARTBEAT & Empty sync
if ($status == SYNC_STATUS_SUCCESS && (isset($hbinterval) || $emtpysync == true)) { if ($status == SYNC_STATUS_SUCCESS && (isset($hbinterval) || $emptysync == true)) {
$interval = (defined('PING_INTERVAL') && PING_INTERVAL > 0) ? PING_INTERVAL : 30; $interval = (defined('PING_INTERVAL') && PING_INTERVAL > 0) ? PING_INTERVAL : 30;
if (isset($hbinterval)) if (isset($hbinterval))
...@@ -579,7 +579,7 @@ class Sync extends RequestProcessor { ...@@ -579,7 +579,7 @@ class Sync extends RequestProcessor {
// wait for changes // wait for changes
try { try {
// if doing an empty sync, check only once for changes // if doing an empty sync, check only once for changes
if ($emtpysync) { if ($emptysync) {
$foundchanges = $sc->CountChanges(); $foundchanges = $sc->CountChanges();
} }
// wait for changes // wait for changes
...@@ -594,7 +594,7 @@ class Sync extends RequestProcessor { ...@@ -594,7 +594,7 @@ class Sync extends RequestProcessor {
} }
// in case of an empty sync with no changes, we can reply with an empty response // in case of an empty sync with no changes, we can reply with an empty response
if ($emtpysync && !$foundchanges){ if ($emptysync && !$foundchanges){
ZLog::Write(LOGLEVEL_DEBUG, "No changes found for empty sync. Replying with empty response"); ZLog::Write(LOGLEVEL_DEBUG, "No changes found for empty sync. Replying with empty response");
return true; return true;
} }
......
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