Commit 2f61f031 authored by Manfred Kutas's avatar Manfred Kutas

Merge pull request #300 in ZP/z-push from release/2.2 to master

* commit 'a7847061':
  ZP-961 Bumped version.
  ZP-961 Bumped version, updated line endings.
  Merge pull request #290 in ZP/z-push from bugfix/ZP-884-zcp--gethierarchy-is-broken to develop
  Merge pull request #288 in ZP/z-push from bugfix/ZP-971-don-t-fail-when-source-message-id to develop
  Merge pull request #285 in ZP/z-push from feature/ZP-964-pass-z-push-version-in-an-additional to develop
  Merge pull request #283 in ZP/z-push from bugfix/ZP-970-printwbxml-use-files to develop
  ZP-961 Bumped version to 2.2.11beta1. Removed newlines.
  Merge pull request #205 in ZP/z-push from bugfix/ZP-881-change-zcp-server-location-for-listfolders to develop
  Merge pull request #244 in ZP/z-push from bugfix/ZP-935-devicedata-is-deleted-when-requesting to develop
  Merge pull request #236 in ZP/z-push from bugfix/ZP-930-z-push-top-doesn-t-work-in-another to develop
  Merge pull request #191 in ZP/z-push from bugfix/ZP-872-ping-doesn-t-catch-all-notifications to develop
  ZP-959 Format time output at the end of the request to match memory usage format.
  ZP-957 Timezone DayOfWeek and week are switched when packing.
