Page MenuHomePhabricator
Authored By
bzimport
Nov 22 2014, 12:03 AM
Size
1 KB
Referenced Files
None
Subscribers
None

rd.patch

Index: includes/Article.php
===================================================================
--- includes/Article.php (revision 104428)
+++ includes/Article.php (working copy)
@@ -823,6 +823,9 @@
'href' => $this->getTitle()->getLocalURL() )
);
+ // Tell $wgOut the user arrived at this article through a redirect
+ $wgOut->setRedirectedFrom( $this->mRedirectedFrom );
+
return true;
}
} elseif ( $rdfrom ) {
Index: includes/OutputPage.php
===================================================================
--- includes/OutputPage.php (revision 104428)
+++ includes/OutputPage.php (working copy)
@@ -223,6 +223,14 @@
);
/**
+ * If the current page was reached through a redirect, $mRedirectedFrom contains the Title
+ * of the redirect.
+ *
+ * @var Title
+ */
+ private $mRedirectedFrom = null;
+
+ /**
* Constructor for OutputPage. This should not be called directly.
* Instead a new RequestContext should be created and it will implicitly create
* a OutputPage tied to that context.
@@ -777,6 +785,15 @@
}
/**
+ * Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
+ *
+ * param @t Title
+ */
+ public function setRedirectedFrom( $t ) {
+ $this->mRedirectedFrom = $t;
+ }
+
+ /**
* "Page title" means the contents of \<h1\>. It is stored as a valid HTML fragment.
* This function allows good tags like \<sup\> in the \<h1\> tag, but not bad tags like \<script\>.
* This function automatically sets \<title\> to the same content as \<h1\> but with all tags removed.
@@ -2755,6 +2772,9 @@
if ( $title->isMainPage() ) {
$vars['wgIsMainPage'] = true;
}
+ if ( $this->mRedirectedFrom ) {
+ $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBKey();
+ }
// Allow extensions to add their custom variables to the mw.config map.
// Use the 'ResourceLoaderGetConfigVars' hook if the variable is not

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8077
Default Alt Text
rd.patch (1 KB)

Event Timeline