Merge "Allow tests to run with a non-writable source tree"
[lhc/web/wiklou.git] / includes / parser / DateFormatter.php
index 2aefc03..de02861 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup Parser
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * Date formatter, recognises dates in plain text and formats them according to user preferences.
  * @todo preferences, OutputPage
@@ -131,9 +133,9 @@ class DateFormatter {
         * @return DateFormatter
         */
        public static function getInstance( Language $lang = null ) {
-               global $wgContLang, $wgMainCacheType;
+               global $wgMainCacheType;
 
-               $lang = $lang ?: $wgContLang;
+               $lang = $lang ?? MediaWikiServices::getInstance()->getContentLanguage();
                $cache = ObjectCache::getLocalServerInstance( $wgMainCacheType );
 
                static $dateFormatter = false;