Go to the documentation of this file.
36 parent::__construct(
$query, $moduleName,
'rd' );
44 $this->
run( $resultPageSet );
53 $emptyString = $db->addQuotes(
'' );
56 $titles = $pageSet->getGoodTitles() + $pageSet->getMissingTitles();
58 if ( !is_null(
$params[
'continue'] ) ) {
59 $cont = explode(
'|',
$params[
'continue'] );
61 $rd_namespace = (int)$cont[0];
63 $rd_title = $db->addQuotes( $cont[1] );
64 $rd_from = (int)$cont[2];
67 "rd_namespace > $rd_namespace OR " .
68 "(rd_namespace = $rd_namespace AND " .
69 "(rd_title > $rd_title OR " .
70 "(rd_title = $rd_title AND " .
71 "rd_from >= $rd_from)))"
75 $titles = array_filter(
$titles,
function (
$t ) use ( $rd_namespace, $rd_title ) {
76 $ns =
$t->getNamespace();
77 return ( $ns > $rd_namespace ||
78 $ns == $rd_namespace &&
$t->getDBKey() >= $rd_title
94 if ( is_null( $resultPageSet ) ) {
95 $prop = array_flip(
$params[
'prop'] );
96 $fld_pageid = isset( $prop[
'pageid'] );
97 $fld_title = isset( $prop[
'title'] );
98 $fld_fragment = isset( $prop[
'fragment'] );
100 $this->
addFieldsIf(
'rd_fragment', $fld_fragment );
109 "rd_interwiki = $emptyString OR rd_interwiki IS NULL",
110 $lb->constructSet(
'rd', $db ),
113 if (
$params[
'show'] !==
null ) {
114 $show = array_flip(
$params[
'show'] );
115 if ( isset( $show[
'fragment'] ) && isset( $show[
'!fragment'] ) ) {
118 $this->
addWhereIf(
"rd_fragment != $emptyString", isset( $show[
'fragment'] ) );
119 $this->
addWhereIf(
"rd_fragment = $emptyString OR rd_fragment IS NULL", isset( $show[
'!fragment'] ) );
122 $map = $pageSet->getAllTitlesByNamespace();
126 if ( count( $map ) > 1 ) {
127 $sortby[] =
'rd_namespace';
130 foreach ( $map
as $nsTitles ) {
132 $key =
key( $nsTitles );
133 if ( $theTitle ===
null ) {
136 if ( count( $nsTitles ) > 1 || $key !== $theTitle ) {
137 $sortby[] =
'rd_title';
141 $sortby[] =
'rd_from';
148 if ( is_null( $resultPageSet ) ) {
150 foreach (
$res as $row ) {
155 "$row->rd_namespace|$row->rd_title|$row->rd_from"
160 # Get the ID of the current page
161 $id = $map[$row->rd_namespace][$row->rd_title];
165 $vals[
'pageid'] = $row->rd_from;
172 if ( $fld_fragment && $row->rd_fragment !==
null && $row->rd_fragment !==
'' ) {
173 $vals[
'fragment'] = $row->rd_fragment;
178 "$row->rd_namespace|$row->rd_title|$row->rd_from"
186 foreach (
$res as $row ) {
191 "$row->rd_namespace|$row->rd_title|$row->rd_from"
197 $resultPageSet->populateFromTitles(
$titles );
218 'fragment',
'!fragment',
236 'Which properties to get:',
237 ' pageid - Page id of each redirect',
238 ' title - Title of each redirect',
239 ' fragment - Fragment of each redirect, if any',
242 'Show only items that meet this criteria.',
243 ' fragment - Only show redirects with a fragment',
244 ' !fragment - Only show redirects without a fragment',
246 'limit' =>
'How many redirects to return',
247 'continue' =>
'When more results are available, use this to continue',
252 return 'Returns all redirects to the given page(s).';
257 'api.php?action=query&prop=redirects&titles=Main%20Page'
258 =>
'Get a list of redirects to the [[Main Page]]',
259 'api.php?action=query&generator=redirects&titles=Main%20Page&prop=info'
260 =>
'Get information about all redirects to the [[Main Page]]',
265 return 'https://www.mediawiki.org/wiki/API:Properties#redirects_.2F_rd';
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
addFields( $value)
Add a set of fields to select to the internal array.
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
Class representing a list of titles The execute() method checks them all for existence and adds them ...
__construct( $query, $moduleName)
getParamDescription()
Returns an array of parameter descriptions.
dieUsageMsg( $error)
Output the error message related to a certain array.
select( $method, $extraQuery=array())
Execute a SELECT query based on the values in the internal arrays.
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
run(ApiPageSet $resultPageSet=null)
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
This class contains a list of pages that the client has requested.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database key
setContinueEnumParameter( $paramName, $paramValue)
Overrides base in case of generator & smart continue to notify ApiQueryMain instead of adding them to...
if( $wgAPIRequestLog) $lb
getPageSet()
Get the PageSet object to work on.
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getDescription()
Returns the description string for this module.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getDB()
Get the Query database connection (read-only)
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
getExamples()
Returns usage examples for this module.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
dieContinueUsageIf( $condition)
Die with the $prefix.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getCacheMode( $params)
Get the cache mode for the data generated by this module.
This query lists redirects to the given pages.
executeGenerator( $resultPageSet)
Execute this module as a generator.
addWhere( $value)
Add a set of WHERE clauses to the internal array.
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
addPageSubItem( $pageId, $item, $elemname=null)
Same as addPageSubItems(), but one element of $data at a time.
addWhereIf( $value, $condition)
Same as addWhere(), but add the WHERE clauses only if a condition is met.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.