(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
This commit is contained in:
MatmaRex 2013-02-06 17:35:46 +01:00
parent 9846e2558c
commit 1b71bc5256
7 changed files with 5 additions and 99 deletions

View 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

View 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.

View 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' );

View 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 );

View file

@ -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' );
}
/**

View 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

View file

@ -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 );
}
}