4 * Special page to direct the user to a random redirect page (minus the second redirect)
6 * @addtogroup SpecialPage
7 * @author Rob Church <robchur@gmail.com>, Ilmari Karonen
8 * @license GNU General Public Licence 2.0 or later
12 * Main execution point
13 * @param $par Namespace to select the redirect from
15 function wfSpecialRandomredirect( $par = null ) {
16 global $wgOut, $wgContLang;
18 $rnd = new RandomPage();
19 $rnd->setNamespace( $wgContLang->getNsIndex( $par ) );
20 $rnd->setRedirect( true );
22 $title = $rnd->getRandomTitle();
24 if( is_null( $title ) ) {
25 $wgOut->addWikiText( wfMsg( 'randomredirect-nopages' ) );
30 $wgOut->redirect( $title->getFullUrl( 'redirect=no' ) );