Merge "Fix typo (sentances => sentences)"
[lhc/web/wiklou.git] / includes / Title.php
index 00fdc3a..9e42a1b 100644 (file)
@@ -908,7 +908,7 @@ class Title {
 
        /**
         * Is this the mainpage?
-        * @note Title::newFromText seams to be sufficiently optimized by the title
+        * @note Title::newFromText seems to be sufficiently optimized by the title
         * cache that we don't need to over-optimize by doing direct comparisons and
         * acidentally creating new bugs where $title->equals( Title::newFromText() )
         * ends up reporting something differently than $title->isMainPage();
@@ -3816,6 +3816,7 @@ class Title {
                        $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 ) );
@@ -3980,7 +3981,7 @@ class Title {
                $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() &&
@@ -4701,8 +4702,6 @@ class Title {
                $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 );
        }