Go to the documentation of this file.
57 parent::__construct(
$name );
65 $this->category = $cat;
66 $this->maxTimestamp =
null;
67 $this->minTimestamp =
null;
75 $categoryStr = $this->
getRequest()->getText(
'category', $par );
81 if ( $cat && $cat->getNamespace() !==
NS_CATEGORY ) {
90 if ( !$this->category && $categoryStr ) {
92 $this->
getOutput()->addWikiMsg(
'randomincategory-invalidcategory',
96 } elseif ( !$this->category ) {
99 $submitText = $this->
msg(
'randomincategory-selectcategory-submit' )->text();
100 $submit =
Html::input(
'', $submitText,
'submit' );
102 $msg = $this->
msg(
'randomincategory-selectcategory' );
105 $msg->rawParams( $input, $submit )->parse()
114 if ( is_null(
$title ) ) {
116 $this->
getOutput()->addWikiMsg(
'randomincategory-nopages',
117 $this->category->getText() );
124 unset(
$query[
'category'] );
139 $offset = mt_rand( 0, $this->maxOffset );
141 if ( mt_rand( 0, 1 ) ) {
183 $op = $up ?
'>=' :
'<=';
184 $dir = $up ?
'ASC' :
'DESC';
185 if ( !$this->category instanceof
Title ) {
189 'tables' =>
array(
'categorylinks',
'page' ),
190 'fields' =>
array(
'page_title',
'page_namespace' ),
191 'conds' => array_merge(
array(
192 'cl_to' => $this->category->getDBKey(),
195 'ORDER BY' =>
'cl_timestamp ' .
$dir,
199 'join_conds' =>
array(
200 'page' =>
array(
'INNER JOIN',
'cl_from = page_id' )
207 $qi[
'conds'][] =
'cl_timestamp ' . $op .
' ' .
208 $dbr->addQuotes(
$dbr->timestamp( $minClTime ) );
220 if ( $rand ===
false ) {
223 if ( !$this->minTimestamp || !$this->maxTimestamp ) {
234 return intval( $ts );
249 'low' =>
'MIN( cl_timestamp )',
250 'high' =>
'MAX( cl_timestamp )'
253 'cl_to' => $this->category->getDBKey(),
287 return $res->fetchObject();
getPageTitle( $subpage=false)
Get a self-referential title object.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
getRandomTitle()
Choose a random title.
getOutput()
Get the OutputPage being used for this instance.
getTimestampOffset( $rand)
getMinAndMaxForCat(Title $category)
Get the lowest and highest timestamp for a category.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead $form
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
__construct( $name='RandomInCategory')
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
setCategory(Title $cat)
Set which category to use.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
when a variable name is used in a it is silently declared as a new masking the global
static input( $name, $value='', $type='text', $attribs=array())
Convenience function to produce an "<input>" element.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
presenting them properly to the user as errors is done by the caller $title
Allows to change the fields on the form that will be generated $name
msg()
Wrapper around wfMessage that sets the current context.
Parent class for all special pages.
getRequest()
Get the WebRequest being used for this instance.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Special page to direct the user to a random page.
Represents a title within MediaWiki.
wfRandom()
Get a random decimal value between 0 and 1, in a way not likely to give duplicate values for any real...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
if(count( $args)==0) $dir
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
getQueryInfo( $rand, $offset, $up)
selectRandomPageFromDB( $rand, $offset, $up, $fname=__METHOD__)
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
execute( $par)
Default execute method Checks user permissions, calls the function given in mFunction.