revert previous stuff. break things :)
authorAntoine Musso <hashar@users.mediawiki.org>
Mon, 5 Sep 2005 20:03:19 +0000 (20:03 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Mon, 5 Sep 2005 20:03:19 +0000 (20:03 +0000)
includes/Article.php
includes/Title.php

index d8be97a..b8e38e1 100644 (file)
@@ -1227,7 +1227,17 @@ class Article {
                }
 
                $isminor = ( $minor && $wgUser->isLoggedIn() );
-               $redir = $this->isRedirect( $text ) ? 1 : 0;
+               if ( $this->isRedirect( $text ) ) {
+                       # Remove all content but redirect
+                       # This could be done by reconstructing the redirect from a title given by
+                       # Title::newFromRedirect(), but then we wouldn't know which synonym the user
+                       # wants to see
+                       if ( preg_match( "/^((" . $wgMwRedir->getBaseRegex() . ')[^\\n]+)/i', $text, $m ) ) {
+                               $redir = 1;
+                               $text = $m[1] . "\n";
+                       }
+               }
+               else { $redir = 0; }
 
                $text = $this->preSaveTransform( $text );
                $dbw =& wfGetDB( DB_MASTER );
index 3da010d..0721c1c 100644 (file)
@@ -267,7 +267,7 @@ class Title {
        function newFromRedirect( $text ) {
                global $wgMwRedir;
                $rt = NULL;
-               if ( $wgMwRedir->match( $text ) ) {
+               if ( $wgMwRedir->matchStart( $text ) ) {
                        if ( preg_match( '/\[{2}(.*?)(?:\||\]{2})/', $text, $m ) ) {
                                # categories are escaped using : for example one can enter:
                                # #REDIRECT [[:Category:Music]]. Need to remove it.