Commit 97a6ae6c authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #259 in ZP/z-push from bugfix/ZP-891-remove-extra-log-for-2.3.0 to develop

* commit '7479ec9a':
  ZP-891 Fixed typos.
  ZP-891 No need to fetch the display name of the folder anymore.
  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.
parents 16f55a71 7479ec9a
......@@ -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,17 +1389,13 @@ 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
$userstore = $this->openMessageStore($user);
$rootfolder = mapi_msgstore_openentry($userstore);
$hierarchy = mapi_folder_gethierarchytable($rootfolder, CONVENIENT_DEPTH);
$rows = mapi_table_queryallrows($hierarchy, array(PR_SOURCE_KEY, PR_LOCAL_COMMIT_TIME_MAX, PR_CONTENT_COUNT, PR_CONTENT_UNREAD, PR_DELETED_MSG_COUNT, PR_DISPLAY_NAME));
$rows = mapi_table_queryallrows($hierarchy, array(PR_SOURCE_KEY, PR_LOCAL_COMMIT_TIME_MAX, PR_CONTENT_COUNT, PR_CONTENT_UNREAD, PR_DELETED_MSG_COUNT));
if (count($rows) == 0) {
ZLog::Write(LOGLEVEL_INFO, sprintf("KopanoBackend->GetFolderStat(): could not access folder statistics for user '%s'. Probably missing 'read' permissions on the root folder! Folders of this store will be synchronized ONCE per hour only!", $user));
......@@ -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 $logPolicies 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 $logPolicies 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(), $logPolicies = 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 ($logPolicies) {
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 $logPolicies 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(), $logPolicies = false) {
$p = new SyncProvisioning();
$p->Load($policies);
$p->Load($policies, $logPolicies);
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