Commit 86f2306d authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #522 in ZP/z-push from bugfix/ZP-1196-warning-in-gab-sync to develop

* commit '16f16dfb':
  ZP-1196 Opening contentstable fails for hidden groups.
  ZP-1196 Catch warnings when no GAB data can be retrieved from the server.
  ZP-1196 Catch MAPI_E_INVALID_PARAMETER when a group can not be opened from the addressbook.
parents 218ea51b 16f16dfb
...@@ -345,6 +345,10 @@ class Kopano extends SyncWorker { ...@@ -345,6 +345,10 @@ class Kopano extends SyncWorker {
PR_EC_AB_HIDDEN, PR_EC_AB_HIDDEN,
PR_DISPLAY_TYPE_EX PR_DISPLAY_TYPE_EX
)); ));
if(!is_array($gabentries)) {
$this->Log("Kopano->GetGAB(): GAB data can not be retrieved.");
return $data;
}
foreach ($gabentries as $entry) { foreach ($gabentries as $entry) {
// do not add SYSTEM user to the GAB // do not add SYSTEM user to the GAB
if (strtoupper($entry[PR_DISPLAY_NAME]) == "SYSTEM") { if (strtoupper($entry[PR_DISPLAY_NAME]) == "SYSTEM") {
...@@ -372,7 +376,12 @@ class Kopano extends SyncWorker { ...@@ -372,7 +376,12 @@ class Kopano extends SyncWorker {
if (array_key_exists($entry[PR_ACCOUNT], $groups)) { if (array_key_exists($entry[PR_ACCOUNT], $groups)) {
$a->type = GABEntry::GROUP; $a->type = GABEntry::GROUP;
$groupentry = mapi_ab_openentry($addrbook, $entry[PR_ENTRYID]); $groupentry = mapi_ab_openentry($addrbook, $entry[PR_ENTRYID]);
$grouptable = mapi_folder_getcontentstable($groupentry, MAPI_DEFERRED_ERRORS); $grouptable = @mapi_folder_getcontentstable($groupentry, MAPI_DEFERRED_ERRORS);
// some groups can not be listed - ZP-1196
if (mapi_last_hresult()) {
$this->Log(sprintf("Kopano->GetGAB(): Ignoring group '%s' as members can not be listed - possibly hidden, code: 0x%08X \n", $entry[PR_ACCOUNT], mapi_last_hresult() ));
continue;
}
$users = mapi_table_queryallrows($grouptable, array(PR_ENTRYID, PR_ACCOUNT, PR_SMTP_ADDRESS)); $users = mapi_table_queryallrows($grouptable, array(PR_ENTRYID, PR_ACCOUNT, PR_SMTP_ADDRESS));
$a->members = array(); $a->members = array();
......
...@@ -128,6 +128,10 @@ abstract class SyncWorker { ...@@ -128,6 +128,10 @@ abstract class SyncWorker {
$chunks[$id][$key] = $entry; $chunks[$id][$key] = $entry;
} }
if (empty($chunks)) {
$this->Log("No data available");
return;
}
$entries = 0; $entries = 0;
$minEntries = $minSize = 99999999999; $minEntries = $minSize = 99999999999;
$maxEntries = $maxSize = 0; $maxEntries = $maxSize = 0;
......
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