Merge "Add a test for named vs. positional parameter whitespace stripping"
[lhc/web/wiklou.git] / includes / Title.php
index cb0a13f..c1e2ccf 100644 (file)
@@ -387,6 +387,8 @@ class Title {
         * @deprecated since 1.21, use Content::getRedirectTarget instead.
         */
        public static function newFromRedirect( $text ) {
+               ContentHandler::deprecated( __METHOD__, '1.21' );
+
                $content = ContentHandler::makeContent( $text, null, CONTENT_MODEL_WIKITEXT );
                return $content->getRedirectTarget();
        }
@@ -402,6 +404,8 @@ class Title {
         * @deprecated since 1.21, use Content::getUltimateRedirectTarget instead.
         */
        public static function newFromRedirectRecurse( $text ) {
+               ContentHandler::deprecated( __METHOD__, '1.21' );
+
                $content = ContentHandler::makeContent( $text, null, CONTENT_MODEL_WIKITEXT );
                return $content->getUltimateRedirectTarget();
        }
@@ -417,6 +421,8 @@ class Title {
         * @deprecated since 1.21, use Content::getRedirectChain instead.
         */
        public static function newFromRedirectArray( $text ) {
+               ContentHandler::deprecated( __METHOD__, '1.21' );
+
                $content = ContentHandler::makeContent( $text, null, CONTENT_MODEL_WIKITEXT );
                return $content->getRedirectChain();
        }
@@ -1363,6 +1369,8 @@ class Title {
         *
         * @see self::getLocalURL
         * @see wfExpandUrl
+        * @param $query
+        * @param $query2 bool
         * @param $proto Protocol type to use in URL
         * @return String the URL
         */
@@ -1390,7 +1398,7 @@ class Title {
         *
 
         * @param $query string|array an optional query string,
-        *   not used for interwiki     links. Can be specified as an associative array as well,
+        *   not used for interwiki links. Can be specified as an associative array as well,
         *   e.g., array( 'action' => 'edit' ) (keys and values will be URL-escaped).
         *   Some query patterns will trigger various shorturl path replacements.
         * @param $query2 Mixed: An optional secondary query array. This one MUST
@@ -1489,6 +1497,8 @@ class Title {
         *
         * See getLocalURL for the arguments.
         *
+        * @param $query
+        * @param $query2 bool
         * @param $proto Protocol to use; setting this will cause a full URL to be used
         * @see self::getLocalURL
         * @return String the URL
@@ -2916,10 +2926,12 @@ class Title {
 
                $linkCache = LinkCache::singleton();
                $cached = $linkCache->getGoodLinkFieldObj( $this, 'redirect' );
-               if ( $cached === null ) { 
+               if ( $cached === null ) {
                        // TODO: check the assumption that the cache actually knows about this title
                        // and handle this, such as get the title from the database.
                        // See https://bugzilla.wikimedia.org/show_bug.cgi?id=37209
+                       wfDebug( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() );
+                       wfDebug( wfBacktrace() );
                }
 
                $this->mRedirect = (bool)$cached;
@@ -2947,7 +2959,8 @@ class Title {
                if ( $cached === null ) { # check the assumption that the cache actually knows about this title
                        # XXX: this does apparently happen, see https://bugzilla.wikimedia.org/show_bug.cgi?id=37209
                        #      as a stop gap, perhaps log this, but don't throw an exception?
-                       throw new MWException( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() );
+                       wfDebug( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() );
+                       wfDebug( wfBacktrace() );
                }
 
                $this->mLength = intval( $cached );
@@ -3803,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 ) );
@@ -4461,7 +4475,7 @@ class Title {
 
        /**
         * Update page_touched timestamps and send squid purge messages for
-        * pages linking to this title. May be sent to the job queue depending
+        * pages linking to this title. May be sent to the job queue depending
         * on the number of links. Typically called on create and delete.
         */
        public function touchLinks() {
@@ -4688,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 );
        }