Commit 6a7a9763 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.
parents 6467068d d8718bdc
...@@ -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() {
......
...@@ -247,6 +247,9 @@ class FolderChange extends RequestProcessor { ...@@ -247,6 +247,9 @@ class FolderChange extends RequestProcessor {
// update SPA & save it // update SPA & save it
$spa->SetSyncKey($newsynckey); $spa->SetSyncKey($newsynckey);
self::$deviceManager->GetStateManager()->SetSynchedFolderState($spa); self::$deviceManager->GetStateManager()->SetSynchedFolderState($spa);
// invalidate all pingable flags
SyncCollections::InvalidatePingableFlags();
} }
return true; return true;
......
...@@ -259,6 +259,9 @@ class FolderSync extends RequestProcessor { ...@@ -259,6 +259,9 @@ class FolderSync extends RequestProcessor {
// update SPA & save it // update SPA & save it
$spa->SetSyncKey($newsynckey); $spa->SetSyncKey($newsynckey);
self::$deviceManager->GetStateManager()->SetSynchedFolderState($spa); self::$deviceManager->GetStateManager()->SetSynchedFolderState($spa);
// invalidate all pingable flags
SyncCollections::InvalidatePingableFlags();
} }
} }
} }
......
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