Merge "Paranoia, escape image alignment parameters before outputting."
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index aa8aee5..d215e9f 100644 (file)
@@ -1308,11 +1308,11 @@ function wfGetLangObj( $langcode = false ) {
                return $langcode;
        }
 
-       global $wgContLang, $wgLanguageCode;
+       global $wgLanguageCode;
        if ( $langcode === true || $langcode === $wgLanguageCode ) {
                # $langcode is the language code of the wikis content language object.
                # or it is a boolean and value is true
-               return $wgContLang;
+               return MediaWikiServices::getInstance()->getContentLanguage();
        }
 
        global $wgLang;
@@ -1330,7 +1330,7 @@ function wfGetLangObj( $langcode = false ) {
 
        # $langcode is a string, but not a valid language code; use content language.
        wfDebug( "Invalid language code passed to wfGetLangObj, falling back to content language.\n" );
-       return $wgContLang;
+       return MediaWikiServices::getInstance()->getContentLanguage();
 }
 
 /**
@@ -2529,6 +2529,8 @@ function wfUsePHP( $req_ver ) {
 function wfUseMW( $req_ver ) {
        global $wgVersion;
 
+       wfDeprecated( __FUNCTION__, '1.26' );
+
        if ( version_compare( $wgVersion, (string)$req_ver, '<' ) ) {
                throw new MWException( "MediaWiki $req_ver required--this is only $wgVersion" );
        }
@@ -2672,28 +2674,6 @@ function wfGetPrecompiledData( $name ) {
        return false;
 }
 
-/**
- * @since 1.32
- * @param string[] $data Array with string keys/values to export
- * @param string $header
- * @return string PHP code
- */
-function wfMakeStaticArrayFile( array $data, $header = 'Automatically generated' ) {
-       $format = "\t%s => %s,\n";
-       $code = "<?php\n"
-               . "// " . implode( "\n// ", explode( "\n", $header ) ) . "\n"
-               . "return [\n";
-       foreach ( $data as $key => $value ) {
-               $code .= sprintf(
-                       $format,
-                       var_export( $key, true ),
-                       var_export( $value, true )
-               );
-       }
-       $code .= "];\n";
-       return $code;
-}
-
 /**
  * Make a cache key for the local wiki.
  *
@@ -3117,6 +3097,7 @@ function wfBCP47( $code ) {
 /**
  * Get a specific cache object.
  *
+ * @deprecated since 1.32, use ObjectCache::getInstance() instead
  * @param int|string $cacheType A CACHE_* constants, or other key in $wgObjectCaches
  * @return BagOStuff
  */
@@ -3127,11 +3108,11 @@ function wfGetCache( $cacheType ) {
 /**
  * Get the main cache object
  *
+ * @deprecated since 1.32, use ObjectCache::getLocalClusterInstance() instead
  * @return BagOStuff
  */
 function wfGetMainCache() {
-       global $wgMainCacheType;
-       return ObjectCache::getInstance( $wgMainCacheType );
+       return ObjectCache::getLocalClusterInstance();
 }
 
 /**