Commit fb649b4c authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-922 Try to determine folderid only if it's set, put newly generated

folderid hashes in the cache for this request only, log warning if we
reach end of method without result, make "if" clearer with additional
parenthesis.

Released under the Affero GNU General Public License (AGPL) version 3.
parent ed03030e
......@@ -80,11 +80,13 @@ class PHPWrapper {
$this->mapiprovider = new MAPIProvider($session, $this->store);
$this->folderid = $folderid;
$folderidHex = bin2hex($folderid);
$this->prefix = '';
$folderid = ZPush::GetDeviceManager()->GetFolderIdForBackendId($folderidHex);
if ($folderid != $folderidHex) {
$this->prefix = $folderid . ':';
if ($folderid) {
$folderidHex = bin2hex($folderid);
$this->prefix = '';
$folderid = ZPush::GetDeviceManager()->GetFolderIdForBackendId($folderidHex);
if ($folderid != $folderidHex) {
$this->prefix = $folderid . ':';
}
}
// TODO remove this log output in 2.3.X
ZLog::Write(LOGLEVEL_DEBUG, sprintf("PHPWrapper: prefix:'%s'", $this->prefix));
......
......@@ -707,8 +707,11 @@ class ASDevice extends StateObject {
}
$newHash = $this->generateFolderHash($backendid, $folderOrigin, $folderName);
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ASDevice->GetFolderIdForBackendId(): generated new folderid '%s' for backend-folderid '%s'", $newHash, $backendid));
// temporarily save the new hash also in the cache (new folders will only be saved at the end of request and could be requested before that
$this->backend2folderidCache[$backendid] = $newHash;
return $newHash;
}
ZLog::Write(LOGLEVEL_WARN, sprintf("ASDevice->GetFolderIdForBackendId(): no valid condition found for determining folderid for backendid '%s'. Returning as is!", Utils::PrintAsString($backendid)));
return $backendid;
}
......
......@@ -258,7 +258,7 @@ class ChangesMemoryWrapper extends HierarchyCache implements IImportChanges, IEx
}
// check if the parent ID is known on the device
if (!isset($folder->parentid) || $folder->parentid != "0" && !$this->GetFolder($folder->parentid)) {
if (!isset($folder->parentid) || ($folder->parentid != "0" && !$this->GetFolder($folder->parentid))) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ChangesMemoryWrapper->ImportFolderChange(): Change for folder '%s' will not be sent as parent folder is not set or not known on mobile.", $folder->displayname));
return false;
}
......
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