Fix so microseconds macro (u) in log_date_format works (#1490446)

pull/192/head^2
Aleksander Machniak 9 years ago
parent 1e3d637c70
commit 9aae1b7fc3

@ -10,6 +10,7 @@ CHANGELOG Roundcube Webmail
- Plugin API: Added message_ready hook
- Plugin API: Add special onload() method to execute plugin actions before startup (session and GUI initialization)
- Implemented UI element to jump to specified page of the messages list (#1485235)
- Fix so microseconds macro (u) in log_date_format works (#1490446)
- Fix so unrecognized TNEF attachments are displayed on the list of attachments (#1490351)
- Fix "Importing..." message does not hide on error (#1490422)
- Fix Compose action in addressbook for results from multiple addressbooks (#1490413)

@ -1231,11 +1231,7 @@ class rcube
$session_key = intval(self::$instance->config->get('log_session_id', 8));
}
if (empty($date_format)) {
$date_format = 'd-M-Y H:i:s O';
}
$date = date($date_format);
$date = rcube_utils::date_format($date_format);
// trigger logging hook
if (is_object(self::$instance) && is_object(self::$instance->plugins)) {

@ -1149,4 +1149,27 @@ class rcube_utils
return $random;
}
/**
* Format current date according to specified format.
* This method supports microseconds (u).
*
* @param string $format Date format (default: 'd-M-Y H:i:s O')
*
* @return string Formatted date
*/
public static function date_format($format = null)
{
if (empty($format)) {
$format = 'd-M-Y H:i:s O';
}
if (strpos($format, 'u') !== false
&& ($date = date_create_from_format('U.u.e', microtime(true) . '.' . date_default_timezone_get()))
) {
return $date->format($format);
}
return date($format);
}
}

Loading…
Cancel
Save