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 {
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
*/
......
......@@ -238,9 +238,13 @@ class FolderChange extends RequestProcessor {
self::$topCollector->AnnounceInformation(sprintf("Operation status %d", $status), true);
// Save the sync state for the next time
if (isset($importer))
if (isset($importer)) {
self::$deviceManager->GetStateManager()->SetSyncState($newsynckey, $importer->GetState());
// invalidate all pingable flags
SyncCollections::InvalidatePingableFlags();
}
return true;
}
}
......
......@@ -249,8 +249,12 @@ class FolderSync extends RequestProcessor {
self::$topCollector->AnnounceInformation(sprintf("Outgoing %d folders",$changeCount), true);
// everything fine, save the sync state for the next time
if ($synckey == $newsynckey)
if ($synckey == $newsynckey) {
self::$deviceManager->GetStateManager()->SetSyncState($newsynckey, $newsyncstate);
// invalidate all pingable flags
SyncCollections::InvalidatePingableFlags();
}
}
}
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