Commit 6edac131 authored by skummer's avatar skummer

ZP-551 #comment add configuration parameter to enable/disable chunked foldersync

git-svn-id: https://z-push.org/svn/z-push/trunk@1914 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 05f39c6e
......@@ -201,6 +201,13 @@
// this full list, so this feature is disabled by default. Enable with care.
define('ALLOW_WEBSERVICE_USERS_ACCESS', false);
// Users with many folders can use the 'partial foldersync' feature, where the server
// actively stops processing the folder list if it takes too long. Other requests are
// then redirected to the FolderSync to synchronize the remaining items.
// Device compatibility for this procedure is not fully understood.
// NOTE: THIS IS AN EXPERIMENTAL FEATURE WHICH COULD PREVENT YOUR MOBILES FROM SYNCHRONIZING.
define('USE_PARTIAL_FOLDERSYNC', false);
/**********************************************************************************
* Backend settings
*/
......
......@@ -282,6 +282,10 @@ class ZPush {
else if ((!is_int(SYNC_CONTACTS_MAXPICTURESIZE) || SYNC_CONTACTS_MAXPICTURESIZE < 1))
throw new FatalMisconfigurationException("The SYNC_CONTACTS_MAXPICTURESIZE value must be a number higher than 0.");
if (!defined('USE_PARTIAL_FOLDERSYNC')) {
define('USE_PARTIAL_FOLDERSYNC', false);
}
// the check on additional folders will not throw hard errors, as this is probably changed on live systems
if (isset($additionalFolders) && !is_array($additionalFolders))
ZLog::Write(LOGLEVEL_ERROR, "ZPush::CheckConfig() : The additional folders synchronization not available as array.");
......
......@@ -199,7 +199,7 @@ class FolderSync extends RequestProcessor {
self::$topCollector->AnnounceInformation(sprintf("Exported %d from %d folders", $exported, $totalChanges));
}
// stop if this takes more than 20 seconds
if ((time() - $started) > 200) {
if (USE_PARTIAL_FOLDERSYNC && (time() - $started) > 20) {
ZLog::Write(LOGLEVEL_WARN, sprintf("Request->HandleFolderSync(): Exporting folders is too slow. In %d seconds only %d from %d changes were processed.",(time() - $started), $exported, $totalChanges));
self::$topCollector->AnnounceInformation(sprintf("Partial export of %d folders", $totalChanges), true);
self::$deviceManager->SetFolderSyncComplete(false);
......@@ -209,7 +209,7 @@ class FolderSync extends RequestProcessor {
}
// update the foldersync complete flag
if ($partial == false && self::$deviceManager->GetFolderSyncComplete() === false) {
if (USE_PARTIAL_FOLDERSYNC && $partial == false && self::$deviceManager->GetFolderSyncComplete() === false) {
// say that we are done with partial synching
self::$deviceManager->SetFolderSyncComplete(true);
// reset the loop data to prevent any loop detection to kick in now
......
......@@ -64,13 +64,15 @@ class Sync extends RequestProcessor {
// check if the hierarchySync was fully completed
if (self::$deviceManager->GetFolderSyncComplete() === false) {
ZLog::Write(LOGLEVEL_INFO, "Request->HandleSync(): Sync request aborted, as exporting of folders has not yet completed");
self::$topCollector->AnnounceInformation("Aborted due incomple folder sync", true);
$status = SYNC_STATUS_FOLDERHIERARCHYCHANGED;
if (USE_PARTIAL_FOLDERSYNC) {
if (self::$deviceManager->GetFolderSyncComplete() === false) {
ZLog::Write(LOGLEVEL_INFO, "Request->HandleSync(): Sync request aborted, as exporting of folders has not yet completed");
self::$topCollector->AnnounceInformation("Aborted due incomplete folder sync", true);
$status = SYNC_STATUS_FOLDERHIERARCHYCHANGED;
}
else
ZLog::Write(LOGLEVEL_INFO, "Request->HandleSync(): FolderSync marked as complete");
}
else
ZLog::Write(LOGLEVEL_INFO, "Request->HandleSync(): FolderSync marked as complete");
// Start Synchronize
if(self::$decoder->getElementStartTag(SYNC_SYNCHRONIZE)) {
......
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