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

pull/6833/head
Aleksander Machniak 9 years ago
parent b7a4257ffb
commit 6c6b299d2a

@ -5,6 +5,7 @@ CHANGELOG Roundcube Webmail
- Fix regression where groups with email address were resolved to its members' addresses
- Fix so group/addressbook selection is retained on page refresh
- Fix bug where signature couldn't be added above the quote in Firefox 51 (#5628)
- Fix so microseconds macro (u) in log_date_format works (#1490446)
RELEASE 1.1.7
-------------

@ -1277,11 +1277,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)) {

@ -1178,4 +1178,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