42 'linktable' =>
'redirect',
46 'showredirects' =>
false,
55 'linktable' =>
'pagelinks',
56 'from_namespace' =>
true,
57 'showredirects' =>
true,
62 'linktable' =>
'templatelinks',
63 'from_namespace' =>
true,
64 'showredirects' =>
true,
69 'linktable' =>
'imagelinks',
70 'from_namespace' =>
true,
72 'exampletitle' =>
'File:Example.jpg',
73 'showredirects' =>
true,
78 parent::__construct( $query, $moduleName, self::$settings[$moduleName][
'code'] );
86 $this->
run( $resultPageSet );
97 $prop = array_flip(
$params[
'prop'] );
98 $emptyString = $db->addQuotes(
'' );
101 $titles = $pageSet->getGoodAndMissingTitles();
102 $map = $pageSet->getGoodAndMissingTitlesByNamespace();
106 $hasNS = !isset(
$settings[
'to_namespace'] );
108 $bl_namespace =
"{$p}_namespace";
109 $bl_title =
"{$p}_title";
111 $bl_namespace =
$settings[
'to_namespace'];
112 $bl_title =
"{$p}_to";
115 return $t->getNamespace() === $bl_namespace;
117 $map = array_intersect_key( $map, [ $bl_namespace =>
true ] );
119 $bl_from =
"{$p}_from";
129 if ( $hasNS && count( $map ) > 1 ) {
130 $sortby[$bl_namespace] =
'ns';
133 foreach ( $map
as $nsTitles ) {
135 $key =
key( $nsTitles );
136 if ( $theTitle === null ) {
139 if ( count( $nsTitles ) > 1 || $key !== $theTitle ) {
140 $sortby[$bl_title] =
'title';
145 if (
$params[
'namespace'] !== null ) {
146 if ( empty(
$settings[
'from_namespace'] ) ) {
147 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
148 $miser_ns =
$params[
'namespace'];
154 if ( !empty(
$settings[
'from_namespace'] ) && count(
$params[
'namespace'] ) > 1 ) {
155 $sortby[
"{$p}_from_namespace"] =
'int';
159 $sortby[$bl_from] =
'int';
162 if ( !is_null(
$params[
'continue'] ) ) {
163 $cont = explode(
'|',
$params[
'continue'] );
166 $i = count( $sortby ) - 1;
167 foreach ( array_reverse( $sortby,
true )
as $field =>
$type ) {
176 $v = $db->addQuotes( $v );
183 $where =
"$field > $v OR ($field = $v AND ($where))";
193 $this->
addWhere(
"$bl_from = page_id" );
196 $this->
addWhere(
"rd_interwiki = $emptyString OR rd_interwiki IS NULL" );
199 $this->
addFields( array_keys( $sortby ) );
200 $this->
addFields( [
'bl_namespace' => $bl_namespace,
'bl_title' => $bl_title ] );
201 if ( is_null( $resultPageSet ) ) {
202 $fld_pageid = isset( $prop[
'pageid'] );
203 $fld_title = isset( $prop[
'title'] );
204 $fld_redirect = isset( $prop[
'redirect'] );
207 $this->
addFieldsIf( [
'page_title',
'page_namespace' ], $fld_title );
208 $this->
addFieldsIf(
'page_is_redirect', $fld_redirect );
211 $fld_fragment = isset( $prop[
'fragment'] );
212 $this->
addFieldsIf(
'rd_fragment', $fld_fragment );
214 $this->
addFields( $resultPageSet->getPageTableFields() );
217 $this->
addFieldsIf(
'page_namespace', $miser_ns !== null );
221 $this->
addWhere( $lb->constructSet( $p, $db ) );
225 if ( $t->getNamespace() == $bl_namespace ) {
226 $where[] =
"$bl_title = " . $db->addQuotes( $t->getDBkey() );
232 if (
$params[
'show'] !== null ) {
234 $show = array_flip(
$params[
'show'] );
235 if ( isset( $show[
'fragment'] ) && isset( $show[
'!fragment'] ) ||
236 isset( $show[
'redirect'] ) && isset( $show[
'!redirect'] )
240 $this->
addWhereIf(
"rd_fragment != $emptyString", isset( $show[
'fragment'] ) );
242 "rd_fragment = $emptyString OR rd_fragment IS NULL",
243 isset( $show[
'!fragment'] )
245 $this->
addWhereIf( [
'page_is_redirect' => 1 ], isset( $show[
'redirect'] ) );
246 $this->
addWhereIf( [
'page_is_redirect' => 0 ], isset( $show[
'!redirect'] ) );
250 $this->
addOption(
'ORDER BY', array_keys( $sortby ) );
256 if ( is_null( $resultPageSet ) ) {
258 foreach (
$res as $row ) {
266 if ( $miser_ns !== null && !in_array( $row->page_namespace, $miser_ns ) ) {
272 $id = $map[$row->bl_namespace][$row->bl_title];
276 $vals[
'pageid'] = (int)$row->page_id;
283 if ( $fld_fragment && $row->rd_fragment !== null && $row->rd_fragment !==
'' ) {
284 $vals[
'fragment'] = $row->rd_fragment;
286 if ( $fld_redirect ) {
287 $vals[
'redirect'] = (bool)$row->page_is_redirect;
298 foreach (
$res as $row ) {
307 $resultPageSet->populateFromTitles(
$titles );
313 foreach ( $sortby
as $field => $v ) {
314 $cont[] = $row->$field;
353 if ( empty(
$settings[
'from_namespace'] ) && $this->
getConfig()->
get(
'MiserMode' ) ) {
355 'api-help-param-limited-in-miser-mode',
359 if ( !empty(
$settings[
'showredirects'] ) ) {
370 if ( !empty(
$settings[
'showredirects'] ) ) {
371 $show[] =
'redirect';
372 $show[] =
'!redirect';
375 $show = array_merge( $show,
$settings[
'show'] );
383 unset(
$ret[
'show'] );
394 $etitle = rawurlencode(
$title );
397 "action=query&prop={$name}&titles={$etitle}"
398 =>
"apihelp-$path-example-simple",
399 "action=query&generator={$name}&titles={$etitle}&prop=info"
400 =>
"apihelp-$path-example-generator",
406 return "https://www.mediawiki.org/wiki/API:{$name}";
select($method, $extraQuery=[])
Execute a SELECT query based on the values in the internal arrays.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below...
getDB()
Get the Query database connection (read-only)
const LIMIT_BIG2
Fast query, apihighlimits limit.
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
addWhereFld($field, $value)
Equivalent to addWhere(array($field => $value))
This class contains a list of pages that the client has requested.
addPageSubItem($pageId, $item, $elemname=null)
Same as addPageSubItems(), but one element of $data at a time.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
run(ApiPageSet $resultPageSet=null)
static __construct(ApiQuery $query, $moduleName)
setContinue($row, $sortby)
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
const LIMIT_BIG1
Fast query, standard limit.
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
extractRequestParams($parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user...
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
setContinueEnumParameter($paramName, $paramValue)
Overridden to set the generator param if in generator mode.
addWhere($value)
Add a set of WHERE clauses to the internal array.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
const PARAM_HELP_MSG_APPEND
((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this ...
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
addWhereIf($value, $condition)
Same as addWhere(), but add the WHERE clauses only if a condition is met.
getModulePath()
Get the path to this module.
getConfig()
Get the Config object.
addOption($name, $value=null)
Add an option such as LIMIT or USE INDEX.
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead.&$feedLinks conditions will AND in the final query as a Content object as a Content object $title
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right, for PARAM_TYPE 'limit'.
This is the main query class.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
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
dieContinueUsageIf($condition)
Die with the $prefix.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter...
addFieldsIf($value, $condition)
Same as addFields(), but add the fields only if a condition is met.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
executeGenerator($resultPageSet)
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
addFields($value)
Add a set of fields to select to the internal array.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
static addTitleInfo(&$arr, $title, $prefix= '')
Add information (title and namespace) about a Title object to a result array.
getPageSet()
Get the PageSet object to work on.
addTables($tables, $alias=null)
Add a set of tables to the internal array.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
dieUsageMsg($error)
Output the error message related to a certain array.
This implements prop=redirects, prop=linkshere, prop=catmembers, prop=transcludedin, and prop=fileusage.
Allows to change the fields on the form that will be generated $name