setHeaders(); $target = Title::newFromText( $par ); // Disallow special pages as a precaution against // possible redirect loops. if ( !$target || $target->isSpecialPage() ) { $this->getOutput()->setStatusCode( 404 ); $this->getOutput()->addWikiMsg( 'gotointerwiki-invalid' ); return; } $url = $target->getFullURL(); if ( !$target->isExternal() || $target->isLocal() ) { // Either a normal page, or a local interwiki. // just redirect. $this->getOutput()->redirect( $url, '301' ); } else { $this->getOutput()->addWikiMsg( 'gotointerwiki-external', $url, $target->getFullText() ); } } /** * @return bool */ public function requiresWrite() { return false; } /** * @return String */ protected function getGroupName() { return 'redirects'; } }