Go to the documentation of this file.
40 switch ( $moduleName ) {
42 $this->
table =
'pagelinks';
44 $this->description =
'link';
45 $this->titlesParam =
'titles';
46 $this->titlesParamDescription =
'Only list links to these titles. Useful ' .
47 'for checking whether a certain page links to a certain title.';
48 $this->helpUrl =
'https://www.mediawiki.org/wiki/API:Properties#links_.2F_pl';
51 $this->
table =
'templatelinks';
53 $this->description =
'template';
54 $this->titlesParam =
'templates';
55 $this->titlesParamDescription =
'Only list these templates. Useful ' .
56 'for checking whether a certain page uses a certain template.';
57 $this->helpUrl =
'https://www.mediawiki.org/wiki/API:Properties#templates_.2F_tl';
63 parent::__construct(
$query, $moduleName, $this->prefix );
75 $this->
run( $resultPageSet );
81 private function run( $resultPageSet =
null ) {
82 if ( $this->
getPageSet()->getGoodTitleCount() == 0 ) {
89 'pl_from' => $this->prefix .
'_from',
90 'pl_namespace' => $this->prefix .
'_namespace',
91 'pl_title' => $this->prefix .
'_title'
98 if ( !is_null(
$params[$this->titlesParam] ) ) {
103 $this->
setWarning(
"\"$t\" is not a valid title" );
108 $cond =
$lb->constructSet( $this->prefix, $this->
getDB() );
114 if ( !is_null(
$params[
'continue'] ) ) {
115 $cont = explode(
'|',
$params[
'continue'] );
117 $op =
$params[
'dir'] ==
'descending' ?
'<' :
'>';
118 $plfrom = intval( $cont[0] );
119 $plns = intval( $cont[1] );
120 $pltitle = $this->
getDB()->addQuotes( $cont[2] );
122 "{$this->prefix}_from $op $plfrom OR " .
123 "({$this->prefix}_from = $plfrom AND " .
124 "({$this->prefix}_namespace $op $plns OR " .
125 "({$this->prefix}_namespace = $plns AND " .
126 "{$this->prefix}_title $op= $pltitle)))"
130 $sort = (
$params[
'dir'] ==
'descending' ?
' DESC' :
'' );
137 if ( count( $this->
getPageSet()->getGoodTitles() ) != 1 ) {
138 $order[] = $this->prefix .
'_from' .
$sort;
140 if ( count(
$params[
'namespace'] ) != 1 ) {
141 $order[] = $this->prefix .
'_namespace' .
$sort;
144 $order[] = $this->prefix .
'_title' .
$sort;
146 $this->
addOption(
'USE INDEX', $this->prefix .
'_from' );
151 if ( is_null( $resultPageSet ) ) {
153 foreach (
$res as $row ) {
158 "{$row->pl_from}|{$row->pl_namespace}|{$row->pl_title}" );
166 "{$row->pl_from}|{$row->pl_namespace}|{$row->pl_title}" );
173 foreach (
$res as $row ) {
178 "{$row->pl_from}|{$row->pl_namespace}|{$row->pl_title}" );
183 $resultPageSet->populateFromTitles(
$titles );
189 'namespace' =>
array(
201 $this->titlesParam =>
array(
218 'namespace' =>
"Show {$desc}s in this namespace(s) only",
219 'limit' =>
"How many {$desc}s to return",
220 'continue' =>
'When more results are available, use this to continue',
221 $this->titlesParam => $this->titlesParamDescription,
222 'dir' =>
'The direction in which to list',
236 return "Returns all {$this->description}s from the given page(s).";
244 "api.php?action=query&prop={$name}&titles=Main%20Page" =>
"Get {$desc}s from the [[Main Page]]",
245 "api.php?action=query&generator={$name}&titles=Main%20Page&prop=info"
246 =>
"Get information about the {$desc} pages in the [[Main Page]]",
247 "api.php?action=query&prop={$name}&titles=Main%20Page&{$this->prefix}namespace=2|10"
248 =>
"Get {$desc}s from the Main Page in the User and Template namespaces",
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.
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
__construct( $query, $moduleName)
Class representing a list of titles The execute() method checks them all for existence and adds them ...
A query module to list all wiki links on a given set of pages.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
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.
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
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
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 then executing the whole list after the page is displayed We don t do anything smart like collating updates to the same table or such because the list is almost always going to have just one item on if so it s not worth the trouble Since there is a job queue in the jobs table
getDB()
Get the Query database connection (read-only)
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
getResultProperties()
Returns possible properties in the result, grouped by the value of the prop parameter that shows them...
getParamDescription()
Returns an array of parameter descriptions.
executeGenerator( $resultPageSet)
Execute this module as a generator.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
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
dieContinueUsageIf( $condition)
Die with the $prefix.
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
getCacheMode( $params)
Get the cache mode for the data generated by this module.
setWarning( $warning)
Set warning section for this module.
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
getModuleName()
Get the name of the module being executed by this instance.
getExamples()
Returns usage examples for this module.
addWhere( $value)
Add a set of WHERE clauses to the internal array.
getDescription()
Returns the description string for this module.
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.
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
run( $resultPageSet=null)
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.