From 1b71bc52567f630bab8623a3db2d78c16d52c89b Mon Sep 17 00:00:00 2001
From: MatmaRex
Date: Wed, 6 Feb 2013 17:35:46 +0100
Subject: [PATCH] (bug 29472) kill $wgUseDynamicDates
Remove $wgUseDynamicDates and everything related to it.
I left DateFormatter::reformat() alone, since it might possibly be
used elsewhere, and to be honest I'm afraid to touch it.
Change-Id: I609db8471c14e5e5946916f085d2ee5b96204d81
---
RELEASE-NOTES-1.21 | 2 ++
includes/DefaultSettings.php | 5 ---
includes/User.php | 5 +--
includes/parser/Parser.php | 5 ---
includes/parser/ParserOptions.php | 17 ++-------
tests/parser/parserTests.txt | 33 -----------------
tests/phpunit/includes/ParserOptionsTest.php | 37 --------------------
7 files changed, 5 insertions(+), 99 deletions(-)
delete mode 100644 tests/phpunit/includes/ParserOptionsTest.php
diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21
index 99ac1ec74c..36e660efe5 100644
--- a/RELEASE-NOTES-1.21
+++ b/RELEASE-NOTES-1.21
@@ -16,6 +16,8 @@ production.
of page watchers required for the number to be accessible to users
without the unwatchedpages permission.
* $wgBug34832TransitionalRollback has been removed.
+* (bug 29472) $wgUseDynamicDates has been removed and its functionality
+ disabled.
=== New features in 1.21 ===
* (bug 38110) Schema changes (adding or dropping tables, indicies and
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 68c4542ce8..369d941026 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -2352,11 +2352,6 @@ $wgBrowserBlackList = array(
*/
$wgLegacySchemaConversion = false;
-/**
- * Enable to allow rewriting dates in page text.
- * DOES NOT FORMAT CORRECTLY FOR MOST LANGUAGES.
- */
-$wgUseDynamicDates = false;
/**
* Enable dates like 'May 12' instead of '12 May', this only takes effect if
* the interface is set to English.
diff --git a/includes/User.php b/includes/User.php
index 309d755b61..a73414c9d3 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -3264,7 +3264,7 @@ class User {
public function getPageRenderingHash() {
wfDeprecated( __METHOD__, '1.17' );
- global $wgUseDynamicDates, $wgRenderHashAppend, $wgLang, $wgContLang;
+ global $wgRenderHashAppend, $wgLang, $wgContLang;
if( $this->mHash ) {
return $this->mHash;
}
@@ -3275,9 +3275,6 @@ class User {
$confstr = $this->getOption( 'math' );
$confstr .= '!' . $this->getStubThreshold();
- if ( $wgUseDynamicDates ) { # This is wrong (bug 24714)
- $confstr .= '!' . $this->getDatePreference();
- }
$confstr .= '!' . ( $this->getOption( 'numberheadings' ) ? '1' : '' );
$confstr .= '!' . $wgLang->getCode();
$confstr .= '!' . $this->getOption( 'thumbsize' );
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 876e3b7a47..d434e30e31 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -62,7 +62,6 @@
* $wgAllowSpecialInclusion
* $wgInterwikiMagic
* $wgMaxArticleSize
- * $wgUseDynamicDates
*
* @ingroup Parser
*/
@@ -1165,10 +1164,6 @@ class Parser {
$text = $this->doDoubleUnderscore( $text );
$text = $this->doHeadings( $text );
- if ( $this->mOptions->getUseDynamicDates() ) {
- $df = DateFormatter::getInstance();
- $text = $df->reformat( $this->mOptions->getDateFormat(), $text );
- }
$text = $this->replaceInternalLinks( $text );
$text = $this->doAllQuotes( $text );
$text = $this->replaceExternalLinks( $text );
diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php
index 064182e7f8..4774de4553 100644
--- a/includes/parser/ParserOptions.php
+++ b/includes/parser/ParserOptions.php
@@ -30,11 +30,6 @@
*/
class ParserOptions {
- /**
- * Use DateFormatter to format dates
- */
- var $mUseDynamicDates;
-
/**
* Interlanguage links are removed and returned in an array
*/
@@ -220,7 +215,6 @@ class ParserOptions {
*/
protected $onAccessCallback = null;
- function getUseDynamicDates() { return $this->mUseDynamicDates; }
function getInterwikiMagic() { return $this->mInterwikiMagic; }
function getAllowExternalImages() { return $this->mAllowExternalImages; }
function getAllowExternalImagesFrom() { return $this->mAllowExternalImagesFrom; }
@@ -308,7 +302,6 @@ class ParserOptions {
return $this->getUserLangObj()->getCode();
}
- function setUseDynamicDates( $x ) { return wfSetVar( $this->mUseDynamicDates, $x ); }
function setInterwikiMagic( $x ) { return wfSetVar( $this->mInterwikiMagic, $x ); }
function setAllowExternalImages( $x ) { return wfSetVar( $this->mAllowExternalImages, $x ); }
function setAllowExternalImagesFrom( $x ) { return wfSetVar( $this->mAllowExternalImagesFrom, $x ); }
@@ -422,7 +415,7 @@ class ParserOptions {
* @param $lang Language object
*/
private function initialiseFromUser( $user, $lang ) {
- global $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages,
+ global $wgInterwikiMagic, $wgAllowExternalImages,
$wgAllowExternalImagesFrom, $wgEnableImageWhitelist, $wgAllowSpecialInclusion,
$wgMaxArticleSize, $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth,
$wgCleanSignatures, $wgExternalLinkTarget, $wgExpensiveParserFunctionLimit,
@@ -430,7 +423,6 @@ class ParserOptions {
wfProfileIn( __METHOD__ );
- $this->mUseDynamicDates = $wgUseDynamicDates;
$this->mInterwikiMagic = $wgInterwikiMagic;
$this->mAllowExternalImages = $wgAllowExternalImages;
$this->mAllowExternalImagesFrom = $wgAllowExternalImagesFrom;
@@ -481,12 +473,7 @@ class ParserOptions {
* @return array
*/
public static function legacyOptions() {
- global $wgUseDynamicDates;
- $legacyOpts = array( 'math', 'stubthreshold', 'numberheadings', 'userlang', 'thumbsize', 'editsection', 'printable' );
- if ( $wgUseDynamicDates ) {
- $legacyOpts[] = 'dateformat';
- }
- return $legacyOpts;
+ return array( 'math', 'stubthreshold', 'numberheadings', 'userlang', 'thumbsize', 'editsection', 'printable' );
}
/**
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index c25f158066..1f84aaed75 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -11806,17 +11806,6 @@ Multibyte character in padright
!! end
-!! test
-Formatted date
-!! config
-wgUseDynamicDates=1
-!! input
-[[2009-03-24]]
-!! result
-2009-03-24
-
-!!end
-
!!test
formatdate parser function
!!input
@@ -11835,17 +11824,6 @@ formatdate parser function, with default format
!! end
-!! test
-Linked date with autoformatting disabled
-!! config
-wgUseDynamicDates=false
-!! input
-[[2009-03-24]]
-!! result
-2009-03-24
-
-!! end
-
!! test
Spacing of numbers in formatted dates
!! input
@@ -11855,17 +11833,6 @@ Spacing of numbers in formatted dates
!! end
-!! test
-Spacing of numbers in formatted dates (linked)
-!! config
-wgUseDynamicDates=true
-!! input
-[[January 15]]
-!! result
-January 15
-
-!! end
-
!! test
formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language
!! options
diff --git a/tests/phpunit/includes/ParserOptionsTest.php b/tests/phpunit/includes/ParserOptionsTest.php
deleted file mode 100644
index 5b2adaf9fd..0000000000
--- a/tests/phpunit/includes/ParserOptionsTest.php
+++ /dev/null
@@ -1,37 +0,0 @@
-setMwGlobals( array(
- 'wgContLang' => $langObj,
- 'wgUseDynamicDates' => true,
- ) );
-
- $this->popts = ParserOptions::newFromUserAndLang( $wgUser, $langObj );
- $this->pcache = ParserCache::singleton();
- }
-
- /**
- * ParserOptions::optionsHash was not giving consistent results when $wgUseDynamicDates was set
- * @group Database
- */
- function testGetParserCacheKeyWithDynamicDates() {
- $title = Title::newFromText( "Some test article" );
- $page = WikiPage::factory( $title );
-
- $pcacheKeyBefore = $this->pcache->getKey( $page, $this->popts );
- $this->assertNotNull( $this->popts->getDateFormat() );
-
- $pcacheKeyAfter = $this->pcache->getKey( $page, $this->popts );
- $this->assertEquals( $pcacheKeyBefore, $pcacheKeyAfter );
- }
-}
--
2.20.1