Index: trunk/phase3/includes/Article.php |
— | — | @@ -823,6 +823,9 @@ |
824 | 824 | 'href' => $this->getTitle()->getLocalURL() ) |
825 | 825 | ); |
826 | 826 | |
| 827 | + // Tell $wgOut the user arrived at this article through a redirect |
| 828 | + $wgOut->setRedirectedFrom( $this->mRedirectedFrom ); |
| 829 | + |
827 | 830 | return true; |
828 | 831 | } |
829 | 832 | } elseif ( $rdfrom ) { |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -223,6 +223,14 @@ |
224 | 224 | ); |
225 | 225 | |
226 | 226 | /** |
| 227 | + * If the current page was reached through a redirect, $mRedirectedFrom contains the Title |
| 228 | + * of the redirect. |
| 229 | + * |
| 230 | + * @var Title |
| 231 | + */ |
| 232 | + private $mRedirectedFrom = null; |
| 233 | + |
| 234 | + /** |
227 | 235 | * Constructor for OutputPage. This should not be called directly. |
228 | 236 | * Instead a new RequestContext should be created and it will implicitly create |
229 | 237 | * a OutputPage tied to that context. |
— | — | @@ -777,6 +785,15 @@ |
778 | 786 | } |
779 | 787 | |
780 | 788 | /** |
| 789 | + * Set $mRedirectedFrom, the Title of the page which redirected us to the current page. |
| 790 | + * |
| 791 | + * param @t Title |
| 792 | + */ |
| 793 | + public function setRedirectedFrom( $t ) { |
| 794 | + $this->mRedirectedFrom = $t; |
| 795 | + } |
| 796 | + |
| 797 | + /** |
781 | 798 | * "Page title" means the contents of \<h1\>. It is stored as a valid HTML fragment. |
782 | 799 | * This function allows good tags like \<sup\> in the \<h1\> tag, but not bad tags like \<script\>. |
783 | 800 | * This function automatically sets \<title\> to the same content as \<h1\> but with all tags removed. |
— | — | @@ -2781,6 +2798,9 @@ |
2782 | 2799 | if ( $title->isMainPage() ) { |
2783 | 2800 | $vars['wgIsMainPage'] = true; |
2784 | 2801 | } |
| 2802 | + if ( $this->mRedirectedFrom ) { |
| 2803 | + $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBKey(); |
| 2804 | + } |
2785 | 2805 | |
2786 | 2806 | // Allow extensions to add their custom variables to the mw.config map. |
2787 | 2807 | // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not |