Commit 27afab13 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-1169 Reinitialize ICS exporter if it was used in Ping before on

re-usage.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 122e59ad
......@@ -231,6 +231,18 @@ class ExportChangesICS implements IExportChanges{
return $ret;
}
/**
* Indicates if the exporter was configured with the BACKEND_DISCARD_DATA flag.
*
* @access public
* @return boolean
*/
public function HasDiscardDataFlag() {
if (isset($this->flags) && $this->flags & BACKEND_DISCARD_DATA) {
return true;
}
return false;
}
/**
* Reads the current state from the Exporter
......
......@@ -74,6 +74,12 @@ class KopanoChangesWrapper implements IImportChanges, IExportChanges {
* @return KopanoChangesWrapper | boolean
*/
static public function GetWrapper($storeName, $session, $store, $folderid, $ownFolder) {
// if existing exporter is used by Ping we need to discard it so it's fully reconfigured (ZP-1169)
if (isset(self::$wrappers[$storeName][$folderid]) && self::$wrappers[$storeName][$folderid]->HasDiscardDataFlag()) {
ZLog::Write(LOGLEVEL_DEBUG, "KopanoChangesWrapper::GetWrapper(): Found existing notification check exporter. Reinitializing.");
unset(self::$wrappers[$storeName][$folderid]);
}
// check early due to the folderstats
if (isset(self::$wrappers[$storeName][$folderid])) {
return self::$wrappers[$storeName][$folderid];
......@@ -151,6 +157,21 @@ class KopanoChangesWrapper implements IImportChanges, IExportChanges {
return $this->current == $this->replyback;
}
/**
* Indicates if the current IChanges object is an ICS exporter and has the BACKEND_DISCARD_DATA flag configured.
* These are used to verify notifications e.g. in Ping.
*
* @access private
* @return boolean
*/
private function HasDiscardDataFlag() {
if (isset($this->current) && $this->current instanceof ExportChangesICS && $this->current->HasDiscardDataFlag()) {
return true;
}
return false;
}
/**
* Initializes the correct importer, exporter or ReplyBackImExporter.
* The wrapper needs to be prepared as importer or exporter before.
......
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