+ function initializeArticle ( &$title , $action ) {
+ global $wgRequest ;
+ if ( NS_MEDIA == $title->getNamespace() ) {
+ $title = Title::makeTitle( NS_IMAGE, $title->getDBkey() );
+ }
+
+ $ns = $title->getNamespace();
+
+ // Namespace might change when using redirects
+ $article = new Article( $title );
+ if($action == 'view' && !$wgRequest->getVal( 'oldid' ) ) {
+ $rTitle = Title::newFromRedirect( $article->fetchContent() );
+ if($rTitle) {
+ # Reload from the page pointed to later
+ $article->mContentLoaded = false;
+ $ns = $rTitle->getNamespace();
+ }
+ }
+