}
return $default;
}
+
+ /**
+ * Initialize the object to be known as $wgArticle for special cases
+ */
+ function initializeSpecialCases ( &$title ) {
+ if ( NS_SPECIAL == $title->getNamespace() ) {
+ # actions that need to be made when we have a special pages
+ SpecialPage::executePath( $title );
+ } else {
+ /* No match to special cases */
+ return false;
+ }
+ /* Did match a special case */
+ return true;
+ }
+ /**
+ * Initialize the object to be known as $wgArticle for "standard" actions
+ */
function initializeArticle( &$title, $request, $action ) {
if( NS_MEDIA == $title->getNamespace() ) {
$title = Title::makeTitle( NS_IMAGE, $title->getDBkey() );
$ns = $title->getNamespace();
- // Namespace might change when using redirects
+ /* Namespace might change when using redirects */
$article = new Article( $title );
if( $action == 'view' && !$request->getVal( 'oldid' ) ) {
$rTitle = Title::newFromRedirect( $article->fetchContent() );
}
}
- // Categories and images are handled by a different class
+ /* Categories and images are handled by a different class */
if( $ns == NS_IMAGE ) {
$b4 = $title->getPrefixedText();
unset( $article );
return $article;
}
+ /**
+ * Perform one of the "standard" actions
+ */
function performAction( $action, &$output, &$article, &$title, &$user, &$request ) {
switch( $action ) {
case 'view':
wfProfileIn( 'main-action' );
+require_once( "includes/Wiki.php" ) ;
+$mediaWiki = new MediaWiki() ;
+
if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
require_once( 'includes/SpecialSearch.php' );
$wgTitle = Title::makeTitle( NS_SPECIAL, 'Search' );
/* redirect to canonical url, make it a 301 to allow caching */
$wgOut->setSquidMaxage( 1200 );
$wgOut->redirect( $wgTitle->getFullURL(), '301');
-} else if ( NS_SPECIAL == $wgTitle->getNamespace() ) {
- # actions that need to be made when we have a special pages
- SpecialPage::executePath( $wgTitle );
+} else if ( $mediaWiki->initializeSpecialCases( $wgTitle ) ) {
+ # Do nothing, everything was already done by $mediaWiki
+
} else {
- require_once( "includes/Wiki.php" ) ;
- $mediaWiki = new MediaWiki() ;
$wgArticle =& $mediaWiki->initializeArticle( $wgTitle, $wgRequest, $action );