parents 2ec6d9b5 a7847061
...@@ -482,18 +482,21 @@ class ImportChangesICS implements IImportChanges { ...@@ -482,18 +482,21 @@ class ImportChangesICS implements IImportChanges {
// Get the entryid of the message we're moving // Get the entryid of the message we're moving
$entryid = mapi_msgstore_entryidfromsourcekey($this->store, $this->folderid, hex2bin($id)); $entryid = mapi_msgstore_entryidfromsourcekey($this->store, $this->folderid, hex2bin($id));
if(!$entryid) $srcmessage = false;
throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, unable to resolve source message id", $id, $newfolder), SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID);
if ($entryid) {
//open the source message //open the source message
$srcmessage = mapi_msgstore_openentry($this->store, $entryid); $srcmessage = mapi_msgstore_openentry($this->store, $entryid);
if (!$srcmessage) { }
if(!$entryid || !$srcmessage) {
$code = SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID; $code = SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID;
// if we move to the trash and the source message is not found, we can also just tell the mobile that we successfully moved to avoid errors (ZP-624) // if we move to the trash and the source message is not found, we can also just tell the mobile that we successfully moved to avoid errors (ZP-624)
if ($newfolder == ZPush::GetBackend()->GetWasteBasket()) { if ($newfolder == ZPush::GetBackend()->GetWasteBasket()) {
$code = SYNC_MOVEITEMSSTATUS_SUCCESS; $code = SYNC_MOVEITEMSSTATUS_SUCCESS;
} }
throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, unable to open source message: 0x%X", $id, $newfolder, mapi_last_hresult()), $code); $errorCase = !$entryid ? "resolve source message id" : "open source message";
throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, unable to %s: 0x%X", $id, $newfolder, $errorCase, mapi_last_hresult()), $code);
} }
// check if the source message is in the current syncinterval // check if the source message is in the current syncinterval
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* Created : 06.05.2011 * Created : 06.05.2011
* *
* Copyright 2007 - 2013, 2015 Zarafa Deutschland GmbH * Copyright 2007 - 2013, 2015-2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * 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, * it under the terms of the GNU Affero General Public License, version 3,
...@@ -46,7 +46,12 @@ ...@@ -46,7 +46,12 @@
************************************************/ ************************************************/
define("PHP_MAPI_PATH", "/usr/share/php/mapi/"); define("PHP_MAPI_PATH", "/usr/share/php/mapi/");
define('MAPI_SERVER', 'file:///var/run/zarafa'); if (CheckMapiExtVersion('7.2.0')) {
define('MAPI_SERVER', 'file:///var/run/zarafad/server.sock');
}
else {
define('MAPI_SERVER', 'file:///var/run/zarafa');
}
define('SSLCERT_FILE', null); define('SSLCERT_FILE', null);
define('SSLCERT_PASS', null); define('SSLCERT_PASS', null);
...@@ -217,4 +222,21 @@ function listfolders_getlist ($adminStore, $session, $user) { ...@@ -217,4 +222,21 @@ function listfolders_getlist ($adminStore, $session, $user) {
} }
} }
function CheckMapiExtVersion($version = "") {
// compare build number if requested
if (preg_match('/^\d+$/', $version) && strlen($version) > 3) {
$vs = preg_split('/-/', phpversion("mapi"));
return ($version <= $vs[1]);
}
if (extension_loaded("mapi")){
if (version_compare(phpversion("mapi"), $version) == -1){
return false;
}
}
else
return false;
return true;
}
?> ?>
\ No newline at end of file
...@@ -342,23 +342,26 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -342,23 +342,26 @@ class BackendZarafa implements IBackend, ISearchProvider {
*/ */
public function GetHierarchy() { public function GetHierarchy() {
$folders = array(); $folders = array();
$importer = false;
$mapiprovider = new MAPIProvider($this->session, $this->store); $mapiprovider = new MAPIProvider($this->session, $this->store);
$rootfolder = mapi_msgstore_openentry($this->store); $rootfolder = mapi_msgstore_openentry($this->store);
$rootfolderprops = mapi_getprops($rootfolder, array(PR_SOURCE_KEY)); $rootfolderprops = mapi_getprops($rootfolder, array(PR_SOURCE_KEY));
$rootfoldersourcekey = bin2hex($rootfolderprops[PR_SOURCE_KEY]);
$hierarchy = mapi_folder_gethierarchytable($rootfolder, CONVENIENT_DEPTH); $hierarchy = mapi_folder_gethierarchytable($rootfolder, CONVENIENT_DEPTH);
$rows = mapi_table_queryallrows($hierarchy, array(PR_ENTRYID)); $rows = mapi_table_queryallrows($hierarchy, array(PR_DISPLAY_NAME, PR_PARENT_ENTRYID, PR_ENTRYID, PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY, PR_CONTAINER_CLASS, PR_ATTR_HIDDEN, PR_EXTENDED_FOLDER_FLAGS, PR_FOLDER_TYPE));
foreach ($rows as $row) { foreach ($rows as $row) {
$mapifolder = mapi_msgstore_openentry($this->store, $row[PR_ENTRYID]); // do not display hidden and search folders
$folder = $mapiprovider->GetFolder($mapifolder); if ((isset($row[PR_ATTR_HIDDEN]) && $row[PR_ATTR_HIDDEN]) ||
(isset($row[PR_FOLDER_TYPE]) && $row[PR_FOLDER_TYPE] == FOLDER_SEARCH) ||
if (isset($folder->parentid) && $folder->parentid != $rootfoldersourcekey) (isset($row[PR_PARENT_SOURCE_KEY]) && $row[PR_PARENT_SOURCE_KEY] == $rootfolderprops[PR_SOURCE_KEY]) ) {
continue;
}
$folder = $mapiprovider->GetFolder($row);
if ($folder) {
$folders[] = $folder; $folders[] = $folder;
} }
}
return $folders; return $folders;
} }
...@@ -1263,15 +1266,16 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -1263,15 +1266,16 @@ class BackendZarafa implements IBackend, ISearchProvider {
private function adviseStoreToSink($store) { private function adviseStoreToSink($store) {
// check if we already advised the store // check if we already advised the store
if (!in_array($store, $this->changesSinkStores)) { if (!in_array($store, $this->changesSinkStores)) {
mapi_msgstore_advise($this->store, null, fnevObjectModified | fnevObjectCreated | fnevObjectMoved | fnevObjectDeleted, $this->changesSink); mapi_msgstore_advise($store, null, fnevObjectModified | fnevObjectCreated | fnevObjectMoved | fnevObjectDeleted, $this->changesSink);
$this->changesSinkStores[] = $store;
if (mapi_last_hresult()) { if (mapi_last_hresult()) {
ZLog::Write(LOGLEVEL_WARN, sprintf("ZarafaBackend->adviseStoreToSink(): failed to advised store '%s' with code 0x%X. Polling will be performed.", $this->store, mapi_last_hresult())); ZLog::Write(LOGLEVEL_WARN, sprintf("ZarafaBackend->adviseStoreToSink(): failed to advised store '%s' with code 0x%X. Polling will be performed.", $store, mapi_last_hresult()));
return false; return false;
} }
else else {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaBackend->adviseStoreToSink(): advised store '%s'", $this->store)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaBackend->adviseStoreToSink(): advised store '%s'", $store));
$this->changesSinkStores[] = $store;
}
} }
return true; return true;
} }
......
...@@ -179,6 +179,10 @@ include_once('version.php'); ...@@ -179,6 +179,10 @@ include_once('version.php');
// Do the actual request // Do the actual request
header(ZPush::GetServerHeader()); header(ZPush::GetServerHeader());
if (RequestProcessor::isUserAuthenticated()) {
header("X-Z-Push-Version: ". @constant('ZPUSH_VERSION'));
}
// announce the supported AS versions (if not already sent to device) // announce the supported AS versions (if not already sent to device)
if (ZPush::GetDeviceManager()->AnnounceASVersion()) { if (ZPush::GetDeviceManager()->AnnounceASVersion()) {
$versions = ZPush::GetSupportedProtocolVersions(true); $versions = ZPush::GetSupportedProtocolVersions(true);
......
...@@ -176,10 +176,10 @@ class ZLog { ...@@ -176,10 +176,10 @@ class ZLog {
static public function WriteEnd() { static public function WriteEnd() {
if (LOGLEVEL_DEBUG <= LOGLEVEL || (LOGLEVEL_DEBUG <= LOGUSERLEVEL && self::$userLog)) { if (LOGLEVEL_DEBUG <= LOGLEVEL || (LOGLEVEL_DEBUG <= LOGUSERLEVEL && self::$userLog)) {
if (version_compare(phpversion(), '5.4.0') < 0) { if (version_compare(phpversion(), '5.4.0') < 0) {
$time_used = number_format(time() - $_SERVER["REQUEST_TIME"], 2, ',', '.'); $time_used = number_format(time() - $_SERVER["REQUEST_TIME"], 2);
} }
else { else {
$time_used = number_format(microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"], 2, ',', '.'); $time_used = number_format(microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"], 2);
} }
$peakUsage = memory_get_peak_usage(false); $peakUsage = memory_get_peak_usage(false);
$truePeakUsage = memory_get_peak_usage(true); $truePeakUsage = memory_get_peak_usage(true);
......
...@@ -1107,8 +1107,8 @@ class TimezoneUtil { ...@@ -1107,8 +1107,8 @@ class TimezoneUtil {
"tzname" => self::encodeTZName(self::getMSTZnameFromTZName($servertzname)), "tzname" => self::encodeTZName(self::getMSTZnameFromTZName($servertzname)),
"dstendyear" => $offset[3], "dstendyear" => $offset[3],
"dstendmonth" => $offset[4], "dstendmonth" => $offset[4],
"dstendday" => $offset[6], "dstendday" => $offset[5],
"dstendweek" => $offset[5], "dstendweek" => $offset[6],
"dstendhour" => $offset[7], "dstendhour" => $offset[7],
"dstendminute" => $offset[8], "dstendminute" => $offset[8],
"dstendsecond" => $offset[9], "dstendsecond" => $offset[9],
...@@ -1117,8 +1117,8 @@ class TimezoneUtil { ...@@ -1117,8 +1117,8 @@ class TimezoneUtil {
"tznamedst" => self::encodeTZName(self::getMSTZnameFromTZName($servertzname)), "tznamedst" => self::encodeTZName(self::getMSTZnameFromTZName($servertzname)),
"dststartyear" => $offset[11], "dststartyear" => $offset[11],
"dststartmonth" => $offset[12], "dststartmonth" => $offset[12],
"dststartday" => $offset[14], "dststartday" => $offset[13],
"dststartweek" => $offset[13], "dststartweek" => $offset[14],
"dststarthour" => $offset[15], "dststarthour" => $offset[15],
"dststartminute" => $offset[16], "dststartminute" => $offset[16],
"dststartsecond" => $offset[17], "dststartsecond" => $offset[17],
......
...@@ -342,6 +342,10 @@ class ZPushAdmin { ...@@ -342,6 +342,10 @@ class ZPushAdmin {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPushAdmin::ResyncFolder(): folder '%s' on device '%s' of user '%s' marked to be re-synchronized.", $folderid, $devid, $user)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPushAdmin::ResyncFolder(): folder '%s' on device '%s' of user '%s' marked to be re-synchronized.", $folderid, $devid, $user));
} }
if ($device->GetData() === false) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPushAdmin::ResyncFolder(): nothing changed for device '%s' of user '%s'", $devid, $user));
return false;
}
ZPush::GetStateMachine()->SetState($device->GetData(), $devid, IStateMachine::DEVICEDATA); ZPush::GetStateMachine()->SetState($device->GetData(), $devid, IStateMachine::DEVICEDATA);
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPushAdmin::ResyncFolder(): saved updated device data of device '%s' of user '%s'", $devid, $user)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPushAdmin::ResyncFolder(): saved updated device data of device '%s' of user '%s'", $devid, $user));
} }
......
...@@ -41,6 +41,6 @@ ...@@ -41,6 +41,6 @@
* Consult LICENSE file for details * Consult LICENSE file for details
************************************************/ ************************************************/
define("ZPUSH_VERSION", "2.2.10"); define("ZPUSH_VERSION", "2.2.11");
?> ?>
\ No newline at end of file
...@@ -62,7 +62,7 @@ include('version.php'); ...@@ -62,7 +62,7 @@ include('version.php');
*/ */
declare(ticks = 1); declare(ticks = 1);
define('BASE_PATH_CLI', dirname(__FILE__) ."/"); define('BASE_PATH_CLI', dirname(__FILE__) ."/");
set_include_path(get_include_path() . PATH_SEPARATOR . BASE_PATH_CLI);
try { try {
ZPush::CheckConfig(); ZPush::CheckConfig();
if (!function_exists("pcntl_signal")) if (!function_exists("pcntl_signal"))
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Created : 18.05.2015 * Created : 18.05.2015
* *
* Copyright 2015 Zarafa Deutschland GmbH * Copyright 2015-2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * 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, * it under the terms of the GNU Affero General Public License, version 3,
...@@ -42,9 +42,10 @@ ...@@ -42,9 +42,10 @@
************************************************/ ************************************************/
if (count($argv) < 2) { if (count($argv) < 2) {
die("\tUsage: printwbmxl.php WBXML-INPUT-HERE\n\n"); die("\tUsage: printwbmxl.php WBXML-INPUT-HERE or PATH-TO-FILE\n\n");
} }
$wbxml64 = $argv[1]; $wbxml64 = is_file($argv[1]) ? realpath($argv[1]) : $argv[1];
chdir(__DIR__);
// include the stuff we need // include the stuff we need
include_once('../../src/lib/utils/stringstreamwrapper.php'); include_once('../../src/lib/utils/stringstreamwrapper.php');
...@@ -71,7 +72,7 @@ class ZLog { ...@@ -71,7 +72,7 @@ class ZLog {
} }
// setup // setup
$wxbml = StringStreamWrapper::Open($wbxml64); $wxbml = is_file($wbxml64) ? fopen($wbxml64, 'r+') : StringStreamWrapper::Open($wbxml64);
$base64filter = stream_filter_append($wxbml, 'convert.base64-decode'); $base64filter = stream_filter_append($wxbml, 'convert.base64-decode');
$decoder = new WBXMLDecoder($wxbml); $decoder = new WBXMLDecoder($wxbml);
if (! $decoder->IsWBXML()) { if (! $decoder->IsWBXML()) {
......
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