93 foreach ( $values
as $val ) {
94 if ( $val instanceof
Title ) {
97 } elseif (
$name !== null ) {
98 $v = [
$name => $val ];
118 $this->mDbSource = $dbSource;
120 $this->mDefaultNamespace = $defaultNamespace;
123 $this->mResolveRedirects = $this->mParams[
'redirects'];
124 $this->mConvertTitles = $this->mParams[
'converttitles'];
148 $generatorName = $this->mAllowGenerator ? $this->mParams[
'generator'] : null;
149 if ( isset( $generatorName ) ) {
151 if ( !$dbSource instanceof
ApiQuery ) {
153 $dbSource = $this->
getMain()->getModuleManager()->getModule(
'query' );
155 $generator = $dbSource->getModuleManager()->getModule( $generatorName, null,
true );
157 $this->
dieUsage(
'Unknown generator=' . $generatorName,
'badgenerator' );
160 $this->
dieUsage(
"Module $generatorName cannot be used as a generator",
'badgenerator' );
171 $tmpPageSet->executeInternal( $isDryRun );
180 foreach (
$generator->extractRequestParams()
as $paramName => $param ) {
181 $main->markParamsUsed(
$generator->encodeParamName( $paramName ) );
191 if ( isset( $this->mParams[
'titles'] ) ) {
192 $dataSource =
'titles';
194 if ( isset( $this->mParams[
'pageids'] ) ) {
195 if ( isset( $dataSource ) ) {
196 $this->
dieUsage(
"Cannot use 'pageids' at the same time as '$dataSource'",
'multisource' );
198 $dataSource =
'pageids';
200 if ( isset( $this->mParams[
'revids'] ) ) {
201 if ( isset( $dataSource ) ) {
202 $this->
dieUsage(
"Cannot use 'revids' at the same time as '$dataSource'",
'multisource' );
204 $dataSource =
'revids';
209 switch ( $dataSource ) {
217 if ( $this->mResolveRedirects ) {
218 $this->
setWarning(
'Redirect resolution cannot be used ' .
219 'together with the revids= parameter. Any redirects ' .
220 'the revids= point to have not been resolved.' );
222 $this->mResolveRedirects =
false;
250 if ( $this->mAllowGenerator && isset( $this->mParams[
'generator'] ) ) {
253 if ( isset( $this->mParams[
'titles'] ) ) {
256 if ( isset( $this->mParams[
'pageids'] ) ) {
259 if ( isset( $this->mParams[
'revids'] ) ) {
272 $this->mRequestedPageFields[$fieldName] = null;
282 return $this->mRequestedPageFields[$fieldName];
295 'page_namespace' => null,
296 'page_title' => null,
300 if ( $this->mResolveRedirects ) {
301 $pageFlds[
'page_is_redirect'] = null;
304 if ( $this->
getConfig()->
get(
'ContentHandlerUseDB' ) ) {
305 $pageFlds[
'page_content_model'] = null;
308 if ( $this->
getConfig()->
get(
'PageLanguageUseDB' ) ) {
309 $pageFlds[
'page_lang'] = null;
313 $pageFlds[$field] = null;
316 $pageFlds = array_merge( $pageFlds, $this->mRequestedPageFields );
318 return array_keys( $pageFlds );
344 return count( $this->mTitles );
368 return count( $this->mGoodTitles );
413 return array_map(
function (
$t ) {
455 'from' => strval( $titleStrFrom ),
456 'to' => $titleTo->getPrefixedText(),
458 if ( $titleTo->hasFragment() ) {
459 $r[
'tofragment'] = $titleTo->getFragment();
461 if ( $titleTo->isExternal() ) {
462 $r[
'tointerwiki'] = $titleTo->getInterwiki();
464 if ( isset( $this->mResolvedRedirectTitles[$titleStrFrom] ) ) {
465 $titleFrom = $this->mResolvedRedirectTitles[$titleStrFrom];
466 $ns = $titleFrom->getNamespace();
467 $dbkey = $titleFrom->getDBkey();
468 if ( isset( $this->mGeneratorData[$ns][$dbkey] ) ) {
469 $r = array_merge( $this->mGeneratorData[$ns][$dbkey], $r );
475 if ( !empty( $values ) &&
$result ) {
503 $encode = ( $wgContLang->normalize( $rawTitleStr ) !== $rawTitleStr );
505 'fromencoded' => $encode,
506 'from' => $encode ? rawurlencode( $rawTitleStr ) : $rawTitleStr,
510 if ( !empty( $values ) &&
$result ) {
537 'from' => $rawTitleStr,
541 if ( !empty( $values ) &&
$result ) {
569 'title' => $rawTitleStr,
570 'iw' => $interwikiStr,
578 if ( !empty( $values ) &&
$result ) {
600 'special',
'missingIds',
'missingRevIds',
'missingTitles',
'interwikiTitles' ]
603 if ( in_array(
'invalidTitles', $invalidChecks ) ) {
606 if ( in_array(
'special', $invalidChecks ) ) {
610 if ( $title->isKnown() ) {
616 self::addValues(
$result, $unknown, [
'special',
'missing' ] );
617 self::addValues(
$result, $known, [
'special' ] );
619 if ( in_array(
'missingIds', $invalidChecks ) ) {
622 if ( in_array(
'missingRevIds', $invalidChecks ) ) {
625 if ( in_array(
'missingTitles', $invalidChecks ) ) {
629 if ( $title->isKnown() ) {
635 self::addValues(
$result, $unknown, [
'missing' ] );
636 self::addValues(
$result, $known, [
'missing',
'known' ] );
638 if ( in_array(
'interwikiTitles', $invalidChecks ) ) {
690 if ( !empty( $values ) &&
$result ) {
760 $pageId = intval( $row->page_id );
761 $this->mAllPages[$row->page_namespace][$row->page_title] = $pageId;
762 $this->mTitles[] =
$title;
764 if ( $this->mResolveRedirects && $row->page_is_redirect ==
'1' ) {
765 $this->mPendingRedirectIDs[$pageId] =
$title;
767 $this->mGoodPages[$row->page_namespace][$row->page_title] = $pageId;
768 $this->mGoodAndMissingPages[$row->page_namespace][$row->page_title] = $pageId;
769 $this->mGoodTitles[$pageId] =
$title;
772 foreach ( $this->mRequestedPageFields
as $fieldName => &$fieldValues ) {
773 $fieldValues[$pageId] = $row->$fieldName;
796 if ( $linkBatch->isEmpty() ) {
800 $db = $this->
getDB();
801 $set = $linkBatch->constructSet(
'page', $db );
823 $pageids = array_map(
'intval', $pageids );
824 $remaining = array_flip( $pageids );
826 $pageids = self::getPositiveIntegers( $pageids );
829 if ( !empty( $pageids ) ) {
831 'page_id' => $pageids
833 $db = $this->
getDB();
857 if ( !is_null( $remaining ) && is_null( $processTitles ) ) {
858 ApiBase::dieDebug( __METHOD__,
'Missing $processTitles parameter when $remaining is provided' );
863 foreach (
$res as $row ) {
864 $pageId = intval( $row->page_id );
867 if ( isset( $remaining ) ) {
868 if ( $processTitles ) {
869 unset( $remaining[$row->page_namespace][$row->page_title] );
871 unset( $remaining[$pageId] );
880 $usernames[] = $row->page_title;
885 if ( isset( $remaining ) ) {
887 if ( $processTitles ) {
890 foreach ( $remaining
as $ns => $dbkeys ) {
891 foreach ( array_keys( $dbkeys )
as $dbkey ) {
893 $linkCache->addBadLinkObj(
$title );
898 $this->mFakePageId--;
899 $this->mTitles[] =
$title;
903 $usernames[] = $dbkey;
909 if ( !$this->mMissingPageIDs ) {
910 $this->mMissingPageIDs = array_keys( $remaining );
912 $this->mMissingPageIDs = array_merge( $this->mMissingPageIDs, array_keys( $remaining ) );
919 $genderCache->doQuery( $usernames, __METHOD__ );
932 $revids = array_map(
'intval', $revids );
933 $db = $this->
getDB();
935 $remaining = array_flip( $revids );
937 $revids = self::getPositiveIntegers( $revids );
939 if ( !empty( $revids ) ) {
940 $tables = [
'revision',
'page' ];
941 $fields = [
'rev_id',
'rev_page' ];
942 $where = [
'rev_id' => $revids,
'rev_page = page_id' ];
945 $res = $db->select(
$tables, $fields, $where, __METHOD__ );
946 foreach (
$res as $row ) {
947 $revid = intval( $row->rev_id );
948 $pageid = intval( $row->rev_page );
949 $this->mGoodRevIDs[$revid] = $pageid;
950 $this->mLiveRevIDs[$revid] = $pageid;
951 $pageids[$pageid] =
'';
952 unset( $remaining[$revid] );
956 $this->mMissingRevIDs = array_keys( $remaining );
964 if ( !empty( $this->mMissingRevIDs ) && $this->
getUser()->isAllowed(
'deletedhistory' ) ) {
965 $remaining = array_flip( $this->mMissingRevIDs );
967 $fields = [
'ar_rev_id',
'ar_namespace',
'ar_title' ];
970 $res = $db->select(
$tables, $fields, $where, __METHOD__ );
972 foreach (
$res as $row ) {
973 $revid = intval( $row->ar_rev_id );
975 unset( $remaining[$revid] );
981 $ns =
$title->getNamespace();
982 $dbkey =
$title->getDBkey();
985 if ( !isset( $this->mAllPages[$ns][$dbkey] ) &&
986 isset( $this->mConvertedTitles[
$title->getPrefixedText()] )
989 $ns =
$title->getNamespace();
990 $dbkey =
$title->getDBkey();
993 if ( isset( $this->mAllPages[$ns][$dbkey] ) ) {
994 $this->mGoodRevIDs[$revid] = $this->mAllPages[$ns][$dbkey];
995 $this->mDeletedRevIDs[$revid] = $this->mAllPages[$ns][$dbkey];
997 $remaining[$revid] =
true;
1001 $this->mMissingRevIDs = array_keys( $remaining );
1011 if ( $this->mResolveRedirects ) {
1012 $db = $this->
getDB();
1017 while ( $this->mPendingRedirectIDs ) {
1022 if ( $linkBatch->isEmpty() ) {
1026 $set = $linkBatch->constructSet(
'page', $db );
1027 if ( $set ===
false ) {
1032 $res = $db->select(
'page', $pageFlds, $set, __METHOD__ );
1049 $db = $this->
getDB();
1059 ], [
'rd_from' => array_keys( $this->mPendingRedirectIDs ) ],
1062 foreach (
$res as $row ) {
1063 $rdfrom = intval( $row->rd_from );
1064 $from = $this->mPendingRedirectIDs[$rdfrom]->getPrefixedText();
1071 $this->mResolvedRedirectTitles[
$from] = $this->mPendingRedirectIDs[$rdfrom];
1072 unset( $this->mPendingRedirectIDs[$rdfrom] );
1073 if ( $to->isExternal() ) {
1074 $this->mInterwikiTitles[$to->getPrefixedText()] = $to->getInterwiki();
1075 } elseif ( !isset( $this->mAllPages[$row->rd_namespace][$row->rd_title] ) ) {
1076 $lb->add( $row->rd_namespace, $row->rd_title );
1078 $this->mRedirectTitles[
$from] = $to;
1081 if ( $this->mPendingRedirectIDs ) {
1084 foreach ( $this->mPendingRedirectIDs
as $id =>
$title ) {
1086 $rt =
$page->insertRedirect();
1094 $this->mRedirectTitles[
$from] = $rt;
1095 unset( $this->mPendingRedirectIDs[$id] );
1133 if ( is_string( $title ) ) {
1141 'invalidreason' => $ex->getMessage(),
1143 $this->mFakePageId--;
1149 $unconvertedTitle = $titleObj->getPrefixedText();
1150 $titleWasConverted =
false;
1151 if ( $titleObj->isExternal() ) {
1153 $this->mInterwikiTitles[$unconvertedTitle] = $titleObj->getInterwiki();
1157 if ( $this->mConvertTitles &&
1158 count( $wgContLang->getVariants() ) > 1 &&
1159 !$titleObj->exists()
1163 $titleText = is_string( $title ) ? $title : $titleObj->getPrefixedText();
1164 $wgContLang->findVariantLink( $titleText, $titleObj );
1165 $titleWasConverted = $unconvertedTitle !== $titleObj->getPrefixedText();
1168 if ( $titleObj->getNamespace() < 0 ) {
1170 $titleObj = $titleObj->fixSpecialName();
1172 $this->mFakePageId--;
1175 $linkBatch->addObj( $titleObj );
1184 if ( $titleWasConverted ) {
1185 $this->mConvertedTitles[$unconvertedTitle] = $titleObj->getPrefixedText();
1187 if ( is_string( $title ) && $title !== $unconvertedTitle ) {
1188 $this->mNormalizedTitles[
$title] = $unconvertedTitle;
1190 } elseif ( is_string( $title ) && $title !== $titleObj->getPrefixedText() ) {
1191 $this->mNormalizedTitles[
$title] = $titleObj->getPrefixedText();
1196 $usernames[] = $titleObj->getText();
1201 $genderCache->doQuery( $usernames, __METHOD__ );
1224 $this->mGeneratorData[$ns][$dbkey] = $data;
1247 $this->mRedirectMergePolicy = $callable;
1273 if ( $data === null ) {
1279 if ( !isset( $data[$key] ) ) {
1284 $data = &$data[$key];
1287 foreach ( $this->mGeneratorData
as $ns => $dbkeys ) {
1290 foreach ( $this->mSpecialTitles
as $id =>
$title ) {
1291 $pages[
$title->getDBkey()] = $id;
1294 if ( !isset( $this->mAllPages[$ns] ) ) {
1298 $pages = $this->mAllPages[$ns];
1300 foreach ( $dbkeys
as $dbkey => $genData ) {
1301 if ( !isset( $pages[$dbkey] ) ) {
1305 $pageId = $pages[$dbkey];
1306 if ( !isset( $data[$pageId] ) ) {
1311 if (
$result instanceof ApiResult ) {
1312 $path2 = array_merge(
$path, [ $pageId ] );
1313 foreach ( $genData
as $key =>
$value ) {
1319 $data[$pageId] = array_merge( $data[$pageId], $genData );
1325 if ( $this->mRedirectMergePolicy ) {
1326 foreach ( $this->mResolvedRedirectTitles
as $titleFrom ) {
1328 while ( isset( $this->mRedirectTitles[$dest->getPrefixedText()] ) ) {
1329 $dest = $this->mRedirectTitles[$dest->getPrefixedText()];
1331 $fromNs = $titleFrom->getNamespace();
1332 $fromDBkey = $titleFrom->getDBkey();
1333 $toPageId = $dest->getArticleID();
1334 if ( isset( $data[$toPageId] ) &&
1335 isset( $this->mGeneratorData[$fromNs][$fromDBkey] )
1339 $data[$toPageId] = call_user_func(
1340 $this->mRedirectMergePolicy,
1342 $this->mGeneratorData[$fromNs][$fromDBkey]
1344 if (
$result instanceof ApiResult ) {
1361 return $this->mDbSource->getDB();
1374 foreach ( $array
as $i => $int ) {
1376 unset( $array[$i] );
1406 ApiBase::PARAM_HELP_MSG => $this->mAllowGenerator
1407 ?
'api-pageset-param-redirects-generator'
1408 :
'api-pageset-param-redirects-nogenerator',
1410 'converttitles' => [
1412 ApiBase::PARAM_HELP_MSG => [
1413 'api-pageset-param-converttitles',
1425 if ( !$this->mAllowGenerator ) {
1426 unset(
$result[
'generator'] );
1436 parent::handleParamNormalization( $paramName,
$value, $rawValue );
1438 if ( $paramName ===
'titles' ) {
1444 for ( $i = 0; $i < $l; $i++ ) {
1445 if (
$value[$i] !== $rawValue[$i] ) {
1446 $this->mNormalizedTitles[$rawValue[$i]] =
$value[$i];
1459 if ( self::$generators === null ) {
1464 $query = $this->
getMain()->getModuleManager()->getModule(
'query' );
1467 $prefix =
$query->getModulePath() .
'+';
1468 $mgr =
$query->getModuleManager();
1469 foreach ( $mgr->getNamesWithClasses()
as $name => $class ) {
1470 if ( is_subclass_of( $class,
'ApiQueryGeneratorBase' ) ) {
1475 self::$generators = $gens;
1478 return self::$generators;
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
static newFromRow($row)
Make a Title object from a DB row.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below...
Interface for objects which can provide a MediaWiki context on request.
static hasGenderDistinction($index)
Does the namespace (potentially) have different aliases for different genders.
setGeneratorData(Title $title, array $data)
Set data for a title.
getRedirectTitles()
Get a list of redirect resolutions - maps a title to its redirect target, as an array of output-ready...
the array() calling protocol came about after MediaWiki 1.4rc1.
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
initFromRevIDs($revids)
Does the same as initFromTitles(), but is based on revision IDs instead.
getRedirectTitlesAsResult($result=null)
Get a list of redirect resolutions - maps a title to its redirect target.
getSpecialTitles()
Get the list of titles with negative namespace.
getDataSource()
Return the parameter name that is the source of data for this PageSet.
explodeMultiValue($value, $limit)
Split a multi-valued parameter string, like explode()
This class contains a list of pages that the client has requested.
populateFromRevisionIDs($revIDs)
Populate this PageSet from a list of revision IDs.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
getMain()
Get the main module.
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
getConvertedTitles()
Get a list of title conversions - maps a title to its converted version.
processDbRow($row)
Extract all requested fields from the row received from the database.
getMissingRevisionIDs()
Revision IDs that were not found in the database.
extractRequestParams($parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user...
getConvertedTitlesAsResult($result=null)
Get a list of title conversions - maps a title to its converted version as a result array...
getInvalidTitles()
Titles that were deemed invalid by Title::newFromText() The array's index will be unique and negative...
it s the revision text itself In either if gzip is the revision text is gzipped $flags
getInvalidTitlesAndRevisions($invalidChecks=[ 'invalidTitles', 'special', 'missingIds', 'missingRevIds', 'missingTitles', 'interwikiTitles'])
Get an array of invalid/special/missing titles.
requestField($fieldName)
Request an additional field from the page table.
getMissingTitlesByNamespace()
Returns an array [ns][dbkey] => fake_page_id for all missing titles.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
when a variable name is used in a it is silently declared as a new local masking the global
getRevisionIDs()
Get the list of valid revision IDs (requested with the revids= parameter)
getTitleCount()
Returns the number of unique pages (not revisions) in the set.
getAllTitlesByNamespace()
Returns an array [ns][dbkey] => page_id for all requested titles.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
populateFromTitles($titles)
Populate this PageSet from a list of Titles.
getPageTableFields()
Get the fields that have to be queried from the page table: the ones requested through requestField()...
getTitles()
All Title objects provided.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
getLiveRevisionIDs()
Get the list of non-deleted revision IDs (requested with the revids= parameter)
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. '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 '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. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) '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 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) '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:Associative array mapping language codes to prefixed links of the form"language:title".&$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!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
callable null $mRedirectMergePolicy
resolvePendingRedirects()
Resolve any redirects in the result if redirect resolution was requested.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
getGoodAndMissingTitlesByNamespace()
Returns an array [ns][dbkey] => page_id for all good and missing titles.
static addValues(array &$result, $values, $flags=[], $name=null)
Add all items from $values into the result.
populateFromQueryResult($db, $queryResult)
Populate this PageSet from a rowset returned from the database.
getGoodTitleCount()
Returns the number of found unique pages (not revisions) in the set.
const PARAM_SUBMODULE_PARAM_PREFIX
(string) When PARAM_TYPE is 'submodule', used to indicate the 'g' prefix added by ApiQueryGeneratorBa...
getInvalidTitlesAndReasons()
Titles that were deemed invalid by Title::newFromText() The array's index will be unique and negative...
static singleton()
Get an instance of this class.
populateGeneratorData(&$result, array $path=[])
Populate the generator data for all titles in the result.
getGoodAndMissingTitles()
Title objects for good and missing titles.
getDBkey()
Get the main part with underscores.
getGoodTitlesByNamespace()
Returns an array [ns][dbkey] => page_id for all good titles.
getGenerators()
Get an array of all available generators.
initFromPageIds($pageids)
Does the same as initFromTitles(), but is based on page IDs instead.
executeDryRun()
In case execute() is not called, call this method to mark all relevant parameters as used This preven...
getConfig()
Get the Config object.
getMissingRevisionIDsAsResult($result=null)
Revision IDs that were not found in the database as result array.
const PARAM_SUBMODULE_MAP
(string[]) When PARAM_TYPE is 'submodule', map parameter values to submodule paths.
getGoodTitles()
Title objects that were found in the database.
getMissingTitles()
Title objects that were NOT found in the database.
getDB()
Get the database connection (read-only)
wfDeprecated($function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
populateFromPageIDs($pageIDs)
Populate this PageSet from a list of page IDs.
namespace and then decline to actually register it file or subcat img or subcat $title
getModuleName()
Get the name of the module being executed by this instance.
This class represents the result of the API operations.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
getNamespace()
Get the namespace index, i.e.
initFromTitles($titles)
This method populates internal variables with page information based on the given array of title stri...
This is the main query class.
setWarning($warning)
Set warning section for this module.
getLanguage()
Get the Language object.
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
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter...
processTitlesArray($titles)
Given an array of title strings, convert them into Title objects.
static getSelectFields()
Fields that LinkCache needs to select.
getCacheMode($params=null)
Get the cache mode for the data generated by this module.
static newFromTextThrow($text, $defaultNamespace=NS_MAIN)
Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null.
executeInternal($isDryRun)
Populate the PageSet from the request parameters.
getMissingPageIDs()
Page IDs that were not found in the database.
getInterwikiTitles()
Get a list of interwiki titles - maps a title to its interwiki prefix.
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
setRedirectMergePolicy($callable)
Controls how generator data about a redirect source is merged into the generator data for the redirec...
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
getRedirectTargets()
Get the targets of the pending redirects from the database.
getInterwikiTitlesAsResult($result=null, $iwUrl=false)
Get a list of interwiki titles - maps a title to its interwiki prefix as result.
getAllowedParams($flags=0)
getNormalizedTitles()
Get a list of title normalizations - maps a title to its normalized version.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
array $mInvalidTitles
[fake_page_id] => [ 'title' => $title, 'invalidreason' => $reason ]
handleParamNormalization($paramName, $value, $rawValue)
__construct(ApiBase $dbSource, $flags=0, $defaultNamespace=NS_MAIN)
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...
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
This abstract class implements many basic API functions, and is the base of all API classes...
getNormalizedTitlesAsResult($result=null)
Get a list of title normalizations - maps a title to its normalized version in the form of result arr...
isResolvingRedirects()
Check whether this PageSet is resolving redirects.
getRevisionCount()
Returns the number of revisions (requested with revids= 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...
static dieDebug($method, $message)
Internal code errors should be reported with this method.
const DISABLE_GENERATORS
Constructor flag: The new instance of ApiPageSet will ignore the 'generator=' parameter.
Title[] $mPendingRedirectIDs
static getPositiveIntegers($array)
Returns the input array of integers with all values < 0 removed.
static array $languagesWithVariants
languages supporting variants
const OVERRIDE
Override existing value in addValue(), setValue(), and similar functions.
static addTitleInfo(&$arr, $title, $prefix= '')
Add information (title and namespace) about a Title object to a result array.
execute()
Populate the PageSet from the request parameters.
getUser()
Get the User object.
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
getDeletedRevisionIDs()
Get the list of revision IDs that were associated with deleted titles.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
getCustomField($fieldName)
Get the value of a custom field previously requested through requestField()
Allows to change the fields on the form that will be generated $name