2006-04-25 01:01:10 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Special page to direct the user to a random redirect page (minus the second redirect)
|
|
|
|
|
*
|
Some small doc tweaks to reduce Doxygen warnings, namely:
* @link. You might think @link would surely mean "here comes a web URL" ... but @link is a valid command
in Doxygen, which means an entirely different kind of link (an internal link to somewhere, so that you can separate
documentation and implementation). The result is a mess, and the best solution I can see is to use "@see" instead of "@link".
* Warning: argument `nourl' of command @param is not found in the argument list of Linker::makeMediaLinkObj($title,$text='')
* Moving few class descriptions to right above classes, and/or formatting into Javadoc style.
* "@addtogroup Special Pages" --> "@addtogroup SpecialPage" so that all special pages have the same @addtogroup tag.
* @fixme --> @todo (must have missed these before)
* "@param $specialPage @see" remove the "@" in the "@see" to stop warning.
* @throws wants type, then a brief description, to stop warning.
This last one is for PHPdocumentor only, but it fixes something for PHPDocumentor, and should be neutral for Doxygen:
* WARNING in includes/api/ApiFormatYaml_spyc.php on line 860: docblock template never terminated with /**#@-*/
2007-04-18 09:50:10 +00:00
|
|
|
* @addtogroup SpecialPage
|
2007-04-19 10:19:27 +00:00
|
|
|
* @author Rob Church <robchur@gmail.com>, Ilmari Karonen
|
2007-04-04 05:22:37 +00:00
|
|
|
* @license GNU General Public Licence 2.0 or later
|
2006-04-25 01:01:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Main execution point
|
|
|
|
|
* @param $par Namespace to select the redirect from
|
|
|
|
|
*/
|
2007-04-19 10:19:27 +00:00
|
|
|
function wfSpecialRandomredirect( $par = null ) {
|
|
|
|
|
global $wgOut, $wgContLang;
|
2006-04-25 01:01:10 +00:00
|
|
|
|
2007-04-19 10:19:27 +00:00
|
|
|
$rnd = new RandomPage();
|
|
|
|
|
$rnd->setNamespace( $wgContLang->getNsIndex( $par ) );
|
|
|
|
|
$rnd->setRedirect( true );
|
2006-04-25 01:01:10 +00:00
|
|
|
|
2007-04-19 10:19:27 +00:00
|
|
|
$title = $rnd->getRandomTitle();
|
2006-04-25 01:01:10 +00:00
|
|
|
|
2007-04-19 10:19:27 +00:00
|
|
|
if( is_null( $title ) ) {
|
|
|
|
|
$wgOut->addWikiText( wfMsg( 'randomredirect-nopages' ) );
|
|
|
|
|
return;
|
|
|
|
|
}
|
2006-04-25 01:01:10 +00:00
|
|
|
|
|
|
|
|
$wgOut->reportTime();
|
|
|
|
|
$wgOut->redirect( $title->getFullUrl( 'redirect=no' ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|