MediaWiki
1.30.0
|
This class contains a list of pages that the client has requested. More...
Public Member Functions | |
__construct (ApiBase $dbSource, $flags=0, $defaultNamespace=NS_MAIN) | |
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... | |
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... | |
getDeletedRevisionIDs () | |
Get the list of revision IDs that were associated with deleted titles. More... | |
getGoodAndMissingTitles () | |
Title objects for good and missing titles. More... | |
getGoodAndMissingTitlesByNamespace () | |
Returns an array [ns][dbkey] => page_id for all good and missing titles. 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... | |
getGoodTitlesByNamespace () | |
Returns an array [ns][dbkey] => page_id for all good titles. 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... | |
getInvalidTitlesAndReasons () | |
Titles that were deemed invalid by Title::newFromText() The array's index will be unique and negative for each item. More... | |
getInvalidTitlesAndRevisions ( $invalidChecks=[ 'invalidTitles', 'special', 'missingIds', 'missingRevIds', 'missingTitles', 'interwikiTitles']) | |
Get an array of invalid/special/missing titles. More... | |
getLiveRevisionIDs () | |
Get the list of non-deleted revision IDs (requested with the revids= parameter) 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... | |
getMissingTitlesByNamespace () | |
Returns an array [ns][dbkey] => fake_page_id for all missing titles. 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... | |
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 valid 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... | |
populateGeneratorData (&$result, array $path=[]) | |
Populate the generator data for all titles in the result. 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... | |
setGeneratorData (Title $title, array $data) | |
Set data for a title. More... | |
setRedirectMergePolicy ( $callable) | |
Controls how generator data about a redirect source is merged into the generator data for the redirect target. More... | |
Public Member Functions inherited from ApiBase | |
__construct (ApiMain $mainModule, $moduleName, $modulePrefix='') | |
getModuleManager () | |
Get the module manager, or null if this module has no sub-modules. 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... | |
getHelpUrls () | |
Return links to more detailed help pages about the module. More... | |
shouldCheckMaxlag () | |
Indicates if this module needs maxlag to be checked. More... | |
isReadMode () | |
Indicates whether this module requires read rights. More... | |
isWriteMode () | |
Indicates whether this module requires write mode. More... | |
mustBePosted () | |
Indicates whether this module must be called with a POST request. More... | |
isDeprecated () | |
Indicates whether this module is deprecated. More... | |
isInternal () | |
Indicates whether this module is "internal" Internal API modules are not (yet) intended for 3rd party use and may be unstable. More... | |
needsToken () | |
Returns the token type this module requires in order to execute. More... | |
getConditionalRequestData ( $condition) | |
Returns data for HTTP conditional request mechanisms. 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... | |
getMain () | |
Get the main module. More... | |
isMain () | |
Returns true if this module is the main module ($this === $this->mMainModule), false otherwise. More... | |
getParent () | |
Get the parent of this module. More... | |
lacksSameOriginSecurity () | |
Returns true if the current request breaks the same-origin policy. More... | |
getModulePath () | |
Get the path to this module. More... | |
getModuleFromPath ( $path) | |
Get a module from its module path. More... | |
getResult () | |
Get the result object. More... | |
getErrorFormatter () | |
Get the error formatter. More... | |
getContinuationManager () | |
Get the continuation manager. More... | |
setContinuationManager ( $manager) | |
Set the continuation manager. More... | |
dynamicParameterDocumentation () | |
Indicate if the module supports dynamically-determined parameters that cannot be included in self::getAllowedParams(). 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... | |
requireOnlyOneParameter ( $params, $required) | |
Die if none or more than one of a certain set of parameters is set and not false. More... | |
requireMaxOneParameter ( $params, $required) | |
Die if more than one of a certain set of parameters is set and not false. More... | |
requireAtLeastOneParameter ( $params, $required) | |
Die if none of a certain set of parameters is set and not false. More... | |
requirePostedParameters ( $params, $prefix='prefix') | |
Die if any of the specified parameters were found in the query part of the URL rather than the post body. More... | |
getTitleOrPageId ( $params, $load=false) | |
Get a WikiPage object from a title or pageid param, if possible. More... | |
getTitleFromTitleOrPageId ( $params) | |
Get a Title object from a title or pageid param, if possible. More... | |
validateToken ( $token, array $params) | |
Validate the supplied token. More... | |
getWatchlistUser ( $params) | |
Gets the user for whom to get the watchlist. More... | |
errorArrayToStatus (array $errors, User $user=null) | |
Turn an array of message keys or key+param arrays into a Status. More... | |
addWarning ( $msg, $code=null, $data=null) | |
Add a warning for this module. More... | |
addDeprecation ( $msg, $feature, $data=[]) | |
Add a deprecation warning for this module. More... | |
addError ( $msg, $code=null, $data=null) | |
Add an error for this module without aborting. More... | |
addMessagesFromStatus (StatusValue $status, $types=[ 'warning', 'error']) | |
Add warnings and/or errors from a Status. More... | |
dieWithError ( $msg, $code=null, $data=null, $httpCode=null) | |
Abort execution with an error. More... | |
dieWithException ( $exception, array $options=[]) | |
Abort execution with an error derived from an exception. More... | |
dieBlocked (Block $block) | |
Throw an ApiUsageException, which will (if uncaught) call the main module's error handler and die with an error message including block info. More... | |
dieStatus (StatusValue $status) | |
Throw an ApiUsageException based on the Status object. More... | |
dieReadOnly () | |
Helper function for readonly errors. More... | |
checkUserRightsAny ( $rights, $user=null) | |
Helper function for permission-denied errors. More... | |
checkTitleUserPermissions (Title $title, $actions, $user=null) | |
Helper function for permission-denied errors. More... | |
dieWithErrorOrDebug ( $msg, $code=null, $data=null, $httpCode=null) | |
Will only set a warning instead of failing if the global $wgDebugAPI is set to true. More... | |
logFeatureUsage ( $feature) | |
Write logging information for API features to a debug log, for usage analysis. More... | |
getFinalSummary () | |
Get final module summary. More... | |
getFinalDescription () | |
Get final module description, 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... | |
getFinalParamDescription () | |
Get final parameter descriptions, after hooks have had a chance to tweak it as needed. More... | |
modifyHelp (array &$help, array $options, array &$tocData) | |
Called from ApiHelp before the pieces are joined together and returned. More... | |
getModuleProfileName ( $db=false) | |
profileIn () | |
profileOut () | |
safeProfileOut () | |
getProfileTime () | |
profileDBIn () | |
profileDBOut () | |
getProfileDBTime () | |
setWarning ( $warning) | |
dieUsage ( $description, $errorCode, $httpRespCode=0, $extradata=null) | |
Throw an ApiUsageException, which will (if uncaught) call the main module's error handler and die with an error message. More... | |
getErrorFromStatus ( $status, &$extraData=null) | |
Get error (as code, string) from a Status object. More... | |
parseMsg ( $error) | |
Return the error message related to a certain array. 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... | |
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 base IContextSource 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... | |
getStats () | |
Get the Stats object. More... | |
getTiming () | |
Get the Timing object. More... | |
getTitle () | |
Get the Title object. More... | |
getUser () | |
Get the User object. More... | |
getWikiPage () | |
Get the WikiPage object. More... | |
msg ( $key) | |
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 | |
string | $mModulePrefix |
const | ALL_DEFAULT_STRING = '*' |
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 |
Fast query, standard limit. More... | |
const | LIMIT_BIG2 = 5000 |
Fast query, apihighlimits limit. More... | |
const | LIMIT_SML1 = 50 |
Slow query, standard limit. More... | |
const | LIMIT_SML2 = 500 |
Slow query, apihighlimits limit. More... | |
const | PARAM_DFLT = 0 |
(null|boolean|integer|string) Default value of the parameter. More... | |
const | PARAM_ISMULTI = 1 |
(boolean) Accept multiple pipe-separated values for this parameter (e.g. More... | |
const | PARAM_TYPE = 2 |
(string|string[]) Either an array of allowed value strings, or a string type as described below. More... | |
const | PARAM_MAX = 3 |
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'. More... | |
const | PARAM_MAX2 = 4 |
(integer) Max value allowed for the parameter for users with the apihighlimits right, for PARAM_TYPE 'limit'. More... | |
const | PARAM_MIN = 5 |
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'. More... | |
const | PARAM_ALLOW_DUPLICATES = 6 |
(boolean) Allow the same value to be set more than once when PARAM_ISMULTI is true? More... | |
const | PARAM_DEPRECATED = 7 |
(boolean) Is the parameter deprecated (will show a warning)? More... | |
const | PARAM_REQUIRED = 8 |
(boolean) Is the parameter required? More... | |
const | PARAM_RANGE_ENFORCE = 9 |
(boolean) For PARAM_TYPE 'integer', enforce PARAM_MIN and PARAM_MAX? More... | |
const | PARAM_HELP_MSG = 10 |
(string|array|Message) Specify an alternative i18n documentation message for this parameter. More... | |
const | PARAM_HELP_MSG_APPEND = 11 |
((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this parameter. More... | |
const | PARAM_HELP_MSG_INFO = 12 |
(array) Specify additional information tags for the parameter. More... | |
const | PARAM_VALUE_LINKS = 13 |
(string[]) When PARAM_TYPE is an array, this may be an array mapping those values to page titles which will be linked in the help. More... | |
const | PARAM_HELP_MSG_PER_VALUE = 14 |
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg for ApiBase::makeMessage(). More... | |
const | PARAM_SUBMODULE_MAP = 15 |
(string[]) When PARAM_TYPE is 'submodule', map parameter values to submodule paths. More... | |
const | PARAM_SUBMODULE_PARAM_PREFIX = 16 |
(string) When PARAM_TYPE is 'submodule', used to indicate the 'g' prefix added by ApiQueryGeneratorBase (and similar if anything else ever does that). More... | |
const | PARAM_ALL = 17 |
(boolean|string) When PARAM_TYPE has a defined set of values and PARAM_ISMULTI is true, this allows for an asterisk ('*') to be passed in place of a pipe-separated list of every possible value. More... | |
const | PARAM_EXTRA_NAMESPACES = 18 |
(int[]) When PARAM_TYPE is 'namespace', include these as additional possible values. More... | |
const | PARAM_SENSITIVE = 19 |
(boolean) Is the parameter sensitive? Note 'password'-type fields are always sensitive regardless of the value of this field. More... | |
const | PARAM_DEPRECATED_VALUES = 20 |
(array) When PARAM_TYPE is an array, this indicates which of the values are deprecated. More... | |
const | PARAM_ISMULTI_LIMIT1 = 21 |
(integer) Maximum number of values, for normal users. More... | |
const | PARAM_ISMULTI_LIMIT2 = 22 |
(integer) Maximum number of values, for users with the apihighimits right. More... | |
Protected Member Functions | |
getDB () | |
Get the database connection (read-only) More... | |
handleParamNormalization ( $paramName, $value, $rawValue) | |
Handle when a parameter was Unicode-normalized. More... | |
Protected Member Functions inherited from ApiBase | |
getExamplesMessages () | |
Returns usage examples for this module. 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... | |
getWebUITokenSalt (array $params) | |
Fetch the salt used in the Web UI corresponding to this module. More... | |
getParameter ( $paramName, $parseLimit=true) | |
Get a value for the given parameter. More... | |
getWatchlistValue ( $watchlist, $titleObj, $userOption=null) | |
Return true if we're to watch the page, false if not, null if no change. More... | |
getParameterFromSettings ( $paramName, $paramSettings, $parseLimit) | |
Using the settings determine the value for the given parameter. More... | |
explodeMultiValue ( $value, $limit) | |
Split a multi-valued parameter string, like explode() More... | |
parseMultiValue ( $valueName, $value, $allowMultiple, $allowedValues, $allSpecifier=null, $limit1=null, $limit2=null) | |
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... | |
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... | |
setWatch ( $watch, $titleObj, $userOption=null) | |
Set a watch (or unwatch) based the based on a watchlist parameter. More... | |
dieContinueUsageIf ( $condition) | |
Die with the 'badcontinue' error. More... | |
getSummaryMessage () | |
Return the summary message. More... | |
getExtendedDescription () | |
Return the extended help text message. More... | |
getHelpFlags () | |
Generates the list of flags for the help screen and for action=paraminfo. More... | |
getModuleSourceInfo () | |
Returns information about the source of this module, if known. More... | |
getDescription () | |
Returns the description string for this module. More... | |
getParamDescription () | |
Returns an array of parameter descriptions. More... | |
getExamples () | |
Returns usage examples for this module. More... | |
useTransactionalTimeLimit () | |
Call wfTransactionalTimeLimit() if this request was POSTed. More... | |
getDescriptionMessage () | |
Return the description message. 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, $flags=[], $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 = [] | |
$mAllSpecials = [] | |
$mCacheMode = 'public' | |
$mConvertedTitles = [] | |
$mConvertTitles | |
$mDbSource | |
int | $mDefaultNamespace = NS_MAIN |
$mDeletedRevIDs = [] | |
$mFakePageId = -1 | |
$mGeneratorData = [] | |
$mGoodAndMissingPages = [] | |
$mGoodPages = [] | |
$mGoodRevIDs = [] | |
$mGoodTitles = [] | |
$mInterwikiTitles = [] | |
array | $mInvalidTitles = [] |
[fake_page_id] => [ 'title' => $title, 'invalidreason' => $reason ] More... | |
$mLiveRevIDs = [] | |
$mMissingPageIDs = [] | |
$mMissingPages = [] | |
$mMissingRevIDs = [] | |
$mMissingTitles = [] | |
$mNormalizedTitles = [] | |
$mParams | |
Title[] | $mPendingRedirectIDs = [] |
$mPendingRedirectSpecialPages = [] | |
callable null | $mRedirectMergePolicy |
$mRedirectTitles = [] | |
$mRequestedPageFields = [] | |
$mResolvedRedirectTitles = [] | |
$mResolveRedirects | |
$mSpecialTitles = [] | |
$mTitles = [] | |
Static Private Attributes | |
static | $generators = null |
Additional Inherited Members | |
Static Public Member Functions inherited from ApiBase | |
static | truncateArray (&$arr, $limit) |
Truncate an array to a certain length. More... | |
static | makeMessage ( $msg, IContextSource $context, array $params=null) |
Create a Message from a string or array. More... | |
Static Protected Member Functions inherited from ApiBase | |
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 44 of file ApiPageSet.php.
ApiBase | $dbSource | 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 121 of file ApiPageSet.php.
References $flags, DISABLE_GENERATORS, ApiBase\extractRequestParams(), ApiBase\getMain(), and ApiBase\getModuleName().
|
staticprivate |
Add all items from $values into the result.
array | $result | Output |
array | $values | Values to add |
string[] | $flags | The names of boolean flags to mark this element |
string | $name | If given, name of the value |
Definition at line 97 of file ApiPageSet.php.
References $flags, $name, ApiQueryBase\addTitleInfo(), and as.
Referenced by getInvalidTitlesAndRevisions().
ApiPageSet::execute | ( | ) |
Populate the PageSet from the request parameters.
Reimplemented from ApiBase.
Definition at line 143 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 136 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 152 of file ApiPageSet.php.
References $generator, $mDbSource, ApiBase\addWarning(), as, ApiBase\dieWithError(), ApiBase\encodeParamName(), ApiBase\getMain(), initFromPageIds(), initFromRevIDs(), initFromTitles(), resolvePendingRedirects(), and Hooks\run().
Referenced by execute(), and executeDryRun().
ApiPageSet::getAllowedParams | ( | $flags = 0 | ) |
Definition at line 1454 of file ApiPageSet.php.
References $flags, ApiBase\GET_VALUES_FOR_HELP, getGenerators(), ApiBase\PARAM_DFLT, ApiBase\PARAM_HELP_MSG, ApiBase\PARAM_ISMULTI, ApiBase\PARAM_SUBMODULE_MAP, ApiBase\PARAM_SUBMODULE_PARAM_PREFIX, 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 347 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.
array | null | $params |
Definition at line 1161 of file ApiPageSet.php.
References $mCacheMode.
ApiPageSet::getConvertedTitles | ( | ) |
Get a list of title conversions - maps a title to its converted version.
Definition at line 542 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.
ApiResult | $result |
Definition at line 553 of file ApiPageSet.php.
References as, getConvertedTitles(), and ApiResult\setIndexedTagName().
ApiPageSet::getCustomField | ( | $fieldName | ) |
Get the value of a custom field previously requested through requestField()
string | $fieldName | Field name |
Definition at line 301 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 269 of file ApiPageSet.php.
|
protected |
Get the database connection (read-only)
Reimplemented from ApiBase.
Definition at line 1431 of file ApiPageSet.php.
Referenced by getRedirectTargets(), initFromPageIds(), initFromRevIDs(), initFromTitles(), and resolvePendingRedirects().
ApiPageSet::getDeletedRevisionIDs | ( | ) |
Get the list of revision IDs that were associated with deleted titles.
Definition at line 685 of file ApiPageSet.php.
References $mDeletedRevIDs.
|
private |
Get an array of all available generators.
Definition at line 1523 of file ApiPageSet.php.
References $generators, $mDbSource, $name, $query, as, and ApiBase\getMain().
Referenced by getAllowedParams().
ApiPageSet::getGoodAndMissingTitles | ( | ) |
Title objects for good and missing titles.
Definition at line 421 of file ApiPageSet.php.
References $mMissingTitles.
ApiPageSet::getGoodAndMissingTitlesByNamespace | ( | ) |
Returns an array [ns][dbkey] => page_id for all good and missing titles.
Definition at line 413 of file ApiPageSet.php.
References $mGoodAndMissingPages.
ApiPageSet::getGoodTitleCount | ( | ) |
Returns the number of found unique pages (not revisions) in the set.
Definition at line 387 of file ApiPageSet.php.
References captcha-old\count.
ApiPageSet::getGoodTitles | ( | ) |
Title objects that were found in the database.
Definition at line 379 of file ApiPageSet.php.
References $mGoodTitles.
ApiPageSet::getGoodTitlesByNamespace | ( | ) |
Returns an array [ns][dbkey] => page_id for all good titles.
Definition at line 371 of file ApiPageSet.php.
References $mGoodPages.
ApiPageSet::getInterwikiTitles | ( | ) |
Get a list of interwiki titles - maps a title to its interwiki prefix.
Definition at line 573 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.
ApiResult | $result | |
bool | $iwUrl |
Definition at line 585 of file ApiPageSet.php.
References $title, as, getInterwikiTitles(), Title\newFromText(), PROTO_CURRENT, and ApiResult\setIndexedTagName().
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 431 of file ApiPageSet.php.
References $mInvalidTitles, $t, and wfDeprecated().
ApiPageSet::getInvalidTitlesAndReasons | ( | ) |
Titles that were deemed invalid by Title::newFromText() The array's index will be unique and negative for each item.
Definition at line 443 of file ApiPageSet.php.
References $mInvalidTitles.
Referenced by getInvalidTitlesAndRevisions().
ApiPageSet::getInvalidTitlesAndRevisions | ( | $invalidChecks = [ 'invalidTitles' , |
|
'special' | , | ||
'missingIds' | , | ||
'missingRevIds' | , | ||
'missingTitles' | , | ||
'interwikiTitles'] | |||
) |
Get an array of invalid/special/missing titles.
array | $invalidChecks | List of types of invalid titles to include. Recognized values are:
|
Definition at line 619 of file ApiPageSet.php.
References $title, addValues(), as, getInterwikiTitlesAsResult(), getInvalidTitlesAndReasons(), getMissingPageIDs(), getMissingRevisionIDs(), getMissingTitles(), and getSpecialTitles().
ApiPageSet::getLiveRevisionIDs | ( | ) |
Get the list of non-deleted revision IDs (requested with the revids= parameter)
Definition at line 677 of file ApiPageSet.php.
References $mLiveRevIDs.
ApiPageSet::getMissingPageIDs | ( | ) |
Page IDs that were not found in the database.
Definition at line 451 of file ApiPageSet.php.
References $mMissingPageIDs.
Referenced by getInvalidTitlesAndRevisions().
ApiPageSet::getMissingRevisionIDs | ( | ) |
Revision IDs that were not found in the database.
Definition at line 693 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.
ApiResult | $result |
Definition at line 703 of file ApiPageSet.php.
References as, getMissingRevisionIDs(), and ApiResult\setIndexedTagName().
ApiPageSet::getMissingTitles | ( | ) |
Title objects that were NOT found in the database.
The array's index will be negative for each item
Definition at line 405 of file ApiPageSet.php.
References $mMissingTitles.
Referenced by getInvalidTitlesAndRevisions().
ApiPageSet::getMissingTitlesByNamespace | ( | ) |
Returns an array [ns][dbkey] => fake_page_id for all missing titles.
fake_page_id is a unique negative number.
Definition at line 396 of file ApiPageSet.php.
References $mMissingPages.
ApiPageSet::getNormalizedTitles | ( | ) |
Get a list of title normalizations - maps a title to its normalized version.
Definition at line 507 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.
ApiResult | $result |
Definition at line 518 of file ApiPageSet.php.
References $wgContLang, as, getNormalizedTitles(), global, and ApiResult\setIndexedTagName().
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 311 of file ApiPageSet.php.
References as, ContextSource\getConfig(), and LinkCache\getSelectFields().
Referenced by initFromPageIds(), initFromTitles(), and resolvePendingRedirects().
|
staticprivate |
Returns the input array of integers with all values < 0 removed.
array | $array |
Definition at line 1441 of file ApiPageSet.php.
References as.
Referenced by initFromPageIds(), and initFromRevIDs().
|
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 1069 of file ApiPageSet.php.
References $res, $title, as, WikiPage\factory(), getDB(), list, Title\makeTitle(), and processTitlesArray().
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 460 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.
Includes generator data for redirect source when available.
ApiResult | $result |
Definition at line 471 of file ApiPageSet.php.
References as, getRedirectTitles(), and ApiResult\setIndexedTagName().
ApiPageSet::getRevisionCount | ( | ) |
Returns the number of revisions (requested with revids= parameter).
Definition at line 729 of file ApiPageSet.php.
References captcha-old\count, and getRevisionIDs().
ApiPageSet::getRevisionIDs | ( | ) |
Get the list of valid revision IDs (requested with the revids= parameter)
Definition at line 669 of file ApiPageSet.php.
References $mGoodRevIDs.
Referenced by getRevisionCount().
ApiPageSet::getSpecialTitles | ( | ) |
Get the list of titles with negative namespace.
Definition at line 721 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 363 of file ApiPageSet.php.
References captcha-old\count.
ApiPageSet::getTitles | ( | ) |
All Title objects provided.
Definition at line 355 of file ApiPageSet.php.
References $mTitles.
|
protected |
Handle when a parameter was Unicode-normalized.
string | $paramName | Unprefixed parameter name |
string | $value | Input that will be used. |
string | $rawValue | Input before normalization. |
Reimplemented from ApiBase.
Definition at line 1500 of file ApiPageSet.php.
References $value, captcha-old\count, and ApiBase\explodeMultiValue().
|
private |
Does the same as initFromTitles(), but is based on page IDs instead.
array | $pageids | Array of page IDs |
Definition at line 840 of file ApiPageSet.php.
References $res, getDB(), getPageTableFields(), getPositiveIntegers(), initFromQueryResult(), 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.
ResultWrapper | $res | DB Query result |
array | $remaining | Array 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 878 of file ApiPageSet.php.
References $mFakePageId, $res, $title, as, ApiBase\dieDebug(), MWNamespace\hasGenderDistinction(), Title\makeTitle(), processDbRow(), and LinkCache\singleton().
Referenced by initFromPageIds(), initFromTitles(), populateFromQueryResult(), and resolvePendingRedirects().
|
private |
Does the same as initFromTitles(), but is based on revision IDs instead.
array | $revids | Array of revision IDs |
Definition at line 949 of file ApiPageSet.php.
References $mMissingRevIDs, $res, $tables, $title, $titles, as, getDB(), getPositiveIntegers(), ContextSource\getUser(), initFromPageIds(), initFromTitles(), Title\makeTitle(), and Title\newFromText().
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 | Array of Title objects or strings |
Definition at line 813 of file ApiPageSet.php.
References $res, $titles, getDB(), getPageTableFields(), initFromQueryResult(), processTitlesArray(), and resolvePendingRedirects().
Referenced by executeInternal(), initFromRevIDs(), and populateFromTitles().
ApiPageSet::isResolvingRedirects | ( | ) |
Check whether this PageSet is resolving redirects.
Definition at line 257 of file ApiPageSet.php.
References $mResolveRedirects.
ApiPageSet::populateFromPageIDs | ( | $pageIDs | ) |
Populate this PageSet from a list of page IDs.
array | $pageIDs | Array of page IDs |
Definition at line 745 of file ApiPageSet.php.
References initFromPageIds().
ApiPageSet::populateFromQueryResult | ( | $db, | |
$queryResult | |||
) |
Populate this PageSet from a rowset returned from the database.
Note that the query result must include the columns returned by $this->getPageTableFields().
IDatabase | $db | |
ResultWrapper | $queryResult | Query result object |
Definition at line 758 of file ApiPageSet.php.
References initFromQueryResult().
ApiPageSet::populateFromRevisionIDs | ( | $revIDs | ) |
Populate this PageSet from a list of revision IDs.
array | $revIDs | Array of revision IDs |
Definition at line 766 of file ApiPageSet.php.
References initFromRevIDs().
ApiPageSet::populateFromTitles | ( | $titles | ) |
Populate this PageSet from a list of Titles.
array | $titles | Array of Title objects |
Definition at line 737 of file ApiPageSet.php.
References $titles, and initFromTitles().
ApiPageSet::populateGeneratorData | ( | & | $result, |
array | $path = [] |
||
) |
Populate the generator data for all titles in the result.
The page data may be inserted into an ApiResult object or into an associative array. The $path parameter specifies the path within the ApiResult or array to find the "pages" node.
The "pages" node itself must be an associative array mapping the page ID or fake page ID values returned by this pageset (see self::getAllTitlesByNamespace() and self::getSpecialTitles()) to associative arrays of page data. Each of those subarrays will have the data from self::setGeneratorData() merged in.
Data that was set by self::setGeneratorData() for pages not in the "pages" node will be ignored.
ApiResult | array | &$result | |
array | $path |
Definition at line 1341 of file ApiPageSet.php.
References $path, $title, $value, as, NS_SPECIAL, and ApiResult\OVERRIDE.
ApiPageSet::processDbRow | ( | $row | ) |
Extract all requested fields from the row received from the database.
stdClass | $row | Result row |
Definition at line 774 of file ApiPageSet.php.
References $title, as, Title\newFromRow(), and LinkCache\singleton().
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 | Array of Title objects or strings |
Definition at line 1174 of file ApiPageSet.php.
References ContextSource\$context, $mFakePageId, $special, $title, $titles, $wgContLang, as, captcha-old\count, ApiBase\getErrorFormatter(), SpecialPageFactory\getPage(), global, MWNamespace\hasGenderDistinction(), list, Title\newFromTextThrow(), NS_SPECIAL, and SpecialPageFactory\resolveAlias().
Referenced by getRedirectTargets(), and initFromTitles().
ApiPageSet::requestField | ( | $fieldName | ) |
Request an additional field from the page table.
Must be called before execute()
string | $fieldName | Field name |
Definition at line 291 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 1032 of file ApiPageSet.php.
References $res, getDB(), getPageTableFields(), getRedirectTargets(), and initFromQueryResult().
Referenced by executeInternal(), initFromPageIds(), and initFromTitles().
Set data for a title.
This data may be extracted into an ApiResult using self::populateGeneratorData. This should generally be limited to data that is likely to be particularly useful to end users rather than just being a dump of everything returned in non-generator mode.
Redirects here will not be followed, even if 'redirects' was specified, since in the case of multiple redirects we can't know which source's data to use on the target.
Title | $title | |
array | $data |
Definition at line 1292 of file ApiPageSet.php.
References $title.
ApiPageSet::setRedirectMergePolicy | ( | $callable | ) |
Controls how generator data about a redirect source is merged into the generator data for the redirect target.
When not set no data is merged. Note that if multiple titles redirect to the same target the order of operations is undefined.
Example to include generated data from redirect in target, prefering the data generated for the destination when there is a collision:
callable | null | $callable | Recieves two array arguments, first the generator data for the redirect target and second the generator data for the redirect source. Returns the resulting generator data to use for the redirect target. |
Definition at line 1317 of file ApiPageSet.php.
|
staticprivate |
Definition at line 1517 of file ApiPageSet.php.
Referenced by getGenerators().
|
private |
Definition at line 55 of file ApiPageSet.php.
|
private |
Definition at line 57 of file ApiPageSet.php.
Referenced by getAllTitlesByNamespace().
|
private |
Definition at line 69 of file ApiPageSet.php.
|
private |
Definition at line 83 of file ApiPageSet.php.
Referenced by getCacheMode().
|
private |
Definition at line 76 of file ApiPageSet.php.
Referenced by getConvertedTitles().
|
private |
Definition at line 54 of file ApiPageSet.php.
|
private |
Definition at line 51 of file ApiPageSet.php.
Referenced by executeInternal(), and getGenerators().
|
private |
Definition at line 86 of file ApiPageSet.php.
|
private |
Definition at line 79 of file ApiPageSet.php.
Referenced by getDeletedRevisionIDs().
|
private |
Definition at line 82 of file ApiPageSet.php.
Referenced by initFromQueryResult(), and processTitlesArray().
|
private |
Definition at line 81 of file ApiPageSet.php.
|
private |
Definition at line 59 of file ApiPageSet.php.
Referenced by getGoodAndMissingTitlesByNamespace().
|
private |
Definition at line 60 of file ApiPageSet.php.
Referenced by getGoodTitlesByNamespace().
|
private |
Definition at line 77 of file ApiPageSet.php.
Referenced by getRevisionIDs().
|
private |
Definition at line 61 of file ApiPageSet.php.
Referenced by getGoodTitles().
|
private |
Definition at line 71 of file ApiPageSet.php.
Referenced by getInterwikiTitles().
|
private |
[fake_page_id] => [ 'title' => $title, 'invalidreason' => $reason ]
Definition at line 65 of file ApiPageSet.php.
Referenced by getInvalidTitles(), and getInvalidTitlesAndReasons().
|
private |
Definition at line 78 of file ApiPageSet.php.
Referenced by getLiveRevisionIDs().
|
private |
Definition at line 66 of file ApiPageSet.php.
Referenced by getMissingPageIDs().
|
private |
Definition at line 62 of file ApiPageSet.php.
Referenced by getMissingTitlesByNamespace().
|
private |
Definition at line 80 of file ApiPageSet.php.
Referenced by getMissingRevisionIDs(), and initFromRevIDs().
|
private |
Definition at line 63 of file ApiPageSet.php.
Referenced by getGoodAndMissingTitles(), and getMissingTitles().
|
private |
Definition at line 70 of file ApiPageSet.php.
Referenced by getNormalizedTitles().
|
private |
Definition at line 52 of file ApiPageSet.php.
|
private |
Definition at line 73 of file ApiPageSet.php.
|
private |
Definition at line 74 of file ApiPageSet.php.
|
private |
Definition at line 88 of file ApiPageSet.php.
|
private |
Definition at line 67 of file ApiPageSet.php.
Referenced by getRedirectTitles().
|
private |
Definition at line 84 of file ApiPageSet.php.
|
private |
Definition at line 75 of file ApiPageSet.php.
|
private |
Definition at line 53 of file ApiPageSet.php.
Referenced by isResolvingRedirects().
|
private |
Definition at line 68 of file ApiPageSet.php.
Referenced by getSpecialTitles().
|
private |
Definition at line 58 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 49 of file ApiPageSet.php.
Referenced by __construct().