Go to the documentation of this file.
35 parent::__construct(
$query, $moduleName,
'cl' );
47 $this->
run( $resultPageSet );
53 private function run( $resultPageSet =
null ) {
54 if ( $this->
getPageSet()->getGoodTitleCount() == 0 ) {
67 $this->
addFieldsIf(
array(
'cl_sortkey',
'cl_sortkey_prefix' ), isset( $prop[
'sortkey'] ) );
68 $this->
addFieldsIf(
'cl_timestamp', isset( $prop[
'timestamp'] ) );
72 if ( !is_null(
$params[
'categories'] ) ) {
74 foreach (
$params[
'categories']
as $cat ) {
77 $this->
setWarning(
"\"$cat\" is not a category" );
79 $cats[] =
$title->getDBkey();
85 if ( !is_null(
$params[
'continue'] ) ) {
86 $cont = explode(
'|',
$params[
'continue'] );
88 $op =
$params[
'dir'] ==
'descending' ?
'<' :
'>';
89 $clfrom = intval( $cont[0] );
90 $clto = $this->
getDB()->addQuotes( $cont[1] );
92 "cl_from $op $clfrom OR " .
93 "(cl_from = $clfrom AND " .
98 if ( isset( $show[
'hidden'] ) && isset( $show[
'!hidden'] ) ) {
101 if ( isset( $show[
'hidden'] ) || isset( $show[
'!hidden'] ) || isset( $prop[
'hidden'] ) ) {
104 $this->
addFieldsIf(
'pp_propname', isset( $prop[
'hidden'] ) );
108 'page_title = cl_to' ) ),
111 'pp_propname' =>
'hiddencat' ) )
113 if ( isset( $show[
'hidden'] ) ) {
115 } elseif ( isset( $show[
'!hidden'] ) ) {
120 $this->
addOption(
'USE INDEX',
array(
'categorylinks' =>
'cl_from' ) );
122 $sort = ( $params[
'dir'] ==
'descending' ?
' DESC' :
'' );
124 if ( count( $this->
getPageSet()->getGoodTitles() ) == 1 ) {
136 if ( is_null( $resultPageSet ) ) {
137 foreach (
$res as $row ) {
148 if ( isset( $prop[
'sortkey'] ) ) {
149 $vals[
'sortkey'] = bin2hex( $row->cl_sortkey );
150 $vals[
'sortkeyprefix'] = $row->cl_sortkey_prefix;
152 if ( isset( $prop[
'timestamp'] ) ) {
155 if ( isset( $prop[
'hidden'] ) && !is_null( $row->pp_propname ) ) {
156 $vals[
'hidden'] =
'';
167 foreach (
$res as $row ) {
177 $resultPageSet->populateFromTitles(
$titles );
206 'categories' =>
array(
222 'Which additional properties to get for each category',
223 ' sortkey - Adds the sortkey (hexadecimal string) and sortkey prefix',
224 ' (human-readable part) for the category',
225 ' timestamp - Adds timestamp of when the category was added',
226 ' hidden - Tags categories that are hidden with __HIDDENCAT__',
228 'limit' =>
'How many categories to return',
229 'show' =>
'Which kind of categories to show',
230 'continue' =>
'When more results are available, use this to continue',
231 'categories' =>
'Only list these categories. Useful for checking ' .
232 'whether a certain page is in a certain category',
233 'dir' =>
'The direction in which to list',
244 'sortkey' =>
'string',
245 'sortkeyprefix' =>
'string'
247 'timestamp' =>
array(
248 'timestamp' =>
'timestamp'
251 'hidden' =>
'boolean'
257 return 'List all categories the page(s) belong to.';
261 return array_merge( parent::getPossibleErrors(),
array(
268 'api.php?action=query&prop=categories&titles=Albert%20Einstein'
269 =>
'Get a list of categories [[Albert Einstein]] belongs to',
270 'api.php?action=query&generator=categories&titles=Albert%20Einstein&prop=info'
271 =>
'Get information about all categories used in the [[Albert Einstein]]',
276 return 'https://www.mediawiki.org/wiki/API:Properties#categories_.2F_cl';
__construct( $query, $moduleName)
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
A query module to enumerate categories the set of pages belong to.
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
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
run( $resultPageSet=null)
dieUsageMsg( $error)
Output the error message related to a certain array.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
select( $method, $extraQuery=array())
Execute a SELECT query based on the values in the internal arrays.
getExamples()
Returns usage examples for this module.
getDescription()
Returns the description string for this module.
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
getResultProperties()
Returns possible properties in the result, grouped by the value of the prop parameter that shows them...
setContinueEnumParameter( $paramName, $paramValue)
Overrides base in case of generator & smart continue to notify ApiQueryMain instead of adding them to...
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
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
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.
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
dieContinueUsageIf( $condition)
Die with the $prefix.
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
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
addWhere( $value)
Add a set of WHERE clauses to the internal array.
getCacheMode( $params)
Get the cache mode for the data generated by this module.
getParamDescription()
Returns an array of parameter descriptions.
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()
Evaluates the parameters, performs the requested query, and sets up the result.
addPageSubItem( $pageId, $item, $elemname=null)
Same as addPageSubItems(), but one element of $data at a time.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.