can be set to any other timezone.
Also avoids the ugly default-changing that was being used by c15605.
Change-Id: I7a5086f84310f50a1929e07bd2e6527a518424b2
* The user right 'upload_by_url' is no longer given to sysops by default.
This only affects installations which have $wgAllowCopyUploads set to true.
* Removed f-prot support from $wgAntivirusSetup.
-* $wgDBerrorLogInUTC to log error in $wgDBerrorLog using an UTC date instead
- of the wiki timezone set by $wgLocalTimezone.
+* New variable $wgDBerrorLogTZ to provide dates in the error log in a
+ different timezone than the wiki timezone set by $wgLocalTimezone.
=== New features in 1.20 ===
* Added TitleIsAlwaysKnown hook which gets called when determining if a page exists.
/** File to log database errors to */
$wgDBerrorLog = false;
+
/**
- * Override wiki timezone to UTC for wgDBerrorLog
+ * Timezone to use in the error log.
+ * Defaults to the wiki timezone ($wgLocalTimezone).
+ *
+ * A list of useable timezones can found at:
+ * http://php.net/manual/en/timezones.php
+ *
+ * @par Examples:
+ * @code
+ * $wgLocaltimezone = 'UTC';
+ * $wgLocaltimezone = 'GMT';
+ * $wgLocaltimezone = 'PST8PDT';
+ * $wgLocaltimezone = 'Europe/Sweden';
+ * $wgLocaltimezone = 'CET';
+ * @endcode
+ *
* @since 1.20
*/
-$wgDBerrorLogInUTC = false;
+$wgDBerrorLogTZ = false;
/** When to give an error message */
$wgDBClusterTimeout = 10;
* Timezones can be translated by editing MediaWiki messages of type
* timezone-nameinlowercase like timezone-utc.
*
+ * A list of useable timezones can found at:
+ * http://php.net/manual/en/timezones.php
+ *
* @par Examples:
* @code
+ * $wgLocaltimezone = 'UTC';
* $wgLocaltimezone = 'GMT';
* $wgLocaltimezone = 'PST8PDT';
* $wgLocaltimezone = 'Europe/Sweden';
* @param $text String: database error message.
*/
function wfLogDBError( $text ) {
- global $wgDBerrorLog, $wgDBerrorLogInUTC;
+ global $wgDBerrorLog, $wgDBerrorLogTZ;
+ static $logDBErrorTimeZoneObject = null;
+
if ( $wgDBerrorLog ) {
$host = wfHostname();
$wiki = wfWikiID();
- if( $wgDBerrorLogInUTC ) {
- $wikiTimezone = date_default_timezone_get();
- date_default_timezone_set( 'UTC' );
- }
- $date = date( 'D M j G:i:s T Y' );
- if( $wgDBerrorLogInUTC ) {
- // Restore timezone
- date_default_timezone_set( $wikiTimezone );
+ if ( $wgDBerrorLogTZ && !$logDBErrorTimeZoneObject ) {
+ $logDBErrorTimeZoneObject = new DateTimeZone( $wgDBerrorLogTZ );
}
+ $d = date_create( "now", $logDBErrorTimeZoneObject );
+
+ $date = $d->format( 'D M j G:i:s T Y' );
+
$text = "$date\t$host\t$wiki\t$text";
wfErrorLog( $text, $wgDBerrorLog );
}