diff --git a/sources/backend/imap/mime_calendar.php b/sources/backend/imap/mime_calendar.php index cd4082a..9592ba8 100644 --- a/sources/backend/imap/mime_calendar.php +++ b/sources/backend/imap/mime_calendar.php @@ -304,7 +304,7 @@ function parse_meeting_calendar($part, &$output, $is_sent_folder) { else { $tz = TimezoneUtil::GetFullTZ(); } - $output->meetingrequest->timezone = base64_encode(TimezoneUtil::getSyncBlobFromTZ($tz)); + $output->meetingrequest->timezone = base64_encode(TimezoneUtil::GetSyncBlobFromTZ($tz)); // Fixed values $output->meetingrequest->instancetype = 0; @@ -354,4 +354,4 @@ function reply_meeting_calendar($part, $response, $username) { $ical->SetCPParameterValue("VEVENT", "ATTENDEE", "RSVP", null, sprintf("MAILTO:%s", $username)); return $ical->Render(); -} \ No newline at end of file +} diff --git a/sources/backend/zarafa/exporter.php b/sources/backend/zarafa/exporter.php index 76ad075..ee40092 100644 --- a/sources/backend/zarafa/exporter.php +++ b/sources/backend/zarafa/exporter.php @@ -234,7 +234,7 @@ class ExportChangesICS implements IExportChanges{ $changes = mapi_exportchanges_getchangecount($this->exporter); if($changes || !($this->flags & BACKEND_DISCARD_DATA)) - ZLog::Write(LOGLEVEL_DEBUG, sprintf("ExportChangesICS->InitializeExporter() successfully. %d changes ready to sync.", $changes)); + ZLog::Write(LOGLEVEL_DEBUG, sprintf("ExportChangesICS->InitializeExporter() successfully. %d changes ready to sync for '%s'.", $changes, ($this->folderid)?bin2hex($this->folderid) : 'hierarchy')); return $ret; } diff --git a/sources/backend/zarafa/importer.php b/sources/backend/zarafa/importer.php index 370c5a6..4ed209b 100644 --- a/sources/backend/zarafa/importer.php +++ b/sources/backend/zarafa/importer.php @@ -453,7 +453,6 @@ class ImportChangesICS implements IImportChanges { return true; } - /** * Imports a move of a message. This occurs when a user moves an item to another folder * @@ -694,4 +693,4 @@ class ImportChangesICS implements IImportChanges { return $ret; } -} \ No newline at end of file +} diff --git a/sources/backend/zarafa/mapiprovider.php b/sources/backend/zarafa/mapiprovider.php index 6664cb3..afec67f 100644 --- a/sources/backend/zarafa/mapiprovider.php +++ b/sources/backend/zarafa/mapiprovider.php @@ -2679,4 +2679,4 @@ class MAPIProvider { } return $this->inboxProps; } -} \ No newline at end of file +} diff --git a/sources/backend/zarafa/zarafa.php b/sources/backend/zarafa/zarafa.php index 335fd4a..72864bd 100644 --- a/sources/backend/zarafa/zarafa.php +++ b/sources/backend/zarafa/zarafa.php @@ -63,7 +63,6 @@ include_once('backend/zarafa/mapi/class.meetingrequest.php'); include_once('backend/zarafa/mapi/class.freebusypublish.php'); // processing of RFC822 messages -include_once('include/mimeDecode.php'); require_once('include/z_RFC822.php'); // components of Zarafa backend @@ -167,7 +166,7 @@ class BackendZarafa implements IBackend, ISearchProvider { // send Z-Push version and user agent to ZCP - ZP-589 if (Utils::CheckMapiExtVersion('7.2.0')) { $zpush_version = 'Z-Push_' . @constant('ZPUSH_VERSION'); - $user_agent = $_SERVER['HTTP_USER_AGENT']; + $user_agent = ZPush::GetDeviceManager()->GetUserAgent(); $this->session = @mapi_logon_zarafa($user, $pass, MAPI_SERVER, null, null, 0, $zpush_version, $user_agent); } else { diff --git a/sources/include/z_syslog.php b/sources/include/z_syslog.php index a599b6d..0a16d7b 100644 --- a/sources/include/z_syslog.php +++ b/sources/include/z_syslog.php @@ -26,6 +26,8 @@ * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of Leon van Kammen / Coder of Salvation + * + * https://github.com/coderofsalvation/syslog-flexible */ class ZSyslog { @@ -103,4 +105,4 @@ class ZSyslog { case LOGLEVEL_WBXMLSTACK: return LOG_DEBUG; break; } } -} \ No newline at end of file +} diff --git a/sources/index.php b/sources/index.php index 1568a87..dceced5 100644 --- a/sources/index.php +++ b/sources/index.php @@ -247,15 +247,7 @@ if (defined('LOG_MEMORY_PROFILER') && LOG_MEMORY_PROFILER) { ZPush::GetDeviceManager()->Save(); // end gracefully - if (version_compare(phpversion(), '5.4.0') < 0) { - $time_used = number_format(time() - $_SERVER["REQUEST_TIME"], 4); - } - else { - $time_used = number_format(microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"], 4); - } - - ZLog::Write(LOGLEVEL_DEBUG, sprintf("-------- End - max mem: %s/%s - time: %s - code: %s", memory_get_peak_usage(false), memory_get_peak_usage(true), $time_used, http_response_code())); - + ZLog::WriteEnd(); if (defined('LOG_MEMORY_PROFILER') && LOG_MEMORY_PROFILER) { if (function_exists('memprof_enable')) { diff --git a/sources/lib/core/statemanager.php b/sources/lib/core/statemanager.php index afc6f9d..0b7e7ed 100644 --- a/sources/lib/core/statemanager.php +++ b/sources/lib/core/statemanager.php @@ -316,8 +316,8 @@ class StateManager { */ public function SetBackendStorage($data, $type = self::BACKENDSTORAGE_PERMANENT) { if ($type == self::BACKENDSTORAGE_STATE) { - if (!$this->uuid) - throw new StateNotYetAvailableException(); + if (!$this->uuid) + throw new StateNotYetAvailableException(); // TODO serialization should be done in the StateMachine return $this->statemachine->SetState($data, $this->device->GetDeviceId(), IStateMachine::BACKENDSTORAGE, $this->uuid, $this->newStateCounter); diff --git a/sources/lib/core/streamimporter.php b/sources/lib/core/streamimporter.php index 877cf4a..0db17f5 100644 --- a/sources/lib/core/streamimporter.php +++ b/sources/lib/core/streamimporter.php @@ -44,7 +44,6 @@ class ImportChangesStream implements IImportChanges { private $encoder; private $objclass; - private $classAsString; private $seenObjects; private $importedMsgs; private $checkForIgnoredMessages; diff --git a/sources/lib/core/zlog.php b/sources/lib/core/zlog.php index a4b7481..26b03b4 100644 --- a/sources/lib/core/zlog.php +++ b/sources/lib/core/zlog.php @@ -172,6 +172,27 @@ class ZLog { return (isset(self::$lastLogs[$loglevel]))?self::$lastLogs[$loglevel]:false; } + + /** + * Writes info at the end of the request but only if the LOGLEVEL is DEBUG or more verbose + * + * @access public + * @return + */ + static public function WriteEnd() { + if (LOGLEVEL_DEBUG <= LOGLEVEL) { + if (version_compare(phpversion(), '5.4.0') < 0) { + $time_used = number_format(time() - $_SERVER["REQUEST_TIME"], 4); + } + else { + $time_used = number_format(microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"], 4); + } + + ZLog::Write(LOGLEVEL_DEBUG, sprintf("Memory usage information: %s/%s - Execution time: %s - HTTP responde code: %s", memory_get_peak_usage(false), memory_get_peak_usage(true), $time_used, http_response_code())); + ZLog::Write(LOGLEVEL_DEBUG, "-------- End"); + } + } + /**---------------------------------------------------------------------------------------------------------- * private log stuff */ diff --git a/sources/lib/core/zpush.php b/sources/lib/core/zpush.php index 1fb4383..463b79b 100644 --- a/sources/lib/core/zpush.php +++ b/sources/lib/core/zpush.php @@ -529,7 +529,7 @@ class ZPush { $loaded = false; foreach (self::$autoloadBackendPreference as $autoloadBackend) { ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPush::GetBackend(): trying autoload backend '%s'", $autoloadBackend)); - $loaded = self::IncludeBackend($autoloadBackend); + $loaded = class_exists($autoloadBackend) || self::IncludeBackend($autoloadBackend); if ($loaded) { $ourBackend = $autoloadBackend; break; @@ -538,7 +538,7 @@ class ZPush { if (!$ourBackend || !$loaded) throw new FatalMisconfigurationException("No Backend provider can not be loaded. Check your installation and configuration!"); } - else + elseif (!class_exists($ourBackend)) self::IncludeBackend($ourBackend); if (class_exists($ourBackend)) diff --git a/sources/lib/default/diffbackend/exportchangesdiff.php b/sources/lib/default/diffbackend/exportchangesdiff.php index c3a3a89..e159229 100644 --- a/sources/lib/default/diffbackend/exportchangesdiff.php +++ b/sources/lib/default/diffbackend/exportchangesdiff.php @@ -110,7 +110,7 @@ class ExportChangesDiff extends DiffState implements IExportChanges{ $this->changes = $this->getDiffTo($folderlist); } - ZLog::Write(LOGLEVEL_INFO, sprintf("ExportChangesDiff->InitializeExporter(): Found %d changes", count($this->changes))); + ZLog::Write(LOGLEVEL_INFO, sprintf("ExportChangesDiff->InitializeExporter(): Found '%d' changes for '%s'", count($this->changes), ($this->folderid)?$this->folderid : 'hierarchy' )); } /**