(bug 29472) kill $wgUseDynamicDates
authorMatmaRex <matma.rex@gmail.com>
Wed, 6 Feb 2013 16:35:46 +0000 (17:35 +0100)
committerMatmaRex <matma.rex@gmail.com>
Wed, 6 Feb 2013 16:38:05 +0000 (17:38 +0100)
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
includes/DefaultSettings.php
includes/User.php
includes/parser/Parser.php
includes/parser/ParserOptions.php
tests/parser/parserTests.txt
tests/phpunit/includes/ParserOptionsTest.php [deleted file]

index 99ac1ec..36e660e 100644 (file)
@@ -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
index 68c4542..369d941 100644 (file)
@@ -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.
index 309d755..a73414c 100644 (file)
@@ -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' );
index 876e3b7..d434e30 100644 (file)
@@ -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 );
index 064182e..4774de4 100644 (file)
  */
 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' );
        }
 
        /**
index c25f158..1f84aae 100644 (file)
@@ -11806,17 +11806,6 @@ Multibyte character in padright
 </p>
 !! end
 
-!! test
-Formatted date
-!! config
-wgUseDynamicDates=1
-!! input
-[[2009-03-24]]
-!! result
-<p><span class="mw-formatted-date" title="2009-03-24"><a href="/index.php?title=2009&amp;action=edit&amp;redlink=1" class="new" title="2009 (page does not exist)">2009</a>-<a href="/index.php?title=March_24&amp;action=edit&amp;redlink=1" class="new" title="March 24 (page does not exist)">03-24</a></span>
-</p>
-!!end
-
 !!test
 formatdate parser function
 !!input
@@ -11835,17 +11824,6 @@ formatdate parser function, with default format
 </p>
 !! end
 
-!! test
-Linked date with autoformatting disabled
-!! config
-wgUseDynamicDates=false
-!! input
-[[2009-03-24]]
-!! result
-<p><a href="/index.php?title=2009-03-24&amp;action=edit&amp;redlink=1" class="new" title="2009-03-24 (page does not exist)">2009-03-24</a>
-</p>
-!! end
-
 !! test
 Spacing of numbers in formatted dates
 !! input
@@ -11855,17 +11833,6 @@ Spacing of numbers in formatted dates
 </p>
 !! end
 
-!! test
-Spacing of numbers in formatted dates (linked)
-!! config
-wgUseDynamicDates=true
-!! input
-[[January 15]]
-!! result
-<p><span class="mw-formatted-date" title="01-15"><a href="/index.php?title=January_15&amp;action=edit&amp;redlink=1" class="new" title="January 15 (page does not exist)">January 15</a></span>
-</p>
-!! 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 (file)
index 5b2adaf..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-class ParserOptionsTest extends MediaWikiTestCase {
-
-       private $popts;
-       private $pcache;
-
-       protected function setUp() {
-               global $wgLanguageCode, $wgUser;
-               parent::setUp();
-
-               $langObj = Language::factory( $wgLanguageCode );
-
-               $this->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 );
-       }
-}