MediaWiki
1.23.2
|
This class contains a list of pages that the client has requested. More...
Public Member Functions | |
__construct (ApiBase $dbSource, $flags=0, $defaultNamespace=NS_MAIN) | |
Constructor. More... | |
execute () | |
Populate the PageSet from the request parameters. More... | |
executeDryRun () | |
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. More... | |
finishPageSetGeneration () | |
Do not use, does nothing, will be removed. More... | |
getAllowedParams ( $flags=0) | |
getAllTitlesByNamespace () | |
Returns an array [ns][dbkey] => page_id for all requested titles. More... | |
getCacheMode ( $params=null) | |
Get the cache mode for the data generated by this module. More... | |
getConvertedTitles () | |
Get a list of title conversions - maps a title to its converted version. More... | |
getConvertedTitlesAsResult ( $result=null) | |
Get a list of title conversions - maps a title to its converted version as a result array. More... | |
getCustomField ( $fieldName) | |
Get the value of a custom field previously requested through requestField() More... | |
getDataSource () | |
Return the parameter name that is the source of data for this PageSet. More... | |
getGoodTitleCount () | |
Returns the number of found unique pages (not revisions) in the set. More... | |
getGoodTitles () | |
Title objects that were found in the database. More... | |
getInterwikiTitles () | |
Get a list of interwiki titles - maps a title to its interwiki prefix. More... | |
getInterwikiTitlesAsResult ( $result=null, $iwUrl=false) | |
Get a list of interwiki titles - maps a title to its interwiki prefix as result. More... | |
getInvalidTitles () | |
Titles that were deemed invalid by Title::newFromText() The array's index will be unique and negative for each item. More... | |
getInvalidTitlesAndRevisions ( $invalidChecks=array( 'invalidTitles', 'special', 'missingIds', 'missingRevIds', 'missingTitles', 'interwikiTitles')) | |
Get an array of invalid/special/missing titles. More... | |
getMissingPageIDs () | |
Page IDs that were not found in the database. More... | |
getMissingRevisionIDs () | |
Revision IDs that were not found in the database. More... | |
getMissingRevisionIDsAsResult ( $result=null) | |
Revision IDs that were not found in the database as result array. More... | |
getMissingTitles () | |
Title objects that were NOT found in the database. More... | |
getNormalizedTitles () | |
Get a list of title normalizations - maps a title to its normalized version. More... | |
getNormalizedTitlesAsResult ( $result=null) | |
Get a list of title normalizations - maps a title to its normalized version in the form of result array. More... | |
getPageTableFields () | |
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. More... | |
getParamDescription () | |
Returns an array of parameter descriptions. More... | |
getPossibleErrors () | |
Returns a list of all possible errors returned by the module. More... | |
getRedirectTitles () | |
Get a list of redirect resolutions - maps a title to its redirect target, as an array of output-ready arrays. More... | |
getRedirectTitlesAsResult ( $result=null) | |
Get a list of redirect resolutions - maps a title to its redirect target. More... | |
getRevisionCount () | |
Returns the number of revisions (requested with revids= parameter). More... | |
getRevisionIDs () | |
Get the list of revision IDs (requested with the revids= parameter) More... | |
getSpecialTitles () | |
Get the list of titles with negative namespace. More... | |
getTitleCount () | |
Returns the number of unique pages (not revisions) in the set. More... | |
getTitles () | |
All Title objects provided. More... | |
isResolvingRedirects () | |
Check whether this PageSet is resolving redirects. More... | |
populateFromPageIDs ( $pageIDs) | |
Populate this PageSet from a list of page IDs. More... | |
populateFromQueryResult ( $db, $queryResult) | |
Populate this PageSet from a rowset returned from the database. More... | |
populateFromRevisionIDs ( $revIDs) | |
Populate this PageSet from a list of revision IDs. More... | |
populateFromTitles ( $titles) | |
Populate this PageSet from a list of Titles. More... | |
processDbRow ( $row) | |
Extract all requested fields from the row received from the database. More... | |
requestField ( $fieldName) | |
Request an additional field from the page table. More... | |
Public Member Functions inherited from ApiBase | |
__construct ( $mainModule, $moduleName, $modulePrefix='') | |
Constructor. More... | |
createContext () | |
Create a new RequestContext object to use e.g. More... | |
dieReadOnly () | |
Helper function for readonly errors. More... | |
dieStatus ( $status) | |
Throw a UsageException based on the errors in the Status object. More... | |
dieUsage ( $description, $errorCode, $httpRespCode=0, $extradata=null) | |
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an error message. More... | |
dieUsageMsg ( $error) | |
Output the error message related to a certain array. More... | |
dieUsageMsgOrDebug ( $error) | |
Will only set a warning instead of failing if the global $wgDebugAPI is set to true. More... | |
encodeParamName ( $paramName) | |
This method mangles parameter name based on the prefix supplied to the constructor. More... | |
extractRequestParams ( $parseLimit=true) | |
Using getAllowedParams(), this function makes an array of the values provided by the user, with key being the name of the variable, and value - validated value from user or default. More... | |
getCustomPrinter () | |
If the module may only be used with a certain format module, it should override this method to return an instance of that formatter. More... | |
getErrorFromStatus ( $status) | |
Get error (as code, string) from a Status object. More... | |
getFinalDescription () | |
Get final module description, after hooks have had a chance to tweak it as needed. More... | |
getFinalParamDescription () | |
Get final parameter descriptions, after hooks have had a chance to tweak it as needed. More... | |
getFinalParams ( $flags=0) | |
Get final list of parameters, after hooks have had a chance to tweak it as needed. More... | |
getFinalPossibleErrors () | |
Get final list of possible errors, after hooks have had a chance to tweak it as needed. More... | |
getFinalResultProperties () | |
Get final possible result properties, after hooks have had a chance to tweak it as needed. More... | |
getHelpUrls () | |
getMain () | |
Get the main module. More... | |
getModuleManager () | |
Get the module manager, or null if this module has no sub-modules. More... | |
getModuleName () | |
Get the name of the module being executed by this instance. More... | |
getModulePrefix () | |
Get parameter prefix (usually two letters or an empty string). More... | |
getModuleProfileName ( $db=false) | |
Get the name of the module as shown in the profiler log. More... | |
getProfileDBTime () | |
Total time the module used the database. More... | |
getProfileTime () | |
Total time the module was executed. More... | |
getRequireAtLeastOneParameterErrorMessages ( $params) | |
Generates the possible errors requireAtLeastOneParameter() can die with. More... | |
getRequireMaxOneParameterErrorMessages ( $params) | |
Generates the possible error requireMaxOneParameter() can die with. More... | |
getRequireOnlyOneParameterErrorMessages ( $params) | |
Generates the possible errors requireOnlyOneParameter() can die with. More... | |
getResult () | |
Get the result object. More... | |
getResultData () | |
Get the result data array (read-only) More... | |
getTitleOrPageId ( $params, $load=false) | |
getTitleOrPageIdErrorMessage () | |
getTokenSalt () | |
Returns the token salt if there is one, '' if the module doesn't require a salt, else false if the module doesn't need a token You have also to override needsToken() Value is passed to User::getEditToken. More... | |
getVersion () | |
Returns a string that identifies the version of the extending class. More... | |
getWatchlistUser ( $params) | |
Gets the user for whom to get the watchlist. More... | |
isMain () | |
Returns true if this module is the main module ($this === $this->mMainModule), false otherwise. More... | |
isReadMode () | |
Indicates whether this module requires read rights. More... | |
isWriteMode () | |
Indicates whether this module requires write mode. More... | |
makeHelpMsg () | |
Generates help message for this module, or false if there is no description. More... | |
makeHelpMsgParameters () | |
Generates the parameter descriptions for this module, to be displayed in the module's help. More... | |
mustBePosted () | |
Indicates whether this module must be called with a POST request. More... | |
needsToken () | |
Returns whether this module requires a token to execute It is used to show possible errors in action=paraminfo see bug 25248. More... | |
parseErrors ( $errors) | |
Parses a list of errors into a standardised format. More... | |
parseMsg ( $error) | |
Return the error message related to a certain array. More... | |
profileDBIn () | |
Start module profiling. More... | |
profileDBOut () | |
End database profiling. More... | |
profileIn () | |
Start module profiling. More... | |
profileOut () | |
End module profiling. More... | |
requireAtLeastOneParameter ( $params) | |
Die if none of a certain set of parameters is set and not false. More... | |
requireMaxOneParameter ( $params) | |
Die if more than one of a certain set of parameters is set and not false. More... | |
requireOnlyOneParameter ( $params) | |
Die if none or more than one of a certain set of parameters is set and not false. More... | |
safeProfileOut () | |
When modules crash, sometimes it is needed to do a profileOut() regardless of the profiling state the module was in. More... | |
setWarning ( $warning) | |
Set warning section for this module. More... | |
shouldCheckMaxlag () | |
Indicates if this module needs maxlag to be checked. More... | |
validateLimit ( $paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false) | |
Validate the value against the minimum and user/bot maximum limits. More... | |
validateTimestamp ( $value, $encParamName) | |
Validate and normalize of parameters of type 'timestamp'. More... | |
Public Member Functions inherited from ContextSource | |
canUseWikiPage () | |
Check whether a WikiPage object can be get with getWikiPage(). More... | |
exportSession () | |
Export the resolved user IP, HTTP headers, user ID, and session ID. More... | |
getConfig () | |
Get the Config object. More... | |
getContext () | |
Get the RequestContext object. More... | |
getLang () | |
Get the Language object. More... | |
getLanguage () | |
Get the Language object. More... | |
getOutput () | |
Get the OutputPage object. More... | |
getRequest () | |
Get the WebRequest object. More... | |
getSkin () | |
Get the Skin object. More... | |
getTitle () | |
Get the Title object. More... | |
getUser () | |
Get the User object. More... | |
getWikiPage () | |
Get the WikiPage object. More... | |
msg () | |
Get a Message object with context set Parameters are the same as wfMessage() More... | |
setContext (IContextSource $context) | |
Set the IContextSource object. More... | |
Public Attributes | |
const | DISABLE_GENERATORS = 1 |
Constructor flag: The new instance of ApiPageSet will ignore the 'generator=' parameter. More... | |
Public Attributes inherited from ApiBase | |
$mDBTime = 0 | |
$mModuleName | |
$mModulePrefix | |
$mModuleTime = 0 | |
const | GET_VALUES_FOR_HELP = 1 |
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thorough. More... | |
const | LIMIT_BIG1 = 500 |
const | LIMIT_BIG2 = 5000 |
const | LIMIT_SML1 = 50 |
const | LIMIT_SML2 = 500 |
const | PARAM_ALLOW_DUPLICATES = 6 |
const | PARAM_DEPRECATED = 7 |
const | PARAM_DFLT = 0 |
const | PARAM_ISMULTI = 1 |
const | PARAM_MAX = 3 |
const | PARAM_MAX2 = 4 |
const | PARAM_MIN = 5 |
const | PARAM_RANGE_ENFORCE = 9 |
const | PARAM_REQUIRED = 8 |
const | PARAM_TYPE = 2 |
const | PROP_LIST = 'LIST' |
const | PROP_NULLABLE = 1 |
const | PROP_ROOT = 'ROOT' |
const | PROP_TYPE = 0 |
Protected Member Functions | |
getDB () | |
Get the database connection (read-only) More... | |
Protected Member Functions inherited from ApiBase | |
dieContinueUsageIf ( $condition) | |
Die with the $prefix. More... | |
getAllowedParams () | |
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (array with PARAM_* constants as keys) Don't call this function directly: use getFinalParams() to allow hooks to modify parameters as needed. More... | |
getDescription () | |
Returns the description string for this module. More... | |
getExamples () | |
Returns usage examples for this module. More... | |
getParameter ( $paramName, $parseLimit=true) | |
Get a value for the given parameter. More... | |
getParameterFromSettings ( $paramName, $paramSettings, $parseLimit) | |
Using the settings determine the value for the given parameter. More... | |
getResultProperties () | |
Returns possible properties in the result, grouped by the value of the prop parameter that shows them. More... | |
getWatchlistValue ( $watchlist, $titleObj, $userOption=null) | |
Return true if we're to watch the page, false if not, null if no change. More... | |
makeHelpArrayToString ( $prefix, $title, $input) | |
parseMultiValue ( $valueName, $value, $allowMultiple, $allowedValues) | |
Return an array of values that were given in a 'a|b|c' notation, after it optionally validates them against the list allowed values. More... | |
setWatch ( $watch, $titleObj, $userOption=null) | |
Set a watch (or unwatch) based the based on a watchlist parameter. More... | |
Private Member Functions | |
executeInternal ( $isDryRun) | |
Populate the PageSet from the request parameters. More... | |
getGenerators () | |
Get an array of all available generators. More... | |
getRedirectTargets () | |
Get the targets of the pending redirects from the database. More... | |
initFromPageIds ( $pageids) | |
Does the same as initFromTitles(), but is based on page IDs instead. More... | |
initFromQueryResult ( $res, &$remaining=null, $processTitles=null) | |
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. More... | |
initFromRevIDs ( $revids) | |
Does the same as initFromTitles(), but is based on revision IDs instead. More... | |
initFromTitles ( $titles) | |
This method populates internal variables with page information based on the given array of title strings. More... | |
processTitlesArray ( $titles) | |
Given an array of title strings, convert them into Title objects. More... | |
resolvePendingRedirects () | |
Resolve any redirects in the result if redirect resolution was requested. More... | |
Static Private Member Functions | |
static | addValues (array &$result, $values, $flag=null, $name=null) |
Add all items from $values into the result. More... | |
static | getPositiveIntegers ( $array) |
Returns the input array of integers with all values < 0 removed. More... | |
Private Attributes | |
$mAllowGenerator | |
$mAllPages = array() | |
$mCacheMode = 'public' | |
$mConvertedTitles = array() | |
$mConvertTitles | |
$mDbSource | |
int | $mDefaultNamespace = NS_MAIN |
$mFakePageId = -1 | |
$mGoodRevIDs = array() | |
$mGoodTitles = array() | |
$mInterwikiTitles = array() | |
$mInvalidTitles = array() | |
$mMissingPageIDs = array() | |
$mMissingRevIDs = array() | |
$mMissingTitles = array() | |
$mNormalizedTitles = array() | |
$mParams | |
$mPendingRedirectIDs = array() | |
$mRedirectTitles = array() | |
$mRequestedPageFields = array() | |
$mResolveRedirects | |
$mSpecialTitles = array() | |
$mTitles = array() | |
Static Private Attributes | |
static | $generators = null |
Additional Inherited Members | |
Static Public Member Functions inherited from ApiBase | |
static | debugPrint ( $value, $name='unknown', $backtrace=false) |
Debugging function that prints a value and an optional backtrace. More... | |
static | truncateArray (&$arr, $limit) |
Truncate an array to a certain length. More... | |
Static Public Attributes inherited from ApiBase | |
static | $messageMap |
Array that maps message keys to error messages. More... | |
Static Protected Member Functions inherited from ApiBase | |
static | addTokenProperties (&$props, $tokenFunctions) |
Add token properties to the array used by getResultProperties, based on a token functions mapping. More... | |
static | dieDebug ( $method, $message) |
Internal code errors should be reported with this method. More... | |
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.
Definition at line 41 of file ApiPageSet.php.
Constructor.
$dbSource | ApiBase Module implementing getDB(). Allows PageSet to reuse existing db connection from the shared state like ApiQuery. | |
int | $flags | Zero or more flags like DISABLE_GENERATORS |
int | $defaultNamespace | the namespace to use if none is specified by a prefix. |
Definition at line 107 of file ApiPageSet.php.
References $flags, DISABLE_GENERATORS, ApiBase\extractRequestParams(), ApiBase\getMain(), ApiBase\getModuleName(), ApiBase\profileIn(), and ApiBase\profileOut().
|
staticprivate |
Add all items from $values into the result.
array | $result | output |
array | $values | values to add |
string | $flag | the name of the boolean flag to mark this element |
string | $name | if given, name of the value |
Definition at line 82 of file ApiPageSet.php.
References $name, ApiQueryBase\addTitleInfo(), array(), and as.
Referenced by getInvalidTitlesAndRevisions().
ApiPageSet::execute | ( | ) |
Populate the PageSet from the request parameters.
Reimplemented from ApiBase.
Definition at line 131 of file ApiPageSet.php.
References executeInternal().
ApiPageSet::executeDryRun | ( | ) |
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.
Definition at line 124 of file ApiPageSet.php.
References executeInternal().
|
private |
Populate the PageSet from the request parameters.
bool | $isDryRun | If true, instantiates generator, but only to mark relevant parameters as used |
Definition at line 140 of file ApiPageSet.php.
References $mDbSource, array(), as, ApiBase\dieUsage(), DISABLE_GENERATORS, ApiBase\getMain(), initFromPageIds(), initFromRevIDs(), initFromTitles(), ApiBase\profileIn(), ApiBase\profileOut(), resolvePendingRedirects(), ApiBase\setWarning(), and wfRunHooks().
Referenced by execute(), and executeDryRun().
ApiPageSet::finishPageSetGeneration | ( | ) |
Do not use, does nothing, will be removed.
Definition at line 683 of file ApiPageSet.php.
References wfDeprecated().
ApiPageSet::getAllowedParams | ( | $flags = 0 | ) |
Definition at line 1096 of file ApiPageSet.php.
References $flags, array(), ApiBase\GET_VALUES_FOR_HELP, getGenerators(), ApiBase\PARAM_ISMULTI, and ApiBase\PARAM_TYPE.
ApiPageSet::getAllTitlesByNamespace | ( | ) |
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
Definition at line 327 of file ApiPageSet.php.
References $mAllPages.
ApiPageSet::getCacheMode | ( | $params = null | ) |
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.
$params |
Definition at line 982 of file ApiPageSet.php.
References $mCacheMode.
ApiPageSet::getConvertedTitles | ( | ) |
Get a list of title conversions - maps a title to its converted version.
Definition at line 460 of file ApiPageSet.php.
References $mConvertedTitles.
Referenced by getConvertedTitlesAsResult().
ApiPageSet::getConvertedTitlesAsResult | ( | $result = null | ) |
Get a list of title conversions - maps a title to its converted version as a result array.
$result | ApiResult |
Definition at line 471 of file ApiPageSet.php.
References array(), as, and getConvertedTitles().
ApiPageSet::getCustomField | ( | $fieldName | ) |
Get the value of a custom field previously requested through requestField()
string | $fieldName | Field name |
Definition at line 290 of file ApiPageSet.php.
ApiPageSet::getDataSource | ( | ) |
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.
Definition at line 258 of file ApiPageSet.php.
|
protected |
Get the database connection (read-only)
Reimplemented from ApiBase.
Definition at line 1073 of file ApiPageSet.php.
Referenced by getRedirectTargets(), initFromPageIds(), initFromRevIDs(), initFromTitles(), and resolvePendingRedirects().
|
private |
Get an array of all available generators.
Definition at line 1131 of file ApiPageSet.php.
References $generators, $mDbSource, $name, $query, array(), as, and ApiBase\getMain().
Referenced by getAllowedParams().
ApiPageSet::getGoodTitleCount | ( | ) |
Returns the number of found unique pages (not revisions) in the set.
Definition at line 359 of file ApiPageSet.php.
ApiPageSet::getGoodTitles | ( | ) |
Title objects that were found in the database.
Definition at line 351 of file ApiPageSet.php.
References $mGoodTitles.
ApiPageSet::getInterwikiTitles | ( | ) |
Get a list of interwiki titles - maps a title to its interwiki prefix.
Definition at line 491 of file ApiPageSet.php.
References $mInterwikiTitles.
Referenced by getInterwikiTitlesAsResult().
ApiPageSet::getInterwikiTitlesAsResult | ( | $result = null , |
|
$iwUrl = false |
|||
) |
Get a list of interwiki titles - maps a title to its interwiki prefix as result.
$result | ApiResult |
$iwUrl | boolean |
Definition at line 503 of file ApiPageSet.php.
References $title, array(), as, getInterwikiTitles(), Title\newFromText(), and PROTO_CURRENT.
Referenced by getInvalidTitlesAndRevisions().
ApiPageSet::getInvalidTitles | ( | ) |
Titles that were deemed invalid by Title::newFromText() The array's index will be unique and negative for each item.
Definition at line 377 of file ApiPageSet.php.
References $mInvalidTitles.
Referenced by getInvalidTitlesAndRevisions().
ApiPageSet::getInvalidTitlesAndRevisions | ( | $invalidChecks = array( 'invalidTitles', 'special', 'missingIds', 'missingRevIds', 'missingTitles', 'interwikiTitles' ) | ) |
Get an array of invalid/special/missing titles.
$invalidChecks | List of types of invalid titles to include. Recognized values are:
|
Definition at line 537 of file ApiPageSet.php.
References addValues(), array(), getInterwikiTitlesAsResult(), getInvalidTitles(), getMissingPageIDs(), getMissingRevisionIDs(), getMissingTitles(), and getSpecialTitles().
ApiPageSet::getMissingPageIDs | ( | ) |
Page IDs that were not found in the database.
Definition at line 385 of file ApiPageSet.php.
References $mMissingPageIDs.
Referenced by getInvalidTitlesAndRevisions().
ApiPageSet::getMissingRevisionIDs | ( | ) |
Revision IDs that were not found in the database.
Definition at line 575 of file ApiPageSet.php.
References $mMissingRevIDs.
Referenced by getInvalidTitlesAndRevisions(), and getMissingRevisionIDsAsResult().
ApiPageSet::getMissingRevisionIDsAsResult | ( | $result = null | ) |
Revision IDs that were not found in the database as result array.
$result | ApiResult |
Definition at line 585 of file ApiPageSet.php.
References array(), as, and getMissingRevisionIDs().
ApiPageSet::getMissingTitles | ( | ) |
Title objects that were NOT found in the database.
The array's index will be negative for each item
Definition at line 368 of file ApiPageSet.php.
References $mMissingTitles.
Referenced by getInvalidTitlesAndRevisions().
ApiPageSet::getNormalizedTitles | ( | ) |
Get a list of title normalizations - maps a title to its normalized version.
Definition at line 429 of file ApiPageSet.php.
References $mNormalizedTitles.
Referenced by getNormalizedTitlesAsResult().
ApiPageSet::getNormalizedTitlesAsResult | ( | $result = null | ) |
Get a list of title normalizations - maps a title to its normalized version in the form of result array.
$result | ApiResult |
Definition at line 440 of file ApiPageSet.php.
References array(), as, and getNormalizedTitles().
ApiPageSet::getPageTableFields | ( | ) |
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.
Definition at line 300 of file ApiPageSet.php.
References array().
Referenced by initFromPageIds(), initFromTitles(), and resolvePendingRedirects().
ApiPageSet::getParamDescription | ( | ) |
Returns an array of parameter descriptions.
Don't call this function directly: use getFinalParamDescription() to allow hooks to modify descriptions as needed.
Reimplemented from ApiBase.
Definition at line 1153 of file ApiPageSet.php.
References array().
|
staticprivate |
Returns the input array of integers with all values < 0 removed.
$array | array |
Definition at line 1083 of file ApiPageSet.php.
References as.
Referenced by initFromPageIds(), and initFromRevIDs().
ApiPageSet::getPossibleErrors | ( | ) |
Returns a list of all possible errors returned by the module.
Don't call this function directly: use getFinalPossibleErrors() to allow hooks to modify parameters as needed.
Reimplemented from ApiBase.
Definition at line 1172 of file ApiPageSet.php.
References array().
|
private |
Get the targets of the pending redirects from the database.
Also creates entries in the redirect table for redirects that don't have one.
Definition at line 917 of file ApiPageSet.php.
References $from, $lb, $res, $title, array(), as, WikiPage\factory(), getDB(), Title\makeTitle(), ApiBase\profileDBIn(), and ApiBase\profileDBOut().
Referenced by resolvePendingRedirects().
ApiPageSet::getRedirectTitles | ( | ) |
Get a list of redirect resolutions - maps a title to its redirect target, as an array of output-ready arrays.
Definition at line 394 of file ApiPageSet.php.
References $mRedirectTitles.
Referenced by getRedirectTitlesAsResult().
ApiPageSet::getRedirectTitlesAsResult | ( | $result = null | ) |
Get a list of redirect resolutions - maps a title to its redirect target.
$result | ApiResult |
Definition at line 405 of file ApiPageSet.php.
References array(), as, and getRedirectTitles().
ApiPageSet::getRevisionCount | ( | ) |
Returns the number of revisions (requested with revids= parameter).
Definition at line 611 of file ApiPageSet.php.
References getRevisionIDs().
ApiPageSet::getRevisionIDs | ( | ) |
Get the list of revision IDs (requested with the revids= parameter)
Definition at line 567 of file ApiPageSet.php.
References $mGoodRevIDs.
Referenced by getRevisionCount().
ApiPageSet::getSpecialTitles | ( | ) |
Get the list of titles with negative namespace.
Definition at line 603 of file ApiPageSet.php.
References $mSpecialTitles.
Referenced by getInvalidTitlesAndRevisions().
ApiPageSet::getTitleCount | ( | ) |
Returns the number of unique pages (not revisions) in the set.
Definition at line 343 of file ApiPageSet.php.
ApiPageSet::getTitles | ( | ) |
All Title objects provided.
Definition at line 335 of file ApiPageSet.php.
References $mTitles.
|
private |
Does the same as initFromTitles(), but is based on page IDs instead.
array | $pageids | of page IDs |
Definition at line 730 of file ApiPageSet.php.
References $res, array(), getDB(), getPageTableFields(), getPositiveIntegers(), initFromQueryResult(), ApiBase\profileDBIn(), ApiBase\profileDBOut(), and resolvePendingRedirects().
Referenced by executeInternal(), initFromRevIDs(), and populateFromPageIDs().
|
private |
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.
$res | ResultWrapper DB Query result | |
array | $remaining | of either pageID or ns/title elements (optional). If given, any missing items will go to $mMissingPageIDs and $mMissingTitles |
bool | $processTitles | Must be provided together with $remaining. If true, treat $remaining as an array of [ns][title] If false, treat it as an array of [pageIDs] |
Definition at line 770 of file ApiPageSet.php.
References $mFakePageId, $res, $title, array(), as, ApiBase\dieDebug(), MWNamespace\hasGenderDistinction(), Title\makeTitle(), processDbRow(), and GenderCache\singleton().
Referenced by initFromPageIds(), initFromTitles(), populateFromQueryResult(), and resolvePendingRedirects().
|
private |
Does the same as initFromTitles(), but is based on revision IDs instead.
array | $revids | of revision IDs |
Definition at line 837 of file ApiPageSet.php.
References $res, $tables, array(), as, getDB(), getPositiveIntegers(), initFromPageIds(), ApiBase\profileDBIn(), and ApiBase\profileDBOut().
Referenced by executeInternal(), and populateFromRevisionIDs().
|
private |
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
array | $titles | of Title objects or strings |
Definition at line 703 of file ApiPageSet.php.
References $res, $titles, getDB(), getPageTableFields(), initFromQueryResult(), processTitlesArray(), ApiBase\profileDBIn(), ApiBase\profileDBOut(), and resolvePendingRedirects().
Referenced by executeInternal(), and populateFromTitles().
ApiPageSet::isResolvingRedirects | ( | ) |
Check whether this PageSet is resolving redirects.
Definition at line 246 of file ApiPageSet.php.
References $mResolveRedirects.
ApiPageSet::populateFromPageIDs | ( | $pageIDs | ) |
Populate this PageSet from a list of page IDs.
array | $pageIDs | of page IDs |
Definition at line 629 of file ApiPageSet.php.
References initFromPageIds(), ApiBase\profileIn(), and ApiBase\profileOut().
ApiPageSet::populateFromQueryResult | ( | $db, | |
$queryResult | |||
) |
Populate this PageSet from a rowset returned from the database.
$db | DatabaseBase object |
$queryResult | ResultWrapper Query result object |
Definition at line 640 of file ApiPageSet.php.
References initFromQueryResult(), ApiBase\profileIn(), and ApiBase\profileOut().
ApiPageSet::populateFromRevisionIDs | ( | $revIDs | ) |
Populate this PageSet from a list of revision IDs.
array | $revIDs | of revision IDs |
Definition at line 650 of file ApiPageSet.php.
References initFromRevIDs(), ApiBase\profileIn(), and ApiBase\profileOut().
ApiPageSet::populateFromTitles | ( | $titles | ) |
Populate this PageSet from a list of Titles.
array | $titles | of Title objects |
Definition at line 619 of file ApiPageSet.php.
References $titles, initFromTitles(), ApiBase\profileIn(), and ApiBase\profileOut().
ApiPageSet::processDbRow | ( | $row | ) |
Extract all requested fields from the row received from the database.
stdClass | $row | Result row |
Definition at line 660 of file ApiPageSet.php.
References $title, as, and Title\newFromRow().
Referenced by initFromQueryResult().
|
private |
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.
array | $titles | of Title objects or strings |
Definition at line 995 of file ApiPageSet.php.
References $mFakePageId, $title, $titles, $wgContLang, array(), as, global, MWNamespace\hasGenderDistinction(), Title\newFromText(), and GenderCache\singleton().
Referenced by initFromTitles().
ApiPageSet::requestField | ( | $fieldName | ) |
Request an additional field from the page table.
Must be called before execute()
string | $fieldName | Field name |
Definition at line 280 of file ApiPageSet.php.
|
private |
Resolve any redirects in the result if redirect resolution was requested.
This function is called repeatedly until all redirects have been resolved.
Definition at line 878 of file ApiPageSet.php.
References $res, getDB(), getPageTableFields(), getRedirectTargets(), initFromQueryResult(), ApiBase\profileDBIn(), and ApiBase\profileDBOut().
Referenced by executeInternal(), initFromPageIds(), and initFromTitles().
|
staticprivate |
Definition at line 1125 of file ApiPageSet.php.
Referenced by getGenerators().
|
private |
Definition at line 52 of file ApiPageSet.php.
|
private |
Definition at line 54 of file ApiPageSet.php.
Referenced by getAllTitlesByNamespace().
|
private |
Definition at line 69 of file ApiPageSet.php.
Referenced by getCacheMode().
|
private |
Definition at line 65 of file ApiPageSet.php.
Referenced by getConvertedTitles().
|
private |
Definition at line 51 of file ApiPageSet.php.
|
private |
Definition at line 48 of file ApiPageSet.php.
Referenced by executeInternal(), and getGenerators().
|
private |
Definition at line 73 of file ApiPageSet.php.
|
private |
Definition at line 68 of file ApiPageSet.php.
Referenced by initFromQueryResult(), and processTitlesArray().
|
private |
Definition at line 66 of file ApiPageSet.php.
Referenced by getRevisionIDs().
|
private |
Definition at line 56 of file ApiPageSet.php.
Referenced by getGoodTitles().
|
private |
Definition at line 63 of file ApiPageSet.php.
Referenced by getInterwikiTitles().
|
private |
Definition at line 58 of file ApiPageSet.php.
Referenced by getInvalidTitles().
|
private |
Definition at line 59 of file ApiPageSet.php.
Referenced by getMissingPageIDs().
|
private |
Definition at line 67 of file ApiPageSet.php.
Referenced by getMissingRevisionIDs().
|
private |
Definition at line 57 of file ApiPageSet.php.
Referenced by getMissingTitles().
|
private |
Definition at line 62 of file ApiPageSet.php.
Referenced by getNormalizedTitles().
|
private |
Definition at line 49 of file ApiPageSet.php.
|
private |
Definition at line 64 of file ApiPageSet.php.
|
private |
Definition at line 60 of file ApiPageSet.php.
Referenced by getRedirectTitles().
|
private |
Definition at line 70 of file ApiPageSet.php.
|
private |
Definition at line 50 of file ApiPageSet.php.
Referenced by isResolvingRedirects().
|
private |
Definition at line 61 of file ApiPageSet.php.
Referenced by getSpecialTitles().
|
private |
Definition at line 55 of file ApiPageSet.php.
Referenced by getTitles().
const ApiPageSet::DISABLE_GENERATORS = 1 |
Constructor flag: The new instance of ApiPageSet will ignore the 'generator=' parameter.
Definition at line 46 of file ApiPageSet.php.
Referenced by __construct(), and executeInternal().