Page MenuHomePhabricator

QueryTimezone.patch

Authored By
bzimport
Nov 21 2014, 10:15 PM
Size
1 KB
Referenced Files
None
Subscribers
None

QueryTimezone.patch

Index: includes/api/ApiQuerySiteinfo.php
===================================================================
--- includes/api/ApiQuerySiteinfo.php (revision 37022)
+++ includes/api/ApiQuerySiteinfo.php (working copy)
@@ -77,7 +77,8 @@
}
protected function appendGeneralInfo($property) {
- global $wgSitename, $wgVersion, $wgCapitalLinks, $wgRightsCode, $wgRightsText, $wgLanguageCode, $IP, $wgEnableWriteAPI, $wgLang;
+ global $wgSitename, $wgVersion, $wgCapitalLinks, $wgRightsCode, $wgRightsText,
+ $wgLanguageCode, $IP, $wgEnableWriteAPI, $wgLang, $wgLocaltimezone, $wgLocalTZoffset, $wgContLang;
$data = array();
$mainPage = Title :: newFromText(wfMsgForContent('mainpage'));
@@ -96,6 +97,8 @@
$data['rightscode'] = $wgRightsCode;
$data['rights'] = $wgRightsText;
$data['lang'] = $wgLanguageCode;
+ if( $wgContLang->isRTL() )
+ $data['rtl'] = '';
$data['fallback8bitEncoding'] = $wgLang->fallback8bitEncoding();
if(wfReadOnly())
@@ -103,6 +106,17 @@
if($wgEnableWriteAPI)
$data['writeapi'] = '';
+ $tz = $wgLocaltimezone;
+ $offset = $wgLocalTZoffset;
+ if( is_null( $tz ) ) {
+ $tz = 'UTC';
+ $offset = 0;
+ } elseif( is_null( $offset ) ) {
+ $offset = 0;
+ }
+ $data['timezone'] = $tz;
+ $data['timeoffset'] = $offset;
+
$this->getResult()->addValue('query', $property, $data);
}

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4579
Default Alt Text
QueryTimezone.patch (1 KB)

Event Timeline