@@ -510,10 +510,25 @@ class BackendZarafa implements IBackend, ISearchProvider {
...
@@ -510,10 +510,25 @@ class BackendZarafa implements IBackend, ISearchProvider {
if(!isset($fwmessage)||!$fwmessage)
if(!isset($fwmessage)||!$fwmessage)
thrownewStatusException(sprintf("ZarafaBackend->SendMail(): Could not open message id '%s' in folder id '%s' to be replied/forwarded: 0x%X",$sm->source->itemid,$sm->source->folderid,mapi_last_hresult()),SYNC_COMMONSTATUS_ITEMNOTFOUND);
thrownewStatusException(sprintf("ZarafaBackend->SendMail(): Could not open message id '%s' in folder id '%s' to be replied/forwarded: 0x%X",$sm->source->itemid,$sm->source->folderid,mapi_last_hresult()),SYNC_COMMONSTATUS_ITEMNOTFOUND);
//update icon when forwarding or replying message
// update icon and last_verb when forwarding or replying message
thrownewStatusException(sprintf("ZarafaBackend->GetAttachmentData('%s'): Error, unable to open item for attachment data for id '%s' with: 0x%X",$attname,$id,mapi_last_hresult()),SYNC_ITEMOPERATIONSSTATUS_INVALIDATT);
thrownewStatusException(sprintf("ZarafaBackend->GetAttachmentData('%s'): Error, unable to open item for attachment data for id '%s' with: 0x%X",$attname,$id,mapi_last_hresult()),SYNC_ITEMOPERATIONSSTATUS_INVALIDATT);
thrownewStatusException(sprintf("ZarafaBackend->GetAttachmentData('%s'): Error, unable to open attachment number '%s' with: 0x%X",$attname,$attachnum,mapi_last_hresult()),SYNC_ITEMOPERATIONSSTATUS_INVALIDATT);
thrownewStatusException(sprintf("ZarafaBackend->GetAttachmentData('%s'): Error, unable to open attachment number '%s' with: 0x%X",$attname,$attachnum,mapi_last_hresult()),SYNC_ITEMOPERATIONSSTATUS_INVALIDATT);
...
@@ -1128,6 +1147,11 @@ class BackendZarafa implements IBackend, ISearchProvider {
...
@@ -1128,6 +1147,11 @@ class BackendZarafa implements IBackend, ISearchProvider {
*/
*/
publicfunctionTerminateSearch($pid){
publicfunctionTerminateSearch($pid){
ZLog::Write(LOGLEVEL_DEBUG,sprintf("ZarafaBackend->TerminateSearch(): terminating search for pid %d",$pid));
ZLog::Write(LOGLEVEL_DEBUG,sprintf("ZarafaBackend->TerminateSearch(): terminating search for pid %d",$pid));
if(!isset($this->store)||$this->store===false){
ZLog::Write(LOGLEVEL_WARN,sprintf("The store is not available. It is not possible to remove search folder with pid %d",$pid));
ZLog::Write(LOGLEVEL_DEBUG,sprintf("DeviceManager->GetWindowSize() overwriting max items requested of %d by %d forced in configuration.",$items,SYNC_MAX_ITEMS));
@@ -563,15 +572,23 @@ class LoopDetection extends InterProcessData {
...
@@ -563,15 +572,23 @@ class LoopDetection extends InterProcessData {
$obsolete=true;
$obsolete=true;
}
}
else{
else{
ZLog::Write(LOGLEVEL_DEBUG,sprintf("LoopDetection->IsSyncStateObsolete(): check uuid counter: %d - last known counter: %d with %d queued objects",$counter,$current["count"],$current["queued"]));
ZLog::Write(LOGLEVEL_DEBUG,sprintf("LoopDetection->IsSyncStateObsolete(): check folderid: '%s' uuid '%s' counter: %d - last counter: %d with %d queued",
ZLog::Write(LOGLEVEL_DEBUG,sprintf("LoopDetection->IsSyncStateObsolete(): check folderid: '%s' uuid '%s' counter: %d - no data found: not obsolete",$folderid,$uuid,$counter));
}
}
}
return$obsolete;
return$obsolete;
...
@@ -609,6 +626,7 @@ class LoopDetection extends InterProcessData {
...
@@ -609,6 +626,7 @@ class LoopDetection extends InterProcessData {
* @return boolean when returning true if a loop has been identified
* @return boolean when returning true if a loop has been identified
ZLog::Write(LOGLEVEL_DEBUG,sprintf("SyncCollections->GetGlobalWindowSize() overwriting requested global window size of %d by %d forced in configuration.",$globalWindowSize,SYNC_MAX_ITEMS));
$globalWindowSize=SYNC_MAX_ITEMS;
}
return$this->globalWindowSize;
return$globalWindowSize;
}
}
/**
/**
...
@@ -506,19 +517,15 @@ class SyncCollections implements Iterator {
...
@@ -506,19 +517,15 @@ class SyncCollections implements Iterator {
$validNotifications=false;
$validNotifications=false;
foreach($notificationsas$folderid){
foreach($notificationsas$folderid){
// ZP-631 - temporary disable checking validity of notifications
// check if the notification on the folder is within our filter
// notify mobile for all received notifications
if($this->CountChange($folderid)){
$this->changes[$folderid]=1;
ZLog::Write(LOGLEVEL_DEBUG,sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s'",$folderid));
$validNotifications=true;
$validNotifications=true;
// // check if the notification on the folder is within our filter
$this->waitingTime=time()-$started;
// if ($this->CountChange($folderid)) {
}
// ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s'", $folderid));
else{
// $validNotifications = true;
ZLog::Write(LOGLEVEL_DEBUG,sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s', but it is not relevant",$folderid));
// $this->waitingTime = time()-$started;
}
// }
// else {
// ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s', but it is not relevant", $folderid));
// }
}
}
if($validNotifications)
if($validNotifications)
returntrue;
returntrue;
...
@@ -576,6 +583,13 @@ class SyncCollections implements Iterator {
...
@@ -576,6 +583,13 @@ class SyncCollections implements Iterator {
privatefunctionCountChange($folderid){
privatefunctionCountChange($folderid){
$spa=$this->GetCollection($folderid);
$spa=$this->GetCollection($folderid);
// prevent ZP-623 by checking if the states have been used before, if so force a sync on this folder
@@ -61,7 +61,8 @@ class GetAttachment extends RequestProcessor {
...
@@ -61,7 +61,8 @@ class GetAttachment extends RequestProcessor {
$stream=$attachment->data;
$stream=$attachment->data;
ZLog::Write(LOGLEVEL_DEBUG,sprintf("HandleGetAttachment(): attachment stream from backend: %s",$stream));
ZLog::Write(LOGLEVEL_DEBUG,sprintf("HandleGetAttachment(): attachment stream from backend: %s",$stream));
if($stream==null)
// need to check for a resource here, as eg. feof('Error') === false and causing infinit loop in while!
if(!is_resource($stream))
thrownewStatusException(sprintf("HandleGetAttachment(): No stream resource returned by backend for attachment: %s",$attname),SYNC_ITEMOPERATIONSSTATUS_INVALIDATT);
thrownewStatusException(sprintf("HandleGetAttachment(): No stream resource returned by backend for attachment: %s",$attname),SYNC_ITEMOPERATIONSSTATUS_INVALIDATT);
ZLog::Write(LOGLEVEL_INFO,sprintf("WebserviceDevice::ResyncFolder('%s','%s'): mark folder of a device of user '%s' for resynchronization",$deviceId,$folderId,Request::GetGETUser()));
echo"Are you sure you want to re-synchronize the hierarchy of all devices and users [y/N]: ";
$confirm=strtolower(trim(fgets(STDIN)));
if(!($confirm==='y'||$confirm==='yes')){
echo"Aborted!\n";
exit(1);
}
}
self::CommandResyncHierarchy();
break;
caseself::COMMAND_CLEARLOOP:
caseself::COMMAND_CLEARLOOP:
self::CommandClearLoopDetectionData();
self::CommandClearLoopDetectionData();
break;
break;
...
@@ -588,6 +607,36 @@ class ZPushAdminCLI {
...
@@ -588,6 +607,36 @@ class ZPushAdminCLI {
}
}
/**
* Command "Resync hierarchy"
* Resyncs a folder type of a specific device/user or of all users
*
* @return
* @access public
*/
staticpublicfunctionCommandResyncHierarchy(){
// if no device is specified, search for all devices of a user. If user is not set, all devices are returned.
if(self::$device===false){
$devicelist=ZPushAdmin::ListDevices(self::$user);
if(empty($devicelist)){
echo"\tno devices/users found\n";
returntrue;
}
}
else
$devicelist=array(self::$device);
foreach($devicelistas$deviceId){
$users=ZPushAdmin::ListUsers($deviceId);
foreach($usersas$user){
if(self::$user&&self::$user!=$user)
continue;
self::resyncHierarchy($deviceId,$user);
}
}
}
/**
/**
* Command to clear the loop detection data
* Command to clear the loop detection data
* Mobiles may enter loop detection (one-by-one synchring due to timeouts / erros).
* Mobiles may enter loop detection (one-by-one synchring due to timeouts / erros).
...
@@ -670,6 +719,20 @@ class ZPushAdminCLI {
...
@@ -670,6 +719,20 @@ class ZPushAdminCLI {
echosprintf("Resync of %d folders of type %s on device '%s' of user '%s': %s\n",count($folders),$type,$deviceId,$user,($stat)?'Requested':ZLog::GetLastMessage(LOGLEVEL_ERROR));
echosprintf("Resync of %d folders of type %s on device '%s' of user '%s': %s\n",count($folders),$type,$deviceId,$user,($stat)?'Requested':ZLog::GetLastMessage(LOGLEVEL_ERROR));
echosprintf("Removing hierarchy information for resync on device '%s' of user '%s': %s\n",$deviceId,$user,($stat)?'Requested':ZLog::GetLastMessage(LOGLEVEL_ERROR));