Commit 5e4f5075 authored by Sebastian Kummer's avatar Sebastian Kummer

Merging in latest from upstream (ZP/z-push:refs/heads/develop)

* commit '3b7ea727':
  ZP-865 Update year.
  ZP-846 Update year.
  ZP-846 If folderdata is found also check if the synckey corresponds to the latest hierarchy synckey and update it if not.
  ZP-865 Abort conflict detection if there are more 100 changes to be exported.
  ZP-864 Do not convert UTF-8 only encoding. Updated copyright dates for changed files.
  ZP-864 Do not convert if charset encoding is already UTF-8.
parents cb0793aa 3b7ea727
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* Created : 14.02.2011 * Created : 14.02.2011
* *
* Copyright 2007 - 2015 Zarafa Deutschland GmbH * Copyright 2007 - 2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
...@@ -309,6 +309,11 @@ class ImportChangesICS implements IImportChanges { ...@@ -309,6 +309,11 @@ class ImportChangesICS implements IImportChanges {
// monitor how long it takes to export potential conflicts // monitor how long it takes to export potential conflicts
// if this takes "too long" we cancel this operation! // if this takes "too long" we cancel this operation!
$potConflicts = $exporter->GetChangeCount(); $potConflicts = $exporter->GetChangeCount();
if ($potConflicts > 100) {
ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->lazyLoadConflicts(): conflict detection abandoned as there are too many (%d) changes to be exported.", $potConflicts));
$this->conflictsLoaded = true;
return;
}
$started = time(); $started = time();
$exported = 0; $exported = 0;
try { try {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* Created : 01.10.2007 * Created : 01.10.2007
* *
* Copyright 2007 - 2013 Zarafa Deutschland GmbH * Copyright 2007 - 2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
...@@ -267,7 +267,7 @@ class Request { ...@@ -267,7 +267,7 @@ class Request {
ZLog::Write(LOGLEVEL_ERROR, "Request->ProcessHeaders(): mb_detect_encoding failed to detect the Authorization header charset. It's possible that user won't be able to login."); ZLog::Write(LOGLEVEL_ERROR, "Request->ProcessHeaders(): mb_detect_encoding failed to detect the Authorization header charset. It's possible that user won't be able to login.");
} }
} }
if ($encoding) { if ($encoding && strtolower($encoding) != "utf-8") {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Request->ProcessHeaders(): mb_detect_encoding detected '%s' charset. Authorization header will be converted to UTF-8 from it.", $encoding)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("Request->ProcessHeaders(): mb_detect_encoding detected '%s' charset. Authorization header will be converted to UTF-8 from it.", $encoding));
self::$authUser = mb_convert_encoding(self::$authUser, "UTF-8", $encoding); self::$authUser = mb_convert_encoding(self::$authUser, "UTF-8", $encoding);
self::$authPassword = mb_convert_encoding(self::$authPassword, "UTF-8", $encoding); self::$authPassword = mb_convert_encoding(self::$authPassword, "UTF-8", $encoding);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Created : 03.04.2008 * Created : 03.04.2008
* *
* Copyright 2007 - 2013 Zarafa Deutschland GmbH * Copyright 2007 - 2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Created : 23.12.2011 * Created : 23.12.2011
* *
* Copyright 2007 - 2015 Zarafa Deutschland GmbH * Copyright 2007 - 2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
...@@ -864,13 +864,17 @@ class ZPushAdmin { ...@@ -864,13 +864,17 @@ class ZPushAdmin {
continue; continue;
} }
$seen++; $seen++;
$needsFixing = false;
$spa = false;
// try getting the FOLDERDATA for that state // try getting the FOLDERDATA for that state
try { try {
$data = ZPush::GetStateMachine()->GetState($device->GetDeviceId(), IStateMachine::FOLDERDATA, $hierarchyUuid); $spa = ZPush::GetStateMachine()->GetState($device->GetDeviceId(), IStateMachine::FOLDERDATA, $hierarchyUuid);
} }
catch(StateNotFoundException $snfe) { catch(StateNotFoundException $snfe) {
// No FD found, search all states, and find the highest counter for the hierarchy UUID $needsFixing = true;
}
// Search all states, and find the highest counter for the hierarchy UUID
$allStates = ZPush::GetStateMachine()->GetAllStatesForDevice($devid); $allStates = ZPush::GetStateMachine()->GetAllStatesForDevice($devid);
$maxCounter = 1; $maxCounter = 1;
foreach ($allStates as $state) { foreach ($allStates as $state) {
...@@ -878,10 +882,20 @@ class ZPushAdmin { ...@@ -878,10 +882,20 @@ class ZPushAdmin {
$maxCounter = $state['counter']; $maxCounter = $state['counter'];
} }
} }
$hierarchySyncKey = StateManager::BuildStateKey($hierarchyUuid, $maxCounter);
// generate FOLDERDATA if ($spa) {
if ($spa->GetSyncKey() !== $hierarchySyncKey) {
$needsFixing = true;
}
}
else {
$spa = new SyncParameters(); $spa = new SyncParameters();
$spa->SetSyncKey(StateManager::BuildStateKey($hierarchyUuid, $maxCounter)); }
if ($needsFixing) {
// generate FOLDERDATA
$spa->SetSyncKey($hierarchySyncKey);
$spa->SetFolderId(false); $spa->SetFolderId(false);
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPushAdmin::FixStatesHierarchyFolderData(): write data for %s", $spa->GetSyncKey())); ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPushAdmin::FixStatesHierarchyFolderData(): write data for %s", $spa->GetSyncKey()));
ZPush::GetStateMachine()->SetState($spa, $device->GetDeviceId(), IStateMachine::FOLDERDATA, $hierarchyUuid); ZPush::GetStateMachine()->SetState($spa, $device->GetDeviceId(), IStateMachine::FOLDERDATA, $hierarchyUuid);
......
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