Manual:Extension support/1.15/ExtDowngrading

$Language::getNamespaceAliases()

edit

Language::getNamespaceAliases() [1.16] is no longer available. The acceptable fallback is to use the global $wgNamespaceAliases.

global $wgNamespaceAliases;
$nss = method_exists($lang,'getNamespaceAliases') ? $lang->getNamespaceAliases() : $wgNamespaceAliases;

ContextSource::getTitle()

edit

ContextSource::getTitle() [1.16] is no longer available (on $out variables for example). The acceptable fallback is to use the global $wgTitle. In some cases where your ContextSource is not the global page being displayed this will not be acceptable, at which point you may need to cut functionality or not support pre 1.16 wiki's. This function was often used on $out parameters of hooks, which you can make compatible using the following:

global $wgTitle;
$title = method_exists($out,'getTitle') ? $out->getTitle() : $wgTitle;

MWHttpRequest and HttpRequest

edit

The classes MWHttpRequest and HttpRequest were introduced in 1.16 and 1.17, but do not exist prior. The recommended fallback is Http::request however at the loss of some functionality (e.g. setting a custom user agent).

if (class_exists('MWHttpRequest') || class_exists('HttpRequest')) {
  // MWHttpRequest is 1.17+
  // HttpRequest is 1.16
  $httpRequest = class_exists('MWHttpRequest') ? 'MWHttpRequest' : 'HttpRequest';
  ...        
} else {
  // Http::request is pre 1.16     
  $status = Http::request('GET',$url);
}