94 foreach ( $values
as $val ) {
95 if ( $val instanceof
Title ) {
98 } elseif (
$name !==
null ) {
99 $v = [
$name => $val ];
103 foreach ( $flags
as $flag ) {
119 $this->mDbSource = $dbSource;
121 $this->mDefaultNamespace = $defaultNamespace;
124 $this->mResolveRedirects = $this->mParams[
'redirects'];
125 $this->mConvertTitles = $this->mParams[
'converttitles'];
149 $generatorName = $this->mAllowGenerator ? $this->mParams[
'generator'] :
null;
150 if ( isset( $generatorName ) ) {
152 if ( !$dbSource instanceof
ApiQuery ) {
154 $dbSource = $this->
getMain()->getModuleManager()->getModule(
'query' );
156 $generator = $dbSource->getModuleManager()->getModule( $generatorName,
null,
true );
158 $this->
dieWithError( [
'apierror-badgenerator-unknown', $generatorName ],
'badgenerator' );
161 $this->
dieWithError( [
'apierror-badgenerator-notgenerator', $generatorName ],
'badgenerator' );
165 $tmpPageSet =
new ApiPageSet( $dbSource, self::DISABLE_GENERATORS );
172 $tmpPageSet->executeInternal( $isDryRun );
180 Hooks::run(
'APIQueryGeneratorAfterExecute', [ &
$generator, &$apiModule ] );
184 foreach (
$generator->extractRequestParams()
as $paramName => $param ) {
185 $main->markParamsUsed(
$generator->encodeParamName( $paramName ) );
195 if ( isset( $this->mParams[
'titles'] ) ) {
196 $dataSource =
'titles';
198 if ( isset( $this->mParams[
'pageids'] ) ) {
199 if ( isset( $dataSource ) ) {
202 'apierror-invalidparammix-cannotusewith',
209 $dataSource =
'pageids';
211 if ( isset( $this->mParams[
'revids'] ) ) {
212 if ( isset( $dataSource ) ) {
215 'apierror-invalidparammix-cannotusewith',
222 $dataSource =
'revids';
227 switch ( $dataSource ) {
235 if ( $this->mResolveRedirects ) {
236 $this->
addWarning(
'apiwarn-redirectsandrevids' );
238 $this->mResolveRedirects =
false;
266 if ( $this->mAllowGenerator && isset( $this->mParams[
'generator'] ) ) {
269 if ( isset( $this->mParams[
'titles'] ) ) {
272 if ( isset( $this->mParams[
'pageids'] ) ) {
275 if ( isset( $this->mParams[
'revids'] ) ) {
288 $this->mRequestedPageFields[$fieldName] =
null;
298 return $this->mRequestedPageFields[$fieldName];
311 'page_namespace' =>
null,
312 'page_title' =>
null,
316 if ( $this->mResolveRedirects ) {
317 $pageFlds[
'page_is_redirect'] =
null;
320 if ( $this->
getConfig()->
get(
'ContentHandlerUseDB' ) ) {
321 $pageFlds[
'page_content_model'] =
null;
324 if ( $this->
getConfig()->
get(
'PageLanguageUseDB' ) ) {
325 $pageFlds[
'page_lang'] =
null;
328 foreach ( LinkCache::getSelectFields()
as $field ) {
329 $pageFlds[$field] =
null;
332 $pageFlds = array_merge( $pageFlds, $this->mRequestedPageFields );
334 return array_keys( $pageFlds );
360 return count( $this->mTitles );
384 return count( $this->mGoodTitles );
458 'from' => strval( $titleStrFrom ),
459 'to' => $titleTo->getPrefixedText(),
461 if ( $titleTo->hasFragment() ) {
462 $r[
'tofragment'] = $titleTo->getFragment();
464 if ( $titleTo->isExternal() ) {
465 $r[
'tointerwiki'] = $titleTo->getInterwiki();
467 if ( isset( $this->mResolvedRedirectTitles[$titleStrFrom] ) ) {
468 $titleFrom = $this->mResolvedRedirectTitles[$titleStrFrom];
469 $ns = $titleFrom->getNamespace();
470 $dbkey = $titleFrom->getDBkey();
471 if ( isset( $this->mGeneratorData[$ns][$dbkey] ) ) {
472 $r = array_merge( $this->mGeneratorData[$ns][$dbkey], $r );
478 if ( !empty( $values ) &&
$result ) {
503 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
505 $encode = $contLang->normalize( $rawTitleStr ) !== $rawTitleStr;
507 'fromencoded' => $encode,
508 'from' => $encode ? rawurlencode( $rawTitleStr ) : $rawTitleStr,
512 if ( !empty( $values ) &&
$result ) {
539 'from' => $rawTitleStr,
543 if ( !empty( $values ) &&
$result ) {
571 'title' => $rawTitleStr,
572 'iw' => $interwikiStr,
575 $title = Title::newFromText( $rawTitleStr );
580 if ( !empty( $values ) &&
$result ) {
602 'special',
'missingIds',
'missingRevIds',
'missingTitles',
'interwikiTitles' ]
605 if ( in_array(
'invalidTitles', $invalidChecks ) ) {
608 if ( in_array(
'special', $invalidChecks ) ) {
612 if (
$title->isKnown() ) {
621 if ( in_array(
'missingIds', $invalidChecks ) ) {
624 if ( in_array(
'missingRevIds', $invalidChecks ) ) {
627 if ( in_array(
'missingTitles', $invalidChecks ) ) {
631 if (
$title->isKnown() ) {
640 if ( in_array(
'interwikiTitles', $invalidChecks ) ) {
692 if ( !empty( $values ) &&
$result ) {
758 $title = Title::newFromRow( $row );
760 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
761 $linkCache->addGoodLinkObjFromRow(
$title, $row );
763 $pageId = (int)$row->page_id;
764 $this->mAllPages[$row->page_namespace][$row->page_title] = $pageId;
765 $this->mTitles[] =
$title;
767 if ( $this->mResolveRedirects && $row->page_is_redirect ==
'1' ) {
768 $this->mPendingRedirectIDs[$pageId] =
$title;
770 $this->mGoodPages[$row->page_namespace][$row->page_title] = $pageId;
771 $this->mGoodAndMissingPages[$row->page_namespace][$row->page_title] = $pageId;
772 $this->mGoodTitles[$pageId] =
$title;
775 foreach ( $this->mRequestedPageFields
as $fieldName => &$fieldValues ) {
776 $fieldValues[$pageId] = $row->$fieldName;
799 if ( $linkBatch->isEmpty() ) {
805 $db = $this->
getDB();
806 $set = $linkBatch->constructSet(
'page', $db );
829 $pageids = array_map(
'intval', $pageids );
830 $remaining = array_flip( $pageids );
833 $pageids = $this->
filterIDs( [ [
'page',
'page_id' ] ], $pageids );
837 if ( !empty( $pageids ) ) {
839 'page_id' => $pageids
841 $db = $this->
getDB();
865 if ( !is_null( $remaining ) && is_null( $processTitles ) ) {
866 ApiBase::dieDebug( __METHOD__,
'Missing $processTitles parameter when $remaining is provided' );
871 foreach (
$res as $row ) {
872 $pageId = (int)$row->page_id;
875 if ( isset( $remaining ) ) {
876 if ( $processTitles ) {
877 unset( $remaining[$row->page_namespace][$row->page_title] );
879 unset( $remaining[$pageId] );
887 if ( MWNamespace::hasGenderDistinction( $row->page_namespace ) ) {
888 $usernames[] = $row->page_title;
893 if ( isset( $remaining ) ) {
895 if ( $processTitles ) {
897 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
898 foreach ( $remaining
as $ns => $dbkeys ) {
899 foreach ( array_keys( $dbkeys )
as $dbkey ) {
900 $title = Title::makeTitle( $ns, $dbkey );
901 $linkCache->addBadLinkObj(
$title );
906 $this->mFakePageId--;
907 $this->mTitles[] =
$title;
910 if ( MWNamespace::hasGenderDistinction( $ns ) ) {
911 $usernames[] = $dbkey;
917 if ( !$this->mMissingPageIDs ) {
918 $this->mMissingPageIDs = array_keys( $remaining );
920 $this->mMissingPageIDs = array_merge( $this->mMissingPageIDs, array_keys( $remaining ) );
926 $genderCache = MediaWikiServices::getInstance()->getGenderCache();
927 $genderCache->doQuery( $usernames, __METHOD__ );
940 $revids = array_map(
'intval', $revids );
941 $db = $this->
getDB();
943 $remaining = array_flip( $revids );
945 $revids = $this->
filterIDs( [ [
'revision',
'rev_id' ], [
'archive',
'ar_rev_id' ] ], $revids );
946 $goodRemaining = array_flip( $revids );
949 $tables = [
'revision',
'page' ];
950 $fields = [
'rev_id',
'rev_page' ];
951 $where = [
'rev_id' => $revids,
'rev_page = page_id' ];
954 $res = $db->select(
$tables, $fields, $where, __METHOD__ );
955 foreach (
$res as $row ) {
956 $revid = (int)$row->rev_id;
957 $pageid = (int)$row->rev_page;
958 $this->mGoodRevIDs[$revid] = $pageid;
959 $this->mLiveRevIDs[$revid] = $pageid;
960 $pageids[$pageid] =
'';
961 unset( $remaining[$revid] );
962 unset( $goodRemaining[$revid] );
972 if ( $goodRemaining && $this->
getUser()->isAllowed(
'deletedhistory' ) ) {
974 $fields = [
'ar_rev_id',
'ar_namespace',
'ar_title' ];
975 $where = [
'ar_rev_id' => array_keys( $goodRemaining ) ];
977 $res = $db->select(
$tables, $fields, $where, __METHOD__ );
979 foreach (
$res as $row ) {
980 $revid = (int)$row->ar_rev_id;
981 $titles[$revid] = Title::makeTitle( $row->ar_namespace, $row->ar_title );
982 unset( $remaining[$revid] );
988 $ns =
$title->getNamespace();
989 $dbkey =
$title->getDBkey();
992 if ( !isset( $this->mAllPages[$ns][$dbkey] ) &&
993 isset( $this->mConvertedTitles[
$title->getPrefixedText()] )
995 $title = Title::newFromText( $this->mConvertedTitles[
$title->getPrefixedText()] );
996 $ns =
$title->getNamespace();
997 $dbkey =
$title->getDBkey();
1000 if ( isset( $this->mAllPages[$ns][$dbkey] ) ) {
1001 $this->mGoodRevIDs[$revid] = $this->mAllPages[$ns][$dbkey];
1002 $this->mDeletedRevIDs[$revid] = $this->mAllPages[$ns][$dbkey];
1004 $remaining[$revid] =
true;
1009 $this->mMissingRevIDs = array_keys( $remaining );
1018 if ( $this->mResolveRedirects ) {
1019 $db = $this->
getDB();
1024 while ( $this->mPendingRedirectIDs || $this->mPendingRedirectSpecialPages ) {
1029 if ( $linkBatch->isEmpty() ) {
1033 $set = $linkBatch->constructSet(
'page', $db );
1034 if ( $set ===
false ) {
1039 $res = $db->select(
'page', $pageFlds, $set, __METHOD__ );
1055 $titlesToResolve = [];
1056 $db = $this->
getDB();
1058 if ( $this->mPendingRedirectIDs ) {
1067 ], [
'rd_from' => array_keys( $this->mPendingRedirectIDs ) ],
1070 foreach (
$res as $row ) {
1071 $rdfrom = (int)$row->rd_from;
1072 $from = $this->mPendingRedirectIDs[$rdfrom]->getPrefixedText();
1073 $to = Title::makeTitle(
1079 $this->mResolvedRedirectTitles[$from] = $this->mPendingRedirectIDs[$rdfrom];
1080 unset( $this->mPendingRedirectIDs[$rdfrom] );
1081 if ( $to->isExternal() ) {
1082 $this->mInterwikiTitles[$to->getPrefixedText()] = $to->getInterwiki();
1083 } elseif ( !isset( $this->mAllPages[$to->getNamespace()][$to->getDBkey()] ) ) {
1084 $titlesToResolve[] = $to;
1086 $this->mRedirectTitles[$from] = $to;
1089 if ( $this->mPendingRedirectIDs ) {
1092 foreach ( $this->mPendingRedirectIDs
as $id =>
$title ) {
1093 $page = WikiPage::factory(
$title );
1094 $rt = $page->insertRedirect();
1099 if ( $rt->isExternal() ) {
1100 $this->mInterwikiTitles[$rt->getPrefixedText()] = $rt->getInterwiki();
1101 } elseif ( !isset( $this->mAllPages[$rt->getNamespace()][$rt->getDBkey()] ) ) {
1102 $titlesToResolve[] = $rt;
1104 $from =
$title->getPrefixedText();
1105 $this->mResolvedRedirectTitles[$from] =
$title;
1106 $this->mRedirectTitles[$from] = $rt;
1107 unset( $this->mPendingRedirectIDs[$id] );
1112 if ( $this->mPendingRedirectSpecialPages ) {
1113 foreach ( $this->mPendingRedirectSpecialPages
as $key =>
list( $from, $to ) ) {
1114 $fromKey = $from->getPrefixedText();
1115 $this->mResolvedRedirectTitles[$fromKey] = $from;
1116 $this->mRedirectTitles[$fromKey] = $to;
1117 if ( $to->isExternal() ) {
1118 $this->mInterwikiTitles[$to->getPrefixedText()] = $to->getInterwiki();
1119 } elseif ( !isset( $this->mAllPages[$to->getNamespace()][$to->getDBkey()] ) ) {
1120 $titlesToResolve[] = $to;
1123 $this->mPendingRedirectSpecialPages = [];
1127 $this->mCacheMode =
'private';
1162 $services = MediaWikiServices::getInstance();
1163 $contLang =
$services->getContentLanguage();
1166 if ( is_string(
$title ) ) {
1168 $titleObj = Title::newFromTextThrow(
$title, $this->mDefaultNamespace );
1171 if ( !isset( $this->mAllPages[0][
$title] ) ) {
1175 'invalidreason' => $this->
getErrorFormatter()->formatException( $ex, [
'bc' =>
true ] ),
1177 $this->mFakePageId--;
1184 $unconvertedTitle = $titleObj->getPrefixedText();
1185 $titleWasConverted =
false;
1186 if ( $titleObj->isExternal() ) {
1188 $this->mInterwikiTitles[$unconvertedTitle] = $titleObj->getInterwiki();
1192 $this->mConvertTitles && $contLang->hasVariants() && !$titleObj->exists()
1196 $titleText = is_string(
$title ) ?
$title : $titleObj->getPrefixedText();
1197 $contLang->findVariantLink( $titleText, $titleObj );
1198 $titleWasConverted = $unconvertedTitle !== $titleObj->getPrefixedText();
1201 if ( $titleObj->getNamespace() < 0 ) {
1203 $titleObj = $titleObj->fixSpecialName();
1204 $ns = $titleObj->getNamespace();
1205 $dbkey = $titleObj->getDBkey();
1206 if ( !isset( $this->mAllSpecials[$ns][$dbkey] ) ) {
1209 if ( $ns ===
NS_SPECIAL && $this->mResolveRedirects ) {
1210 $spFactory =
$services->getSpecialPageFactory();
1211 $special = $spFactory->getPage( $dbkey );
1219 list( , $subpage ) = $spFactory->resolveAlias( $dbkey );
1220 $target = $special->getRedirect( $subpage );
1224 $this->mPendingRedirectSpecialPages[$dbkey] = [ $titleObj, $target ];
1227 $this->mFakePageId--;
1232 $linkBatch->addObj( $titleObj );
1241 if ( $titleWasConverted ) {
1242 $this->mConvertedTitles[$unconvertedTitle] = $titleObj->getPrefixedText();
1244 if ( is_string(
$title ) &&
$title !== $unconvertedTitle ) {
1245 $this->mNormalizedTitles[
$title] = $unconvertedTitle;
1247 } elseif ( is_string(
$title ) &&
$title !== $titleObj->getPrefixedText() ) {
1248 $this->mNormalizedTitles[
$title] = $titleObj->getPrefixedText();
1252 if ( MWNamespace::hasGenderDistinction( $titleObj->getNamespace() ) ) {
1253 $usernames[] = $titleObj->getText();
1257 $genderCache =
$services->getGenderCache();
1258 $genderCache->doQuery( $usernames, __METHOD__ );
1279 $ns =
$title->getNamespace();
1280 $dbkey =
$title->getDBkey();
1281 $this->mGeneratorData[$ns][$dbkey] =
$data;
1304 $this->mRedirectMergePolicy = $callable;
1330 if (
$data ===
null ) {
1336 if ( !isset(
$data[$key] ) ) {
1344 foreach ( $this->mGeneratorData
as $ns => $dbkeys ) {
1347 foreach ( $this->mSpecialTitles
as $id =>
$title ) {
1348 $pages[
$title->getDBkey()] = $id;
1351 if ( !isset( $this->mAllPages[$ns] ) ) {
1355 $pages = $this->mAllPages[$ns];
1357 foreach ( $dbkeys
as $dbkey => $genData ) {
1358 if ( !isset( $pages[$dbkey] ) ) {
1362 $pageId = $pages[$dbkey];
1363 if ( !isset(
$data[$pageId] ) ) {
1369 $path2 = array_merge(
$path, [ $pageId ] );
1370 foreach ( $genData
as $key =>
$value ) {
1376 $data[$pageId] = array_merge(
$data[$pageId], $genData );
1382 if ( $this->mRedirectMergePolicy ) {
1383 foreach ( $this->mResolvedRedirectTitles
as $titleFrom ) {
1385 while ( isset( $this->mRedirectTitles[$dest->getPrefixedText()] ) ) {
1386 $dest = $this->mRedirectTitles[$dest->getPrefixedText()];
1388 $fromNs = $titleFrom->getNamespace();
1389 $fromDBkey = $titleFrom->getDBkey();
1390 $toPageId = $dest->getArticleID();
1391 if ( isset(
$data[$toPageId] ) &&
1392 isset( $this->mGeneratorData[$fromNs][$fromDBkey] )
1396 $data[$toPageId] = call_user_func(
1397 $this->mRedirectMergePolicy,
1399 $this->mGeneratorData[$fromNs][$fromDBkey]
1418 return $this->mDbSource->getDB();
1445 ?
'api-pageset-param-redirects-generator'
1446 :
'api-pageset-param-redirects-nogenerator',
1448 'converttitles' => [
1451 'api-pageset-param-converttitles',
1452 [ Message::listParam( LanguageConverter::$languagesWithVariants,
'text' ) ],
1457 if ( !$this->mAllowGenerator ) {
1458 unset(
$result[
'generator'] );
1468 parent::handleParamNormalization( $paramName,
$value, $rawValue );
1470 if ( $paramName ===
'titles' ) {
1476 for ( $i = 0; $i < $l; $i++ ) {
1477 if (
$value[$i] !== $rawValue[$i] ) {
1478 $this->mNormalizedTitles[$rawValue[$i]] =
$value[$i];
1491 if ( self::$generators ===
null ) {
1496 $query = $this->
getMain()->getModuleManager()->getModule(
'query' );
1499 $prefix =
$query->getModulePath() .
'+';
1500 $mgr =
$query->getModuleManager();
1501 foreach ( $mgr->getNamesWithClasses()
as $name => $class ) {
1502 if ( is_subclass_of( $class, ApiQueryGeneratorBase::class ) ) {
1507 self::$generators = $gens;
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
This abstract class implements many basic API functions, and is the base of all API classes.
const PARAM_SUBMODULE_MAP
(string[]) When PARAM_TYPE is 'submodule', map parameter values to submodule paths.
filterIDs( $fields, array $ids)
Filter out-of-range values from a list of positive integer IDs.
encodeParamName( $paramName)
This method mangles parameter name based on the prefix supplied to the constructor.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
getMain()
Get the main module.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getErrorFormatter()
Get the error formatter.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
const PARAM_SUBMODULE_PARAM_PREFIX
(string) When PARAM_TYPE is 'submodule', used to indicate the 'g' prefix added by ApiQueryGeneratorBa...
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
getModuleName()
Get the name of the module being executed by this instance.
explodeMultiValue( $value, $limit)
Split a multi-valued parameter string, like explode()
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
This class contains a list of pages that the client has requested.
getGoodAndMissingTitlesByNamespace()
Returns an array [ns][dbkey] => page_id for all good and missing titles.
populateFromRevisionIDs( $revIDs)
Populate this PageSet from a list of revision IDs.
getInterwikiTitlesAsResult( $result=null, $iwUrl=false)
Get a list of interwiki titles - maps a title to its interwiki prefix as result.
getCustomField( $fieldName)
Get the value of a custom field previously requested through requestField()
getNormalizedTitles()
Get a list of title normalizations - maps a title to its normalized version.
getGenerators()
Get an array of all available generators.
__construct(ApiBase $dbSource, $flags=0, $defaultNamespace=NS_MAIN)
getGoodTitlesByNamespace()
Returns an array [ns][dbkey] => page_id for all good titles.
getAllowedParams( $flags=0)
getRevisionIDs()
Get the list of valid revision IDs (requested with the revids= parameter)
getGoodAndMissingTitles()
Title objects for good and missing titles.
populateFromPageIDs( $pageIDs)
Populate this PageSet from a list of page IDs.
getRedirectTargets()
Get the targets of the pending redirects from the database.
getMissingTitlesByNamespace()
Returns an array [ns][dbkey] => fake_page_id for all missing titles.
getMissingTitles()
Title objects that were NOT found in the database.
getDB()
Get the database connection (read-only)
initFromRevIDs( $revids)
Does the same as initFromTitles(), but is based on revision IDs instead.
executeDryRun()
In case execute() is not called, call this method to mark all relevant parameters as used This preven...
getRedirectTitlesAsResult( $result=null)
Get a list of redirect resolutions - maps a title to its redirect target.
getPageTableFields()
Get the fields that have to be queried from the page table: the ones requested through requestField()...
getGoodTitleCount()
Returns the number of found unique pages (not revisions) in the set.
getRevisionCount()
Returns the number of revisions (requested with revids= parameter).
getAllTitlesByNamespace()
Returns an array [ns][dbkey] => page_id for all requested titles.
processDbRow( $row)
Extract all requested fields from the row received from the database.
processTitlesArray( $titles)
Given an array of title strings, convert them into Title objects.
static addValues(array &$result, $values, $flags=[], $name=null)
Add all items from $values into the result.
setRedirectMergePolicy( $callable)
Controls how generator data about a redirect source is merged into the generator data for the redirec...
handleParamNormalization( $paramName, $value, $rawValue)
Handle when a parameter was Unicode-normalized.
getNormalizedTitlesAsResult( $result=null)
Get a list of title normalizations - maps a title to its normalized version in the form of result arr...
getTitleCount()
Returns the number of unique pages (not revisions) in the set.
initFromTitles( $titles)
This method populates internal variables with page information based on the given array of title stri...
getInvalidTitlesAndReasons()
Titles that were deemed invalid by Title::newFromText() The array's index will be unique and negative...
array $mInvalidTitles
[fake_page_id] => [ 'title' => $title, 'invalidreason' => $reason ]
getSpecialTitles()
Get the list of titles with negative namespace.
Title[] $mPendingRedirectIDs
getTitles()
All Title objects provided.
executeInternal( $isDryRun)
Populate the PageSet from the request parameters.
resolvePendingRedirects()
Resolve any redirects in the result if redirect resolution was requested.
populateFromQueryResult( $db, $queryResult)
Populate this PageSet from a rowset returned from the database.
getMissingPageIDs()
Page IDs that were not found in the database.
requestField( $fieldName)
Request an additional field from the page table.
getInterwikiTitles()
Get a list of interwiki titles - maps a title to its interwiki prefix.
populateFromTitles( $titles)
Populate this PageSet from a list of Titles.
getMissingRevisionIDs()
Revision IDs that were not found in the database.
initFromPageIds( $pageids, $filterIds=true)
Does the same as initFromTitles(), but is based on page IDs instead.
execute()
Populate the PageSet from the request parameters.
populateGeneratorData(&$result, array $path=[])
Populate the generator data for all titles in the result.
$mPendingRedirectSpecialPages
getConvertedTitlesAsResult( $result=null)
Get a list of title conversions - maps a title to its converted version as a result array.
getConvertedTitles()
Get a list of title conversions - maps a title to its converted version.
getDataSource()
Return the parameter name that is the source of data for this PageSet.
getInvalidTitlesAndRevisions( $invalidChecks=[ 'invalidTitles', 'special', 'missingIds', 'missingRevIds', 'missingTitles', 'interwikiTitles'])
Get an array of invalid/special/missing titles.
getLiveRevisionIDs()
Get the list of non-deleted revision IDs (requested with the revids= parameter)
getCacheMode( $params=null)
Get the cache mode for the data generated by this module.
getGoodTitles()
Title objects that were found in the database.
callable null $mRedirectMergePolicy
isResolvingRedirects()
Check whether this PageSet is resolving redirects.
getRedirectTitles()
Get a list of redirect resolutions - maps a title to its redirect target, as an array of output-ready...
setGeneratorData(Title $title, array $data)
Set data for a title.
const DISABLE_GENERATORS
Constructor flag: The new instance of ApiPageSet will ignore the 'generator=' parameter.
initFromQueryResult( $res, &$remaining=null, $processTitles=null)
Iterate through the result of the query on 'page' table, and for each row create and store title obje...
getMissingRevisionIDsAsResult( $result=null)
Revision IDs that were not found in the database as result array.
getDeletedRevisionIDs()
Get the list of revision IDs that were associated with deleted titles.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
This is the main query class.
This class represents the result of the API operations.
addValue( $path, $name, $value, $flags=0)
Add value to the output data at the given path.
const OVERRIDE
Override existing value in addValue(), setValue(), and similar functions.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
An IContextSource implementation which will inherit context from another source but allow individual ...
WebRequest clone which takes values from a provided array.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Superclass for any RedirectSpecialPage which redirects the user to a particular article (as opposed t...
Represents a title within MediaWiki.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImgAuthModifyHeaders':Executed just before a file is streamed to a user via img_auth.php, allowing headers to be modified beforehand. $title:LinkTarget object & $headers:HTTP headers(name=> value, names are case insensitive). Two headers get special handling:If-Modified-Since(value must be a valid HTTP date) and Range(must be of the form "bytes=(\d*-\d*)") will be honored when streaming the file. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. & $title:Title object for the current page & $request:WebRequest & $ignoreRedirect:boolean to skip redirect check & $target:Title/string of redirect target & $article:Article object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) & $article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Array with elements of the form "language:title" in the order that they will be output. & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services
Allows to change the fields on the form that will be generated $name
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))