Commit 0e354a26 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-891 Removed Kopano importer/wrapper prefix logging, Kopano folderstat

logging, changed SyncProvisioning->Load() and GetObjectWithPolicies() to
log the applied policies optionally,
DeviceManager->GetProvioningObject() also accepts logging flag, enable
logging flag while executing provisioning, removed redundant log about
the non setup of the exporter.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 9d44080f
......@@ -123,13 +123,12 @@ class ImportChangesICS implements IImportChanges {
$this->mapiprovider = new MAPIProvider($this->session, $this->store);
if ($folderid)
if ($folderid) {
$this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportContentsChanges, 0 , 0);
else
}
else {
$this->importer = mapi_openproperty($folder, PR_COLLECTOR, IID_IExchangeImportHierarchyChanges, 0 , 0);
// TODO remove this log output in 2.3.X
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ImportChangesICS: prefix:'%s'", $this->prefix));
}
}
/**
......
......@@ -1389,10 +1389,6 @@ class BackendKopano implements IBackend, ISearchProvider {
$this->folderStatCache[$user] = array();
}
// TODO remove nameCache
if (!isset($this->nameCache))
$this->nameCache = array();
// if there is nothing in the cache for a store, load the data for all folders of it
if (empty($this->folderStatCache[$user])) {
// get the store
......@@ -1412,18 +1408,11 @@ class BackendKopano implements IBackend, ISearchProvider {
$content_deleted = isset($folder[PR_DELETED_MSG_COUNT])? $folder[PR_DELETED_MSG_COUNT] : -1;
$this->folderStatCache[$user][bin2hex($folder[PR_SOURCE_KEY])] = $commit_time ."/". $content_count ."/". $content_unread ."/". $content_deleted;
$this->nameCache[bin2hex($folder[PR_SOURCE_KEY])] = $folder[PR_DISPLAY_NAME];
}
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoBackend->GetFolderStat() fetched status information of %d folders for store '%s'", count($this->folderStatCache[$user]), $user));
// TODO remove logging
foreach($this->folderStatCache[$user] as $fid => $stat) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("FolderStat: %s %s %s\t%s", $user, $fid, $stat, $this->nameCache[$fid]));
}
}
if (isset($this->folderStatCache[$user][$folderid])) {
// TODO remove nameCache output
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoBackend->GetFolderStat() found stat for '%s': %s", $this->nameCache[$folderid], $this->folderStatCache[$user][$folderid]));
return $this->folderStatCache[$user][$folderid];
}
else {
......
......@@ -88,8 +88,6 @@ class PHPWrapper {
$this->prefix = $folderid . ':';
}
}
// TODO remove this log output in 2.3.X
ZLog::Write(LOGLEVEL_DEBUG, sprintf("PHPWrapper: prefix:'%s'", $this->prefix));
}
/**
......
......@@ -307,12 +307,14 @@ class DeviceManager {
/**
* Builds a Provisioning SyncObject with policies
*
* @param boolean $logPolcies optional, determines if the policies and values should be logged. Default: false
*
* @access public
* @return SyncProvisioning
*/
public function GetProvisioningObject() {
public function GetProvisioningObject($logPolicies = false) {
$policyName = $this->getPolicyName();
$p = SyncProvisioning::GetObjectWithPolicies($this->getProvisioningPolicies($policyName));
$p = SyncProvisioning::GetObjectWithPolicies($this->getProvisioningPolicies($policyName), $logPolicies);
$p->PolicyName = $policyName;
return $p;
}
......
......@@ -232,7 +232,8 @@ class Provisioning extends RequestProcessor {
elseif ($policytype == 'MS-EAS-Provisioning-WBXML') {
self::$encoder->startTag(SYNC_PROVISION_EASPROVISIONDOC);
$prov = self::$deviceManager->GetProvisioningObject();
// get the provisioning object and log the loaded policy values
$prov = self::$deviceManager->GetProvisioningObject(true);
if (!$prov->Check())
throw new FatalException("Invalid policies!");
......
......@@ -796,7 +796,6 @@ class Sync extends RequestProcessor {
if ($newFolderStat !== false && ! $spa->IsExporterRunRequired($newFolderStat, true)) {
$changecount = 0;
$setupExporter = false;
ZLog::Write(LOGLEVEL_DEBUG, "Sync(): Folder stat from the backend indicates that the folder did not change. Exporter will not run.");
}
}
......
......@@ -245,12 +245,13 @@ class SyncProvisioning extends SyncObject {
/**
* Loads provisioning policies into a SyncProvisioning object.
*
* @param array $policies - array with policies' names and values
* @param array $policies array with policies' names and values
* @param boolean $logPolcies optional, determines if the policies and values should be logged. Default: false
*
* @access public
* @return void
*/
public function Load($policies = array()) {
public function Load($policies = array(), $logPolices = false) {
$this->LoadDefaultPolicies();
$streamerVars = $this->GetStreamerVars();
......@@ -259,7 +260,9 @@ class SyncProvisioning extends SyncObject {
ZLog::Write(LOGLEVEL_INFO, sprintf("Policy '%s' not supported by the device, ignoring", $p));
continue;
}
ZLog::Write(LOGLEVEL_WBXML, sprintf("Policy '%s' enforced with: %s (%s)", $p, (is_array($v)) ? Utils::PrintAsString(implode(',', $v)) : Utils::PrintAsString($v), gettype($v)));
if ($logPolices) {
ZLog::Write(LOGLEVEL_WBXML, sprintf("Policy '%s' enforced with: %s (%s)", $p, (is_array($v)) ? Utils::PrintAsString(implode(',', $v)) : Utils::PrintAsString($v), gettype($v)));
}
$this->$p = (is_array($v) && empty($v)) ? array() : $v;
}
}
......@@ -332,12 +335,15 @@ class SyncProvisioning extends SyncObject {
/**
* Returns the SyncProvisioning instance.
*
* @param array $policies array with policies' names and values
* @param boolean $logPolcies optional, determines if the policies and values should be logged. Default: false
*
* @access public
* @return SyncProvisioning
*/
public static function GetObjectWithPolicies($policies = array()) {
public static function GetObjectWithPolicies($policies = array(), $logPolices = false) {
$p = new SyncProvisioning();
$p->Load($policies);
$p->Load($policies, $logPolices);
return $p;
}
}
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