$newid = $redirectArticle->insertOn( $dbw );
if ( $newid ) { // sanity
$redirectRevision = new Revision( array(
+ 'title' => $this, // for determining the default content model
'page' => $newid,
'comment' => $comment,
'content' => $redirectContent ) );
$content = $rev->getContent();
# Does the redirect point to the source?
# Or is it a broken self-redirect, usually caused by namespace collisions?
- $redirTitle = $content->getRedirectTarget();
+ $redirTitle = $content ? $content->getRedirectTarget() : null;
if ( $redirTitle ) {
if ( $redirTitle->getPrefixedDBkey() != $this->getPrefixedDBkey() &&
$contentHandler = ContentHandler::getForTitle( $this );
$pageLang = $contentHandler->getPageLanguage( $this );
- // Hook at the end because we don't want to override the above stuff
- wfRunHooks( 'PageContentLanguage', array( $this, &$pageLang, $wgLang ) );
return wfGetLangObj( $pageLang );
}