* @param $format null|string the format to use for deserialization. If not
* given, the model's default format is used.
*
+ * @throws MWException
* @return Content a Content object representing $text
*
* @throw MWException if $model or $format is not supported or if $text can
$rcid = 0, # FIXME: use everywhere!
$refreshCache = false, $unhide = false
) {
- $this->checkModelID( $context->getTitle()->getContentModel() );
-
$diffEngineClass = $this->getDiffEngineClass();
return new $diffEngineClass( $context, $old, $new, $rcid, $refreshCache, $unhide );
* @return Language the page's language
*/
public function getPageLanguage( Title $title, Content $content = null ) {
- global $wgContLang;
+ global $wgContLang, $wgLang;
+ $pageLang = $wgContLang;
if ( $title->getNamespace() == NS_MEDIAWIKI ) {
// Parse mediawiki messages with correct target language
list( /* $unused */, $lang ) = MessageCache::singleton()->figureMessage( $title->getText() );
- return wfGetLangObj( $lang );
+ $pageLang = wfGetLangObj( $lang );
}
- return $wgContLang;
+ wfRunHooks( 'PageContentLanguage', array( $title, &$pageLang, $wgLang ) );
+ return wfGetLangObj( $pageLang );
}
/**
* @return string An appropriate auto-summary, or an empty string.
*/
public function getAutosummary( Content $oldContent = null, Content $newContent = null, $flags ) {
- global $wgContLang;
-
// Decide what kind of auto-summary is needed.
// Redirect auto-summaries