Commit ff1ec4cd authored by Sebastian Kummer's avatar Sebastian Kummer

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

Merge pull request #138 in ZP/z-push from bugfix/ZP-824-foldersync-should-cause-ping-to-force to develop

* commit 'd8718bdc':
  ZP-824 Remove local $sc as it is not needed.
  ZP-824 Invalidate all pingable flags on folders when doing a FolderSync (with changes) or FolderChange (Create, Update, Delete) operation.

(cherry picked from commit 6a7a9763)

Conflicts:
	src/lib/request/folderchange.php
	src/lib/request/foldersync.php
parent c92e0709
...@@ -72,6 +72,27 @@ class SyncCollections implements Iterator { ...@@ -72,6 +72,27 @@ class SyncCollections implements Iterator {
private $waitingTime = 0; private $waitingTime = 0;
/**
* Invalidates all pingable flags for all folders.
*
* @access public
* @return boolean
*/
static public function InvalidatePingableFlags() {
ZLog::Write(LOGLEVEL_DEBUG, "SyncCollections::InvalidatePingableFlags(): Invalidating now");
try {
$sc = new SyncCollections();
$sc->LoadAllCollections();
foreach ($sc as $folderid => $spa) {
$spa->DelPingableFlag();
$sc->SaveCollection($spa);
}
return true;
}
catch (ZPushException $e) {}
return false;
}
/** /**
* Constructor * Constructor
*/ */
...@@ -330,11 +351,11 @@ class SyncCollections implements Iterator { ...@@ -330,11 +351,11 @@ class SyncCollections implements Iterator {
} }
/** /**
* Returns the global window size of items to be exported in total over all * Returns the global window size of items to be exported in total over all
* requested collections. * requested collections.
* *
* @access public * @access public
* @return int/boolean returns requested windows size, 512 (max) or the * @return int/boolean returns requested windows size, 512 (max) or the
* value of config SYNC_MAX_ITEMS if it is lower * value of config SYNC_MAX_ITEMS if it is lower
*/ */
public function GetGlobalWindowSize() { public function GetGlobalWindowSize() {
...@@ -737,4 +758,4 @@ class SyncCollections implements Iterator { ...@@ -737,4 +758,4 @@ class SyncCollections implements Iterator {
} }
} }
?> ?>
\ No newline at end of file
...@@ -238,10 +238,14 @@ class FolderChange extends RequestProcessor { ...@@ -238,10 +238,14 @@ class FolderChange extends RequestProcessor {
self::$topCollector->AnnounceInformation(sprintf("Operation status %d", $status), true); self::$topCollector->AnnounceInformation(sprintf("Operation status %d", $status), true);
// Save the sync state for the next time // Save the sync state for the next time
if (isset($importer)) if (isset($importer)) {
self::$deviceManager->GetStateManager()->SetSyncState($newsynckey, $importer->GetState()); self::$deviceManager->GetStateManager()->SetSyncState($newsynckey, $importer->GetState());
// invalidate all pingable flags
SyncCollections::InvalidatePingableFlags();
}
return true; return true;
} }
} }
?> ?>
\ No newline at end of file
...@@ -249,8 +249,12 @@ class FolderSync extends RequestProcessor { ...@@ -249,8 +249,12 @@ class FolderSync extends RequestProcessor {
self::$topCollector->AnnounceInformation(sprintf("Outgoing %d folders",$changeCount), true); self::$topCollector->AnnounceInformation(sprintf("Outgoing %d folders",$changeCount), true);
// everything fine, save the sync state for the next time // everything fine, save the sync state for the next time
if ($synckey == $newsynckey) if ($synckey == $newsynckey) {
self::$deviceManager->GetStateManager()->SetSyncState($newsynckey, $newsyncstate); self::$deviceManager->GetStateManager()->SetSyncState($newsynckey, $newsyncstate);
// invalidate all pingable flags
SyncCollections::InvalidatePingableFlags();
}
} }
} }
self::$encoder->endTag(); self::$encoder->endTag();
......
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