Page MenuHomePhabricator

0001-Fix-for-bug-19991.patch

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

0001-Fix-for-bug-19991.patch

From 623f5841463ee960ad67b1aeb9d57c8be1e7e341 Mon Sep 17 00:00:00 2001
From: Micke Nordin <mik@elnord.in>
Date: Mon, 4 Feb 2013 19:52:14 +0100
Subject: [PATCH] Fix for bug 19991
---
includes/installer/Installer.i18n.php | 3 ++
includes/installer/Installer.php | 1 +
includes/installer/LocalSettingsGenerator.php | 9 +++++-
includes/installer/WebInstallerPage.php | 42 +++++++++++++++++++++++--
4 filer ändrade, 51 tillägg(+), 4 borttagningar(-)
diff --git a/includes/installer/Installer.i18n.php b/includes/installer/Installer.i18n.php
index b837061..b0795d4 100644
--- a/includes/installer/Installer.i18n.php
+++ b/includes/installer/Installer.i18n.php
@@ -43,6 +43,9 @@ Check your php.ini and make sure <code>session.save_path</code> is set to an app
'config-your-language-help' => 'Select a language to use during the installation process.',
'config-wiki-language' => 'Wiki language:',
'config-wiki-language-help' => 'Select the language that the wiki will predominantly be written in.',
+ 'config-timezone-settings' => 'Timezone settings',
+ 'config-wiki-timezone' => 'Wiki timezone:',
+ 'config-wiki-timezone-help' => 'Select the timezone that the wiki will use e.g. for timestamps.',
'config-back' => '← Back',
'config-continue' => 'Continue →',
'config-page-language' => 'Language',
diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php
index da351ca..75a2302 100644
--- a/includes/installer/Installer.php
+++ b/includes/installer/Installer.php
@@ -158,6 +158,7 @@ abstract class Installer {
'wgLogo',
'wgShellLocale',
'wgSecretKey',
+ 'wgLocaltimezone',
'wgUseInstantCommons',
'wgUpgradeKey',
'wgDefaultSkin',
diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php
index bbc6b64..37d7d06 100644
--- a/includes/installer/LocalSettingsGenerator.php
+++ b/includes/installer/LocalSettingsGenerator.php
@@ -59,7 +59,7 @@ class LocalSettingsGenerator {
'wgLanguageCode', 'wgEnableEmail', 'wgEnableUserEmail', 'wgDiff3',
'wgEnotifUserTalk', 'wgEnotifWatchlist', 'wgEmailAuthentication',
'wgDBtype', 'wgSecretKey', 'wgRightsUrl', 'wgSitename', 'wgRightsIcon',
- 'wgRightsText', 'wgMainCacheType', 'wgEnableUploads',
+ 'wgRightsText', 'wgMainCacheType', 'wgEnableUploads', 'wgLocaltimezone',
'wgMainCacheType', '_MemCachedServers', 'wgDBserver', 'wgDBuser',
'wgDBpassword', 'wgUseInstantCommons', 'wgUpgradeKey', 'wgDefaultSkin',
'wgMetaNamespace', 'wgResourceLoaderMaxQueryLength'
@@ -328,6 +328,13 @@ if ( !defined( 'MEDIAWIKI' ) ) {
# Site language code, should be one of the list in ./languages/Names.php
\$wgLanguageCode = \"{$this->values['wgLanguageCode']}\";
+# Set Default Timezone
+\$wgLocaltimezone = \"{$this->values['wgLocaltimezone']}\";
+\$oldtz = getenv(\"TZ\");
+putenv(\"TZ=\$wgLocaltimezone\");
+\$wgLocalTZoffset = date(\"Z\") / 60;
+putenv(\"TZ=\$oldtz\");
+
\$wgSecretKey = \"{$this->values['wgSecretKey']}\";
# Site upgrade key. Must be set to a string (default provided) to turn on the
diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php
index 572360a..9d16532 100644
--- a/includes/installer/WebInstallerPage.php
+++ b/includes/installer/WebInstallerPage.php
@@ -818,6 +818,10 @@ class WebInstaller_Name extends WebInstallerPage {
class WebInstaller_Options extends WebInstallerPage {
public function execute() {
+ global $wgLocaltimezone;
+ $r = $this->parent->request;
+ $timezone = $r->getVal( 'config_wgLocaltimezone' );
+
if ( $this->getVar( '_SkipOptional' ) == 'skip' ) {
return 'skip';
}
@@ -826,7 +830,6 @@ class WebInstaller_Options extends WebInstallerPage {
return 'continue';
}
}
-
$emailwrapperStyle = $this->getVar( 'wgEnableEmail' ) ? '' : 'display: none';
$this->startForm();
$this->addHTML(
@@ -947,6 +950,14 @@ class WebInstaller_Options extends WebInstallerPage {
$this->getFieldSetEnd()
);
+ $this->addHTML(
+ $this->getFieldSetStart( 'config-timezone-settings' ) .
+ $this->getTimezoneSelector( 'config_wgLocaltimezone', 'config-wiki-timezone', is_null($wgLocaltimezone) ? 'UTC' : $wgLocaltimezone,
+ $this->parent->getHelpBox( 'config-wiki-timezone-help' )
+ ) .
+ $this->getFieldSetEnd()
+ );
+ $wgLocaltimezone = $timezone;
$caches = array( 'none' );
if( count( $this->getVar( '_Caches' ) ) ) {
$caches[] = 'accel';
@@ -983,9 +994,34 @@ class WebInstaller_Options extends WebInstallerPage {
'</div>' .
$this->getFieldSetEnd()
);
- $this->endForm();
+ $this->endForm( );
}
+ /* Get a "<select>" for selecting timezones.
+ *
+ * @param $name
+ * @param $label
+ * @param $selectedCode
+ * @param $helpHtml string
+ * @return string
+ */
+ public function getTimezoneSelector( $name, $label, $selectedCode, $helpHtml = '' ) {
+
+ $s = $helpHtml;
+
+ $s .= Html::openElement( 'select', array( 'id' => $name, 'name' => $name,
+ 'tabindex' => $this->parent->nextTabIndex() ) ) . "\n";
+
+ $zones = DateTimeZone::listIdentifiers();
+ sort($zones);
+
+ foreach ( $zones as $code => $zone ) {
+ $s .= "\n" . Xml::option( $zone, $zone, $zone == $selectedCode );
+ }
+ $s .= "\n</select>\n";
+ return $this->parent->label( $label, $name, $s );
+ }
+
/**
* @return string
*/
@@ -1076,7 +1112,7 @@ class WebInstaller_Options extends WebInstallerPage {
'wgEnableEmail', 'wgPasswordSender', 'wgEnableUploads', 'wgLogo',
'wgEnableUserEmail', 'wgEnotifUserTalk', 'wgEnotifWatchlist',
'wgEmailAuthentication', 'wgMainCacheType', '_MemCachedServers',
- 'wgUseInstantCommons' ) );
+ 'wgUseInstantCommons', 'wgLocaltimezone' ) );
if ( !in_array( $this->getVar( '_RightsProfile' ),
array_keys( $this->parent->rightsProfiles ) ) )
--
1.7.10.4

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5392
Default Alt Text
0001-Fix-for-bug-19991.patch (6 KB)

Event Timeline