r33375 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r33374‎ | r33375 | r33376 >
Date:17:32, 15 April 2008
Author:ialex
Status:old
Tags:
Comment:
(bug 13752) Section redirects now works again
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -71,7 +71,7 @@
7272 return $this->mRedirectTarget;
7373
7474 # Query the redirect table
75 - $dbr = wfGetDb(DB_SLAVE);
 75+ $dbr = wfGetDB(DB_SLAVE);
7676 $res = $dbr->select('redirect',
7777 array('rd_namespace', 'rd_title'),
7878 array('rd_from' => $this->getID()),
@@ -95,7 +95,7 @@
9696 $retval = Title::newFromRedirect($this->getContent());
9797 if(!$retval)
9898 return null;
99 - $dbw = wfGetDb(DB_MASTER);
 99+ $dbw = wfGetDB(DB_MASTER);
100100 $dbw->insert('redirect', array(
101101 'rd_from' => $this->getID(),
102102 'rd_namespace' => $retval->getNamespace(),
@@ -105,10 +105,18 @@
106106 }
107107
108108 /**
 109+ * Get the Title object this page redirects to
 110+ *
 111+ * @param bool $getFragment should the fragment be set on the title
109112 * @return mixed false, Title of in-wiki target, or string with URL
110113 */
111 - function followRedirect() {
112 - $rt = $this->getRedirectTarget();
 114+ function followRedirect( $getFragment = false ) {
 115+ if( $getFragment )
 116+ // We'll need to use the content of this page, as Article::getRedirectTarget()
 117+ // now loads the data from redirect table, wich doesn't store the fragment
 118+ $rt = Title::newFromRedirect( $this->getContent() );
 119+ else
 120+ $rt = $this->getRedirectTarget();
113121
114122 # process if title object is valid and not special:userlogout
115123 if( $rt ) {
Index: trunk/phase3/includes/Wiki.php
@@ -270,7 +270,6 @@
271271 *
272272 * @param Title $title
273273 * @param Request $request
274 - * @param string $action
275274 * @return mixed an Article, or a string to redirect to another URL
276275 */
277276 function initializeArticle( &$title, $request ) {
@@ -289,7 +288,7 @@
290289
291290 // Follow redirects only for... redirects
292291 if( $article->mIsRedirect ) {
293 - $target = $article->followRedirect();
 292+ $target = $article->followRedirect( true /* getFragment */ );
294293 if( is_string( $target ) ) {
295294 if( !$this->getVal( 'DisableHardRedirects' ) ) {
296295 // we'll need to redirect
Index: trunk/phase3/RELEASE-NOTES
@@ -183,8 +183,8 @@
184184 * (bug 13736) Don't show MediaWiki:Anontalkpagetext on non-existant IP addresses
185185 * (bug 13728) Don't trim initial whitespace during section edits
186186 * (bug 13727) Don't delete log entries from recentchanges on page deletion
 187+* (bug 13752) Section redirects now works again
187188
188 -
189189 === API changes in 1.13 ===
190190
191191 * Fixing main page display in meta=siteinfo

Follow-up revisions

RevisionCommit summaryAuthorDate
r33381Revert some chunks of r33133 and r33375:...brion18:11, 15 April 2008

Status & tagging log