bug 20519 Redirects in the stable version showed up wrong
[lhc/web/wiklou.git] / includes / Wiki.php
index 5622545..6ecbc39 100644 (file)
@@ -54,6 +54,8 @@ class MediaWiki {
                
                $output->setTitle( $title );
                
+               wfRunHooks( 'BeforeInitialize', array( &$title, &$article, &$output, &$user, $request, $this ) );
+               
                if( !$this->preliminaryChecks( $title, $output, $request ) ) {
                        wfProfileOut( __METHOD__ );
                        return;
@@ -186,7 +188,9 @@ class MediaWiki {
                        if( $rdfrom = $request->getVal( 'rdfrom' ) ) {
                                $url = $title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) );
                        } else {
-                               $url = $title->getFullURL();
+                               $query = $request->getValues();
+                               unset( $query['title'] );
+                               $url = $title->getFullURL( $query );
                        }
                        /* Check for a redirect loop */
                        if( !preg_match( '/^' . preg_quote( $this->getVal('Server'), '/' ) . '/', $url ) && $title->isLocal() ) {
@@ -306,8 +310,9 @@ class MediaWiki {
                        wfRunHooks( 'InitializeArticleMaybeRedirect', 
                                array(&$title,&$request,&$ignoreRedirect,&$target,&$article) );
 
-                       // Follow redirects only for... redirects
-                       if( !$ignoreRedirect && $article->isRedirect() ) {
+                       // Follow redirects only for... redirects.
+                       // If $target is set, then a hook wanted to redirect.
+                       if( !$ignoreRedirect && ($target || $article->isRedirect()) ) {
                                # Is the target already set by an extension?
                                $target = $target ? $target : $article->followRedirect();
                                if( is_string( $target ) ) {
@@ -528,9 +533,14 @@ class MediaWiki {
                                if( $request->getFullRequestURL() == $title->getInternalURL( 'action=history' ) ) {
                                        $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
                                }
-                               $history = new PageHistory( $article );
+                               $history = new HistoryPage( $article );
                                $history->history();
                                break;
+                       case 'revisiondelete':
+                               # For show/hide submission from history page
+                               $special = SpecialPage::getPage( 'Revisiondelete' );
+                               $special->execute( '' );
+                               break;
                        default:
                                if( wfRunHooks( 'UnknownAction', array( $action, $article ) ) ) {
                                        $output->showErrorPage( 'nosuchaction', 'nosuchactiontext' );