Commit b4254fe9 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-556 undo debug config changes, renamed ZarafaChangesWrapper into

KopanoChangesWrapper, removed debug output.

Released under the Affero GNU General Public License (AGPL) version 3.
parent f692884c
<?php <?php
/*********************************************** /***********************************************
* File : zarafachangeswrapper.php * File : kopanochangeswrapper.php
* Project : Z-Push * Project : Z-Push
* Descr : This class fullfills the IImportChanges * Descr : This class fullfills the IImportChanges
* and IExportChanges interfaces. * and IExportChanges interfaces.
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
* Consult LICENSE file for details * Consult LICENSE file for details
************************************************/ ************************************************/
class ZarafaChangesWrapper implements IImportChanges, IExportChanges { class KopanoChangesWrapper implements IImportChanges, IExportChanges {
const IMPORTER = 1; const IMPORTER = 1;
const EXPORTER = 2; const EXPORTER = 2;
...@@ -89,7 +89,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges { ...@@ -89,7 +89,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges {
* @param boolean $ownFolder * @param boolean $ownFolder
* *
* @access public * @access public
* @return ZarafaChangesWrapper | boolean * @return KopanoChangesWrapper | boolean
*/ */
static public function GetWrapper($storeName, $session, $store, $folderid, $ownFolder) { static public function GetWrapper($storeName, $session, $store, $folderid, $ownFolder) {
// check early due to the folderstats // check early due to the folderstats
...@@ -102,7 +102,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges { ...@@ -102,7 +102,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges {
} }
if (!isset(self::$wrappers[$storeName][$folderid]) && $session) { if (!isset(self::$wrappers[$storeName][$folderid]) && $session) {
self::$wrappers[$storeName][$folderid] = new ZarafaChangesWrapper($session, $store, $folderid, $ownFolder); self::$wrappers[$storeName][$folderid] = new KopanoChangesWrapper($session, $store, $folderid, $ownFolder);
} }
else { else {
return false; return false;
...@@ -122,7 +122,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges { ...@@ -122,7 +122,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges {
* @access public * @access public
* @throws StatusException * @throws StatusException
*/ */
public function ZarafaChangesWrapper($session, $store, $folderid, $ownFolder) { public function KopanoChangesWrapper($session, $store, $folderid, $ownFolder) {
$this->preparedAs = null; $this->preparedAs = null;
$this->session = $session; $this->session = $session;
$this->store = $store; $this->store = $store;
...@@ -140,7 +140,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges { ...@@ -140,7 +140,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges {
/** /**
* Indicates if the wrapper is requested to be an exporter or an importer. * Indicates if the wrapper is requested to be an exporter or an importer.
* *
* @param int $type either ZarafaChangesWrapper::IMPORTER or ZarafaChangesWrapper::EXPORTER * @param int $type either KopanoChangesWrapper::IMPORTER or KopanoChangesWrapper::EXPORTER
* *
* @access public * @access public
* @return void * @return void
...@@ -183,12 +183,12 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges { ...@@ -183,12 +183,12 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges {
if (!($this->current instanceof ImportChangesICS)) { if (!($this->current instanceof ImportChangesICS)) {
// check if the user has permissions to import to this folderid // check if the user has permissions to import to this folderid
if (!$this->ownFolder && !self::$backend->HasSecretaryACLs($this->store, $this->folderid)) { if (!$this->ownFolder && !self::$backend->HasSecretaryACLs($this->store, $this->folderid)) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaChangesWrapper->init(): Importer: missing permissions on folderid: '%s'. Working with ReplyBackImExporter.", Utils::PrintAsString($this->folderid))); ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoChangesWrapper->init(): Importer: missing permissions on folderid: '%s'. Working with ReplyBackImExporter.", Utils::PrintAsString($this->folderid)));
$this->replyback = $this->getReplyBackImExporter(); $this->replyback = $this->getReplyBackImExporter();
$this->current = $this->replyback; $this->current = $this->replyback;
} }
else if (!empty($this->moveSrcState)) { else if (!empty($this->moveSrcState)) {
ZLog::Write(LOGLEVEL_DEBUG, "ZarafaChangesWrapper->init(): Importer: Move state available. Working with ReplyBackImExporter."); ZLog::Write(LOGLEVEL_DEBUG, "KopanoChangesWrapper->init(): Importer: Move state available. Working with ReplyBackImExporter.");
$this->replyback = $this->getReplyBackImExporter(); $this->replyback = $this->getReplyBackImExporter();
$this->current = $this->replyback; $this->current = $this->replyback;
} }
...@@ -202,7 +202,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges { ...@@ -202,7 +202,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges {
if (!($this->current instanceof ExportChangesICS)) { if (!($this->current instanceof ExportChangesICS)) {
// if there was something imported on a read-only folder, we need to reply back the changes // if there was something imported on a read-only folder, we need to reply back the changes
if ($this->replyback || !empty($this->state->GetReplyBackState()) || !empty($this->moveSrcState)) { if ($this->replyback || !empty($this->state->GetReplyBackState()) || !empty($this->moveSrcState)) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaChangesWrapper->init(): Exporter: read-only folder with folderid: '%s'. Working with ReplyBackImExporter.", Utils::PrintAsString($this->folderid))); ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoChangesWrapper->init(): Exporter: read-only folder with folderid: '%s'. Working with ReplyBackImExporter.", Utils::PrintAsString($this->folderid)));
if (!$this->replyback) { if (!$this->replyback) {
$this->replyback = $this->getReplyBackImExporter(); $this->replyback = $this->getReplyBackImExporter();
} }
...@@ -211,14 +211,14 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges { ...@@ -211,14 +211,14 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges {
else { else {
// check if the user has permissions to export from this folderid // check if the user has permissions to export from this folderid
if (!$this->ownFolder && !self::$backend->HasReadACLs($this->store, $this->folderid)) { if (!$this->ownFolder && !self::$backend->HasReadACLs($this->store, $this->folderid)) {
throw new StatusException(sprintf("ZarafaChangesWrapper->init(): Exporter: missing read permissions on folderid: '%s'.", Utils::PrintAsString($this->folderid)), SYNC_STATUS_FOLDERHIERARCHYCHANGED); throw new StatusException(sprintf("KopanoChangesWrapper->init(): Exporter: missing read permissions on folderid: '%s'.", Utils::PrintAsString($this->folderid)), SYNC_STATUS_FOLDERHIERARCHYCHANGED);
} }
$this->current = new ExportChangesICS($this->session, $this->store, hex2bin($this->folderid)); $this->current = new ExportChangesICS($this->session, $this->store, hex2bin($this->folderid));
} }
} }
} }
else { else {
throw new FatalNotImplementedException("ZarafaChangesWrapper->init(): ZarafaChangesWrapper was not prepared as importer or exporter."); throw new FatalNotImplementedException("KopanoChangesWrapper->init(): KopanoChangesWrapper was not prepared as importer or exporter.");
} }
} }
...@@ -397,7 +397,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges { ...@@ -397,7 +397,7 @@ class ZarafaChangesWrapper implements IImportChanges, IExportChanges {
// Now the $newfolder could be read only as well. So we need to check it's permissions and then switch to a ReplyBackImExporter if its r/o. // Now the $newfolder could be read only as well. So we need to check it's permissions and then switch to a ReplyBackImExporter if its r/o.
if (!$this->isReplyBackExporter()) { if (!$this->isReplyBackExporter()) {
if (!self::$backend->HasSecretaryACLs($this->store, $newfolder)) { if (!self::$backend->HasSecretaryACLs($this->store, $newfolder)) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaChangesWrapper->ImportMessageMove(): destination folderid '%s' is missing permissions. Switching to ReplyBackImExporter.", Utils::PrintAsString($newfolder))); ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoChangesWrapper->ImportMessageMove(): destination folderid '%s' is missing permissions. Switching to ReplyBackImExporter.", Utils::PrintAsString($newfolder)));
$this->replyback = $this->getReplyBackImExporter(); $this->replyback = $this->getReplyBackImExporter();
$this->current = $this->replyback; $this->current = $this->replyback;
......
...@@ -132,9 +132,7 @@ class ReplyBackImExporter implements IImportChanges, IExportChanges { ...@@ -132,9 +132,7 @@ class ReplyBackImExporter implements IImportChanges, IExportChanges {
public function GetState() { public function GetState() {
// we can discard all entries in the $changes array up to $step // we can discard all entries in the $changes array up to $step
$changes = array_slice($this->changes, $this->step); $changes = array_slice($this->changes, $this->step);
$out = array_merge($changes, $this->changesNext); return array_merge($changes, $this->changesNext);
ZLog::Write(LOGLEVEL_DEBUG, "------- ReplyBack getstate:".print_r($out,1));
return $out;
} }
/** /**
......
...@@ -104,7 +104,7 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -104,7 +104,7 @@ class BackendZarafa implements IBackend, ISearchProvider {
$this->folderStatCache = array(); $this->folderStatCache = array();
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendZarafa using PHP-MAPI version: %s - PHP version: %s", phpversion("mapi"), phpversion())); ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendZarafa using PHP-MAPI version: %s - PHP version: %s", phpversion("mapi"), phpversion()));
ZarafaChangesWrapper::SetBackend($this); KopanoChangesWrapper::SetBackend($this);
} }
/** /**
...@@ -372,8 +372,8 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -372,8 +372,8 @@ class BackendZarafa implements IBackend, ISearchProvider {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendZarafa->GetImporter() folderid: '%s'", Utils::PrintAsString($folderid))); ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendZarafa->GetImporter() folderid: '%s'", Utils::PrintAsString($folderid)));
if($folderid !== false) { if($folderid !== false) {
$this->importedFolders[$folderid] = $this->store; $this->importedFolders[$folderid] = $this->store;
$wrapper = ZarafaChangesWrapper::GetWrapper($this->storeName, $this->session, $this->store, $folderid, $this->storeName == $this->mainUser); $wrapper = KopanoChangesWrapper::GetWrapper($this->storeName, $this->session, $this->store, $folderid, $this->storeName == $this->mainUser);
$wrapper->Prepare(ZarafaChangesWrapper::IMPORTER); $wrapper->Prepare(KopanoChangesWrapper::IMPORTER);
return $wrapper; return $wrapper;
} }
else else
...@@ -392,8 +392,8 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -392,8 +392,8 @@ class BackendZarafa implements IBackend, ISearchProvider {
*/ */
public function GetExporter($folderid = false) { public function GetExporter($folderid = false) {
if($folderid !== false) { if($folderid !== false) {
$wrapper = ZarafaChangesWrapper::GetWrapper($this->storeName, $this->session, $this->store, $folderid, $this->storeName == $this->mainUser); $wrapper = KopanoChangesWrapper::GetWrapper($this->storeName, $this->session, $this->store, $folderid, $this->storeName == $this->mainUser);
$wrapper->Prepare(ZarafaChangesWrapper::EXPORTER); $wrapper->Prepare(KopanoChangesWrapper::EXPORTER);
return $wrapper; return $wrapper;
} }
else else
...@@ -1351,7 +1351,7 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -1351,7 +1351,7 @@ class BackendZarafa implements IBackend, ISearchProvider {
} }
// if there is a ReplyBackImExporter, the exporter needs to run! // if there is a ReplyBackImExporter, the exporter needs to run!
$wrapper = ZarafaChangesWrapper::GetWrapper($user, false, null, $folderid, null); $wrapper = KopanoChangesWrapper::GetWrapper($user, false, null, $folderid, null);
if ($wrapper && $wrapper->HasReplyBackExporter()) { if ($wrapper && $wrapper->HasReplyBackExporter()) {
return "replyback-". time(); return "replyback-". time();
} }
......
...@@ -330,20 +330,13 @@ ...@@ -330,20 +330,13 @@
$additionalFolders = array( $additionalFolders = array(
// demo entry for the synchronization of contacts from the public folder. // demo entry for the synchronization of contacts from the public folder.
// uncomment (remove '/*' '*/') and fill in the folderid // uncomment (remove '/*' '*/') and fill in the folderid
/*
array(
'store' => "SYSTEM",
'folderid' => "5a37a3f4faa340e49f5c0dc09cf6cb040e2900000000",
'name' => "Public Contacts",
'type' => SYNC_FOLDER_TYPE_USER_CONTACT,
'readonly' => true,
),
array( array(
'store' => "SYSTEM", 'store' => "SYSTEM",
'folderid' => "5a37a3f4faa340e49f5c0dc09cf6cb04a02a00000000", 'folderid' => "",
'name' => "Public EMAIL", 'name' => "Public Contacts",
'type' => SYNC_FOLDER_TYPE_USER_MAIL, 'type' => SYNC_FOLDER_TYPE_USER_CONTACT,
'readonly' => true, 'readonly' => false,
), ),
*/
); );
...@@ -63,6 +63,7 @@ return array( ...@@ -63,6 +63,7 @@ return array(
'IpcMemcachedProvider' => $baseDir . '/backend/ipcmemcached/ipcmemcachedprovider.php', 'IpcMemcachedProvider' => $baseDir . '/backend/ipcmemcached/ipcmemcachedprovider.php',
'IpcSharedMemoryProvider' => $baseDir . '/backend/ipcsharedmemory/ipcsharedmemoryprovider.php', 'IpcSharedMemoryProvider' => $baseDir . '/backend/ipcsharedmemory/ipcsharedmemoryprovider.php',
'ItemOperations' => $baseDir . '/lib/request/itemoperations.php', 'ItemOperations' => $baseDir . '/lib/request/itemoperations.php',
'KopanoChangesWrapper' => $baseDir . '/backend/zarafa/kopanochangeswrapper.php',
'Log' => $baseDir . '/lib/log/log.php', 'Log' => $baseDir . '/lib/log/log.php',
'LoopDetection' => $baseDir . '/lib/core/loopdetection.php', 'LoopDetection' => $baseDir . '/lib/core/loopdetection.php',
'MAPIException' => $baseDir . '/backend/zarafa/mapi/class.mapiexception.php', 'MAPIException' => $baseDir . '/backend/zarafa/mapi/class.mapiexception.php',
...@@ -164,7 +165,6 @@ return array( ...@@ -164,7 +165,6 @@ return array(
'ZPushAdmin' => $baseDir . '/lib/utils/zpushadmin.php', 'ZPushAdmin' => $baseDir . '/lib/utils/zpushadmin.php',
'ZPushAutodiscover' => $baseDir . '/autodiscover/autodiscover.php', 'ZPushAutodiscover' => $baseDir . '/autodiscover/autodiscover.php',
'ZPushException' => $baseDir . '/lib/exceptions/zpushexception.php', 'ZPushException' => $baseDir . '/lib/exceptions/zpushexception.php',
'ZarafaChangesWrapper' => $baseDir . '/backend/zarafa/zarafachangeswrapper.php',
'carddav_backend' => $baseDir . '/include/z_carddav.php', 'carddav_backend' => $baseDir . '/include/z_carddav.php',
'iCalComponent' => $baseDir . '/include/iCalendar.php', 'iCalComponent' => $baseDir . '/include/iCalendar.php',
'iCalProp' => $baseDir . '/include/iCalendar.php', 'iCalProp' => $baseDir . '/include/iCalendar.php',
......
...@@ -70,6 +70,7 @@ class ComposerStaticInitd6749fc2fb9944bbe86b2b7d79a7852f ...@@ -70,6 +70,7 @@ class ComposerStaticInitd6749fc2fb9944bbe86b2b7d79a7852f
'IpcMemcachedProvider' => __DIR__ . '/../..' . '/backend/ipcmemcached/ipcmemcachedprovider.php', 'IpcMemcachedProvider' => __DIR__ . '/../..' . '/backend/ipcmemcached/ipcmemcachedprovider.php',
'IpcSharedMemoryProvider' => __DIR__ . '/../..' . '/backend/ipcsharedmemory/ipcsharedmemoryprovider.php', 'IpcSharedMemoryProvider' => __DIR__ . '/../..' . '/backend/ipcsharedmemory/ipcsharedmemoryprovider.php',
'ItemOperations' => __DIR__ . '/../..' . '/lib/request/itemoperations.php', 'ItemOperations' => __DIR__ . '/../..' . '/lib/request/itemoperations.php',
'KopanoChangesWrapper' => __DIR__ . '/../..' . '/backend/zarafa/kopanochangeswrapper.php',
'Log' => __DIR__ . '/../..' . '/lib/log/log.php', 'Log' => __DIR__ . '/../..' . '/lib/log/log.php',
'LoopDetection' => __DIR__ . '/../..' . '/lib/core/loopdetection.php', 'LoopDetection' => __DIR__ . '/../..' . '/lib/core/loopdetection.php',
'MAPIException' => __DIR__ . '/../..' . '/backend/zarafa/mapi/class.mapiexception.php', 'MAPIException' => __DIR__ . '/../..' . '/backend/zarafa/mapi/class.mapiexception.php',
...@@ -93,6 +94,8 @@ class ComposerStaticInitd6749fc2fb9944bbe86b2b7d79a7852f ...@@ -93,6 +94,8 @@ class ComposerStaticInitd6749fc2fb9944bbe86b2b7d79a7852f
'ProvisioningRequiredException' => __DIR__ . '/../..' . '/lib/exceptions/provisioningrequiredexception.php', 'ProvisioningRequiredException' => __DIR__ . '/../..' . '/lib/exceptions/provisioningrequiredexception.php',
'Recurrence' => __DIR__ . '/../..' . '/backend/zarafa/mapi/class.recurrence.php', 'Recurrence' => __DIR__ . '/../..' . '/backend/zarafa/mapi/class.recurrence.php',
'ReplaceNullcharFilter' => __DIR__ . '/../..' . '/lib/wbxml/replacenullcharfilter.php', 'ReplaceNullcharFilter' => __DIR__ . '/../..' . '/lib/wbxml/replacenullcharfilter.php',
'ReplyBackImExporter' => __DIR__ . '/../..' . '/backend/zarafa/replybackimexporter.php',
'ReplyBackState' => __DIR__ . '/../..' . '/backend/zarafa/replybackstate.php',
'Request' => __DIR__ . '/../..' . '/lib/request/request.php', 'Request' => __DIR__ . '/../..' . '/lib/request/request.php',
'RequestProcessor' => __DIR__ . '/../..' . '/lib/request/requestprocessor.php', 'RequestProcessor' => __DIR__ . '/../..' . '/lib/request/requestprocessor.php',
'ResolveRecipients' => __DIR__ . '/../..' . '/lib/request/resolverecipients.php', 'ResolveRecipients' => __DIR__ . '/../..' . '/lib/request/resolverecipients.php',
......
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