r12588 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12587‎ | r12588 | r12589 >
Date:22:13, 10 January 2006
Author:magnus_manske
Status:old
Tags:
Comment:
fixed redirect-to-image bug
Modified paths:
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Wiki.php
@@ -1,13 +1,23 @@
22 <?php
 3+/**
 4+ * MediaWiki is the to-be base class for this whole project
 5+*/
36
 7+
48 class MediaWiki {
59
610 var $params = array();
7 -
 11+
 12+ /**
 13+ * Stores parameters (to avoid using globals)
 14+ */
815 function setVal( $key, &$value ) {
916 $this->param[strtolower( $key )] = $value;
1017 }
11 -
 18+
 19+ /**
 20+ * Retrieves parameters
 21+ */
1222 function getVal( $key, $default = "" ) {
1323 $key = strtolower( $key );
1424 if( isset( $this->params[$key] ) ) {
@@ -16,7 +26,11 @@
1727 return $default;
1828 }
1929
20 - function initializeArticle( &$title, $request, $action ) {
 30+ /**
 31+ * Creates the article to be known as $wgArticle
 32+ */
 33+ function initializeArticle( &$title, &$request, $action ) {
 34+ // Fix Media namespace
2135 if( NS_MEDIA == $title->getNamespace() ) {
2236 $title = Title::makeTitle( NS_IMAGE, $title->getDBkey() );
2337 }
@@ -31,22 +45,31 @@
3246 # Reload from the page pointed to later
3347 $article->mContentLoaded = false;
3448 $ns = $rTitle->getNamespace();
 49+ $wasRedirected = true;
3550 }
3651 }
3752
3853 // Categories and images are handled by a different class
3954 if( $ns == NS_IMAGE ) {
 55+ $b4 = $title->getPrefixedText();
4056 unset($article);
4157 require_once( 'includes/ImagePage.php' );
42 - return new ImagePage( $title );
 58+ $article = new ImagePage( $title );
 59+ if( isset( $wasRedirected ) ) {
 60+ $article->mTitle = $rTitle;
 61+ $article->mRedirectedFrom = $b4;
 62+ }
4363 } elseif( $ns == NS_CATEGORY ) {
4464 unset($article);
4565 require_once( 'includes/CategoryPage.php' );
46 - return new CategoryPage( $title );
 66+ $article = new CategoryPage( $title );
4767 }
4868 return $article;
4969 }
5070
 71+ /**
 72+ * Performs any of a wide range of passed actions
 73+ */
5174 function performAction( $action, &$output, &$article, &$title, &$user, &$request ) {
5275 switch( $action ) {
5376 case 'view':

Status & tagging log