Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
z-push
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Björn Fischer
z-push
Commits
4ad877f6
Commit
4ad877f6
authored
Nov 23, 2015
by
Manfred Kutas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZP-777 Catch and filter hierarchy events.
Released under the Affero GNU General Public License (AGPL) version 3.
parent
b8c0dbcc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
zarafa.php
src/backend/zarafa/zarafa.php
+16
-0
synccollections.php
src/lib/core/synccollections.php
+8
-3
No files found.
src/backend/zarafa/zarafa.php
View file @
4ad877f6
...
...
@@ -900,7 +900,23 @@ class BackendZarafa implements IBackend, ISearchProvider {
public
function
ChangesSink
(
$timeout
=
30
)
{
$notifications
=
array
();
$sinkresult
=
@
mapi_sink_timedwait
(
$this
->
changesSink
,
$timeout
*
1000
);
// reverse array so that the changes on folders are before changes on messages and
// it's possible to filter such notifications
$sinkresult
=
array_reverse
(
$sinkresult
,
true
);
foreach
(
$sinkresult
as
$sinknotif
)
{
// add a notification on a folder
if
(
$sinknotif
[
'objtype'
]
==
MAPI_FOLDER
)
{
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"BackendZarafa->ChangesSink() Hierarchy notification for folder %s"
,
bin2hex
(
$sinknotif
[
'entryid'
])));
$notifications
[
$sinknotif
[
'entryid'
]]
=
IBackend
::
HIERARCHYNOTIFICATION
;
}
// change on a message, remove hierarchy notification
if
(
isset
(
$sinknotif
[
'parentid'
])
&&
$sinknotif
[
'objtype'
]
==
MAPI_MESSAGE
&&
isset
(
$notifications
[
$sinknotif
[
'parentid'
]]))
{
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"BackendZarafa->ChangesSink() Remove hierarchy notification for %s because it is not relevant"
,
bin2hex
(
$sinknotif
[
'parentid'
])));
unset
(
$notifications
[
$sinknotif
[
'parentid'
]]);
}
// TODO check if adding $sinknotif['objtype'] = MAPI_MESSAGE wouldn't break anything
// check if something in the monitored folders changed
if
(
isset
(
$sinknotif
[
'parentid'
])
&&
array_key_exists
(
$sinknotif
[
'parentid'
],
$this
->
changesSinkFolders
))
{
$notifications
[]
=
$this
->
changesSinkFolders
[
$sinknotif
[
'parentid'
]];
...
...
src/lib/core/synccollections.php
View file @
4ad877f6
...
...
@@ -14,7 +14,7 @@
*
* Created : 06.01.2012
*
* Copyright 2007 - 201
3
Zarafa Deutschland GmbH
* Copyright 2007 - 201
5
Zarafa Deutschland GmbH
*
* 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,
...
...
@@ -330,11 +330,11 @@ class SyncCollections implements Iterator {
}
/**
* Returns the global window size of items to be exported in total over all
* Returns the global window size of items to be exported in total over all
* requested collections.
*
* @access public
* @return int/boolean returns requested windows size, 512 (max) or the
* @return int/boolean returns requested windows size, 512 (max) or the
* value of config SYNC_MAX_ITEMS if it is lower
*/
public
function
GetGlobalWindowSize
()
{
...
...
@@ -517,6 +517,11 @@ class SyncCollections implements Iterator {
$validNotifications
=
false
;
foreach
(
$notifications
as
$folderid
)
{
if
(
$folderid
==
IBackend
::
HIERARCHYNOTIFICATION
)
{
// TODO verify hierarchy notification by configuring an exporter with the latest changes.
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
"Found hierarchy notification."
);
continue
;
}
// check if the notification on the folder is within our filter
if
(
$this
->
CountChange
(
$folderid
))
{
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"SyncCollections->CheckForChanges(): Notification received on folder '%s'"
,
$folderid
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment