[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/api/ -> ApiPageSet.php (summary)

Created on Sep 24, 2006 Copyright © 2006, 2013 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"

File Size: 1170 lines (35 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ApiPageSet:: (51 methods):
  addValues()
  __construct()
  executeDryRun()
  execute()
  executeInternal()
  isResolvingRedirects()
  getDataSource()
  requestField()
  getCustomField()
  getPageTableFields()
  getAllTitlesByNamespace()
  getTitles()
  getTitleCount()
  getGoodTitles()
  getGoodTitleCount()
  getMissingTitles()
  getInvalidTitles()
  getMissingPageIDs()
  getRedirectTitles()
  getRedirectTitlesAsResult()
  getNormalizedTitles()
  getNormalizedTitlesAsResult()
  getConvertedTitles()
  getConvertedTitlesAsResult()
  getInterwikiTitles()
  getInterwikiTitlesAsResult()
  getInvalidTitlesAndRevisions()
  getRevisionIDs()
  getMissingRevisionIDs()
  getMissingRevisionIDsAsResult()
  getSpecialTitles()
  getRevisionCount()
  populateFromTitles()
  populateFromPageIDs()
  populateFromQueryResult()
  populateFromRevisionIDs()
  processDbRow()
  finishPageSetGeneration()
  initFromTitles()
  initFromPageIds()
  initFromQueryResult()
  initFromRevIDs()
  resolvePendingRedirects()
  getRedirectTargets()
  getCacheMode()
  processTitlesArray()
  getDB()
  getPositiveIntegers()
  getAllowedParams()
  getGenerators()
  getParamDescription()


Class: ApiPageSet  - X-Ref

This class contains a list of pages that the client has requested.
Initially, when the client passes in titles=, pageids=, or revisions=
parameter, an instance of the ApiPageSet class will normalize titles,
determine if the pages/revisions exist, and prefetch any additional page
data requested.

When a generator is used, the result of the generator will become the input
for the second instance of this class, and all subsequent actions will use
the second instance for all their work.

addValues( array &$result, $values, $flag = null, $name = null )   X-Ref
Add all items from $values into the result

param: array $result Output
param: array $values Values to add
param: string $flag The name of the boolean flag to mark this element
param: string $name If given, name of the value

__construct( ApiBase $dbSource, $flags = 0, $defaultNamespace = NS_MAIN )   X-Ref

param: ApiBase $dbSource Module implementing getDB().
param: int $flags Zero or more flags like DISABLE_GENERATORS
param: int $defaultNamespace The namespace to use if none is specified by a prefix.

executeDryRun()   X-Ref
In case execute() is not called, call this method to mark all relevant parameters as used
This prevents unused parameters from being reported as warnings


execute()   X-Ref
Populate the PageSet from the request parameters.


executeInternal( $isDryRun )   X-Ref
Populate the PageSet from the request parameters.

param: bool $isDryRun If true, instantiates generator, but only to mark

isResolvingRedirects()   X-Ref
Check whether this PageSet is resolving redirects

return: bool

getDataSource()   X-Ref
Return the parameter name that is the source of data for this PageSet

If multiple source parameters are specified (e.g. titles and pageids),
one will be named arbitrarily.

return: string|null

requestField( $fieldName )   X-Ref
Request an additional field from the page table.
Must be called before execute()

param: string $fieldName Field name

getCustomField( $fieldName )   X-Ref
Get the value of a custom field previously requested through
requestField()

param: string $fieldName Field name
return: mixed Field value

getPageTableFields()   X-Ref
Get the fields that have to be queried from the page table:
the ones requested through requestField() and a few basic ones
we always need

return: array Array of field names

getAllTitlesByNamespace()   X-Ref
Returns an array [ns][dbkey] => page_id for all requested titles.
page_id is a unique negative number in case title was not found.
Invalid titles will also have negative page IDs and will be in namespace 0

return: array

getTitles()   X-Ref
All Title objects provided.

return: Title[]

getTitleCount()   X-Ref
Returns the number of unique pages (not revisions) in the set.

return: int

getGoodTitles()   X-Ref
Title objects that were found in the database.

return: Title[] Array page_id (int) => Title (obj)

getGoodTitleCount()   X-Ref
Returns the number of found unique pages (not revisions) in the set.

return: int

getMissingTitles()   X-Ref
Title objects that were NOT found in the database.
The array's index will be negative for each item

return: Title[]

getInvalidTitles()   X-Ref
Titles that were deemed invalid by Title::newFromText()
The array's index will be unique and negative for each item

return: string[] Array of strings (not Title objects)

getMissingPageIDs()   X-Ref
Page IDs that were not found in the database

return: array Array of page IDs

getRedirectTitles()   X-Ref
Get a list of redirect resolutions - maps a title to its redirect
target, as an array of output-ready arrays

return: Title[]

getRedirectTitlesAsResult( $result = null )   X-Ref
Get a list of redirect resolutions - maps a title to its redirect
target.

param: ApiResult $result
return: array Array of prefixed_title (string) => Title object

getNormalizedTitles()   X-Ref
Get a list of title normalizations - maps a title to its normalized
version.

return: array Array of raw_prefixed_title (string) => prefixed_title (string)

getNormalizedTitlesAsResult( $result = null )   X-Ref
Get a list of title normalizations - maps a title to its normalized
version in the form of result array.

param: ApiResult $result
return: array Array of raw_prefixed_title (string) => prefixed_title (string)

getConvertedTitles()   X-Ref
Get a list of title conversions - maps a title to its converted
version.

return: array Array of raw_prefixed_title (string) => prefixed_title (string)

getConvertedTitlesAsResult( $result = null )   X-Ref
Get a list of title conversions - maps a title to its converted
version as a result array.

param: ApiResult $result
return: array Array of (from, to) strings

getInterwikiTitles()   X-Ref
Get a list of interwiki titles - maps a title to its interwiki
prefix.

return: array Array of raw_prefixed_title (string) => interwiki_prefix (string)

getInterwikiTitlesAsResult( $result = null, $iwUrl = false )   X-Ref
Get a list of interwiki titles - maps a title to its interwiki
prefix as result.

param: ApiResult $result
param: bool $iwUrl
return: array Array of raw_prefixed_title (string) => interwiki_prefix (string)

getInvalidTitlesAndRevisions( $invalidChecks = array( 'invalidTitles','special', 'missingIds', 'missingRevIds', 'missingTitles', 'interwikiTitles' )   X-Ref
Get an array of invalid/special/missing titles.

param: array $invalidChecks List of types of invalid titles to include.
return: array Array suitable for inclusion in the response

getRevisionIDs()   X-Ref
Get the list of revision IDs (requested with the revids= parameter)

return: array Array of revID (int) => pageID (int)

getMissingRevisionIDs()   X-Ref
Revision IDs that were not found in the database

return: array Array of revision IDs

getMissingRevisionIDsAsResult( $result = null )   X-Ref
Revision IDs that were not found in the database as result array.

param: ApiResult $result
return: array Array of revision IDs

getSpecialTitles()   X-Ref
Get the list of titles with negative namespace

return: Title[]

getRevisionCount()   X-Ref
Returns the number of revisions (requested with revids= parameter).

return: int Number of revisions.

populateFromTitles( $titles )   X-Ref
Populate this PageSet from a list of Titles

param: array $titles Array of Title objects

populateFromPageIDs( $pageIDs )   X-Ref
Populate this PageSet from a list of page IDs

param: array $pageIDs Array of page IDs

populateFromQueryResult( $db, $queryResult )   X-Ref
Populate this PageSet from a rowset returned from the database

param: DatabaseBase $db
param: ResultWrapper $queryResult Query result object

populateFromRevisionIDs( $revIDs )   X-Ref
Populate this PageSet from a list of revision IDs

param: array $revIDs Array of revision IDs

processDbRow( $row )   X-Ref
Extract all requested fields from the row received from the database

param: stdClass $row Result row

finishPageSetGeneration()   X-Ref
Do not use, does nothing, will be removed


initFromTitles( $titles )   X-Ref
This method populates internal variables with page information
based on the given array of title strings.

Steps:
#1 For each title, get data from `page` table
#2 If page was not found in the DB, store it as missing

Additionally, when resolving redirects:
#3 If no more redirects left, stop.
#4 For each redirect, get its target from the `redirect` table.
#5 Substitute the original LinkBatch object with the new list
#6 Repeat from step #1

param: array $titles Array of Title objects or strings

initFromPageIds( $pageids )   X-Ref
Does the same as initFromTitles(), but is based on page IDs instead

param: array $pageids Array of page IDs

initFromQueryResult( $res, &$remaining = null, $processTitles = null )   X-Ref
Iterate through the result of the query on 'page' table,
and for each row create and store title object and save any extra fields requested.

param: ResultWrapper $res DB Query result
param: array $remaining Array of either pageID or ns/title elements (optional).
param: bool $processTitles Must be provided together with $remaining.

initFromRevIDs( $revids )   X-Ref
Does the same as initFromTitles(), but is based on revision IDs
instead

param: array $revids Array of revision IDs

resolvePendingRedirects()   X-Ref
Resolve any redirects in the result if redirect resolution was
requested. This function is called repeatedly until all redirects
have been resolved.


getRedirectTargets()   X-Ref
Get the targets of the pending redirects from the database

Also creates entries in the redirect table for redirects that don't
have one.
return: LinkBatch

getCacheMode( $params = null )   X-Ref
Get the cache mode for the data generated by this module.
All PageSet users should take into account whether this returns a more-restrictive
cache mode than the using module itself. For possible return values and other
details about cache modes, see ApiMain::setCacheMode()

Public caching will only be allowed if *all* the modules that supply
data for a given request return a cache mode of public.

param: array|null $params
return: string

processTitlesArray( $titles )   X-Ref
Given an array of title strings, convert them into Title objects.
Alternatively, an array of Title objects may be given.
This method validates access rights for the title,
and appends normalization values to the output.

param: array $titles Array of Title objects or strings
return: LinkBatch

getDB()   X-Ref
Get the database connection (read-only)

return: DatabaseBase

getPositiveIntegers( $array )   X-Ref
Returns the input array of integers with all values < 0 removed

param: array $array
return: array

getAllowedParams( $flags = 0 )   X-Ref
No description

getGenerators()   X-Ref
Get an array of all available generators

return: array

getParamDescription()   X-Ref
No description



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1