Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F8558
rd.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 22 2014, 12:03 AM
2014-11-22 00:03:19 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
rd.patch
View Options
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
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8077
Default Alt Text
rd.patch (1 KB)
Attached To
Mode
T34230: Provide a JavaScript variable for the "redirected from" page title
Attached
Detach File
Event Timeline
Log In to Comment