|
Wikibase
MediaWiki Wikibase extension
|
File defining the hook handlers for the Wikibase extension. More...
Public Member Functions | |
| onBeforeDisplayNoArticleText ( $article) | |
| We implement this solely to replace the standard message that is shown when an entity does not exists. | |
| onBeforePageDisplay ( $out, $skin) | |
| Handler for the BeforePageDisplay hook, that conditionally adds the wikibase mobile styles and injects the wikibase.ui.entitysearch module replacing the native search box with the entity selector widget. | |
| onMediaWikiServices ( $services) | |
| Handler for the MediaWikiServices hook, completing the content and namespace setup. | |
| onUnitTestsList (&$paths) | |
| onNamespaceIsMovable ( $ns, &$movable) | |
| onRevisionFromEditComplete ( $wikiPage, $rev, $originalRevId, $user, &$tags) | |
| onGetPreferences ( $user, &$preferences) | |
| NOTE: Might make sense to put the inner functionality into a well structured Preferences file once this becomes more. | |
| onPageHistoryLineEnding ( $historyAction, &$row, &$s, &$classes, &$attribs) | |
| onSkinTemplateNavigation__Universal ( $sktemplate, &$links) | |
| onOutputPageBodyAttributes ( $out, $sk, &$bodyAttrs) | |
| Used to append a css class to the body, so the page can be identified as Wikibase item page. | |
| onTitleGetRestrictionTypes ( $title, &$types) | |
| Implemented to prevent people from protecting pages from being created or moved in an entity namespace (which is pointless). | |
| onAbuseFilter_contentToString (Content $content, ?string &$text) | |
| Hook handler for AbuseFilter's AbuseFilter-contentToString hook, implemented to provide a custom text representation of Entities for filtering. | |
| onFormatAutocomments (&$comment, $pre, $auto, $post, $title, $local, $wiki) | |
| Handler for the FormatAutocomments hook, implementing localized formatting for machine readable autocomments generated by SummaryFormatter. | |
| onOutputPageParserOutput ( $outputPage, $parserOutput) | |
| Used to transfer 'wikibase-view-chunks' and entity data from ParserOutput to OutputPage. | |
| onContentModelCanBeUsedOn ( $contentModel, $title, &$ok) | |
| Handler for the ContentModelCanBeUsedOn hook, used to prevent pages of inappropriate type to be placed in an entity namespace. | |
| onAPIQuerySiteInfoGeneralInfo ( $module, &$results) | |
| Exposes configuration values to the action=query&meta=siteinfo API, including lists of property and data value types, sparql endpoint, and several base URLs and URIs. | |
| onImportHandleRevisionXMLTag ( $reader, $pageInfo, $revisionInfo) | |
| Called by Import.php. | |
| onResourceLoaderRegisterModules ( $rl) | |
| onInfoAction ( $context, &$pageInfo) | |
| Adds the Wikis using the entity in action=info. | |
| onParserOptionsRegister (&$defaults, &$inCacheKey, &$lazyLoad) | |
| Handler for the ParserOptionsRegister hook to add a "wb" option for cache-splitting. | |
| onApiQuery__moduleManager ( $moduleManager) | |
| onApiMain__moduleManager ( $moduleManager) | |
| onParserFirstCallInit ( $parser) | |
| onApiMain__onException ( $apiMain, $e) | |
| Attempt to create an entity locks an entity id (for items, it would be Q####) and if saving fails due to validation issues for example, that id would be wasted. | |
| onWikibaseContentLanguages (&$contentLanguages) | |
| onMaintenanceShellStart () | |
| onVectorSearchResourceLoaderConfig (array &$vectorSearchConfig) | |
| Handler for the VectorSearchResourceLoaderConfig hook to overwrite search pattern highlighting for wikibase. | |
| onSkinPageReadyConfig (Context $context, array &$config) | |
| Public Member Functions inherited from Wikibase\Lib\Hooks\WikibaseContentLanguagesHook | |
| onWikibaseContentLanguages (array &$contentLanguages) | |
| This hook is called to define the content languages per context. | |
Static Public Member Functions | |
| static | onUserGetDefaultOptions (array &$defaultOptions) |
| Called after fetching the core default user options. | |
| static | onRegistration () |
| static | inheritDefaultRateLimits (array &$rateLimits) |
| Make the 'wikibase-idgenerator' rate limit inherit the 'create' rate limit, or the 'edit' rate limit if no 'create' limit is defined, unless the 'wikibase-idgenerator' rate limit was itself customized. | |
Static Private Member Functions | |
| static | defaultEntityNamespaces () |
| PhanUndeclaredConstant. | |
| static | ensureConstant (string $name, int $value) |
| Ensure that a constant is set to a certain (integer) value, defining it or checking its value if it was already defined. | |
| static | isNamespaceUsedByLocalEntities (int $namespace) |
| static | notifyEntityStoreWatcherOnUpdate (EntityContent $content, RevisionRecord $revision) |
File defining the hook handlers for the Wikibase extension.
|
staticprivate |
PhanUndeclaredConstant.
|
staticprivate |
Ensure that a constant is set to a certain (integer) value, defining it or checking its value if it was already defined.
|
static |
Make the 'wikibase-idgenerator' rate limit inherit the 'create' rate limit, or the 'edit' rate limit if no 'create' limit is defined, unless the 'wikibase-idgenerator' rate limit was itself customized.
| array | &$rateLimits | should be $wgRateLimits or a similar array |
|
staticprivate |
|
staticprivate |
| Wikibase\Repo\RepoHooks::onAbuseFilter_contentToString | ( | Content | $content, |
| ?string & | $text ) |
Hook handler for AbuseFilter's AbuseFilter-contentToString hook, implemented to provide a custom text representation of Entities for filtering.
Called when converting a Content object to a string to which filters can be applied. If the hook function returns true, Content::getTextForSearchIndex() will be used for non-text content.
| Content | $content | |
| ?string | &$text | Set this to the desired text |
| Wikibase\Repo\RepoHooks::onApiMain__moduleManager | ( | $moduleManager | ) |
| Wikibase\Repo\RepoHooks::onApiMain__onException | ( | $apiMain, | |
| $e ) |
Attempt to create an entity locks an entity id (for items, it would be Q####) and if saving fails due to validation issues for example, that id would be wasted.
We want to penalize the user by adding a bigger number to ratelimit and slow them down to avoid bots wasting significant number of Q-ids by sending faulty data over and over again. See T284538 for more information.
| Wikibase\Repo\RepoHooks::onApiQuery__moduleManager | ( | $moduleManager | ) |
| Wikibase\Repo\RepoHooks::onAPIQuerySiteInfoGeneralInfo | ( | $module, | |
| & | $results ) |
Exposes configuration values to the action=query&meta=siteinfo API, including lists of property and data value types, sparql endpoint, and several base URLs and URIs.
| Wikibase\Repo\RepoHooks::onBeforeDisplayNoArticleText | ( | $article | ) |
We implement this solely to replace the standard message that is shown when an entity does not exists.
| Wikibase\Repo\RepoHooks::onBeforePageDisplay | ( | $out, | |
| $skin ) |
Handler for the BeforePageDisplay hook, that conditionally adds the wikibase mobile styles and injects the wikibase.ui.entitysearch module replacing the native search box with the entity selector widget.
It additionally schedules a WikibasePingback
| OutputPage | $out | |
| Skin | $skin |
| Wikibase\Repo\RepoHooks::onContentModelCanBeUsedOn | ( | $contentModel, | |
| $title, | |||
| & | $ok ) |
Handler for the ContentModelCanBeUsedOn hook, used to prevent pages of inappropriate type to be placed in an entity namespace.
| Wikibase\Repo\RepoHooks::onFormatAutocomments | ( | & | $comment, |
| $pre, | |||
| $auto, | |||
| $post, | |||
| $title, | |||
| $local, | |||
| $wiki ) |
Handler for the FormatAutocomments hook, implementing localized formatting for machine readable autocomments generated by SummaryFormatter.
| Wikibase\Repo\RepoHooks::onGetPreferences | ( | $user, | |
| & | $preferences ) |
NOTE: Might make sense to put the inner functionality into a well structured Preferences file once this becomes more.
| Wikibase\Repo\RepoHooks::onImportHandleRevisionXMLTag | ( | $reader, | |
| $pageInfo, | |||
| $revisionInfo ) |
Called by Import.php.
Implemented to prevent the import of entities.
| Wikibase\Repo\RepoHooks::onInfoAction | ( | $context, | |
| & | $pageInfo ) |
Adds the Wikis using the entity in action=info.
| Wikibase\Repo\RepoHooks::onMaintenanceShellStart | ( | ) |
| Wikibase\Repo\RepoHooks::onMediaWikiServices | ( | $services | ) |
Handler for the MediaWikiServices hook, completing the content and namespace setup.
This updates the $wgContentHandlers and $wgNamespaceContentModels registries according to information provided by entity type definitions and the entityNamespaces setting for the local entity source. Note that we must not access any MediaWiki core services here (except for the hook container); see the warning in ().
| MediaWikiServices | $services |
| Wikibase\Repo\RepoHooks::onNamespaceIsMovable | ( | $ns, | |
| & | $movable ) |
| Wikibase\Repo\RepoHooks::onOutputPageBodyAttributes | ( | $out, | |
| $sk, | |||
| & | $bodyAttrs ) |
Used to append a css class to the body, so the page can be identified as Wikibase item page.
| Wikibase\Repo\RepoHooks::onOutputPageParserOutput | ( | $outputPage, | |
| $parserOutput ) |
Used to transfer 'wikibase-view-chunks' and entity data from ParserOutput to OutputPage.
| Wikibase\Repo\RepoHooks::onPageHistoryLineEnding | ( | $historyAction, | |
| & | $row, | ||
| & | $s, | ||
| & | $classes, | ||
| & | $attribs ) |
| Wikibase\Repo\RepoHooks::onParserFirstCallInit | ( | $parser | ) |
| Wikibase\Repo\RepoHooks::onParserOptionsRegister | ( | & | $defaults, |
| & | $inCacheKey, | ||
| & | $lazyLoad ) |
Handler for the ParserOptionsRegister hook to add a "wb" option for cache-splitting.
This registers a lazy-loaded parser option with its value being the EntityHandler parser version. Non-Wikibase parses will ignore this option, while Wikibase parses will trigger its loading via ParserOutput::recordOption() and thereby include it in the cache key to fragment the cache by EntityHandler::PARSER_VERSION.
|
static |
| Wikibase\Repo\RepoHooks::onResourceLoaderRegisterModules | ( | $rl | ) |
| Wikibase\Repo\RepoHooks::onRevisionFromEditComplete | ( | $wikiPage, | |
| $rev, | |||
| $originalRevId, | |||
| $user, | |||
| & | $tags ) |
| Wikibase\Repo\RepoHooks::onSkinPageReadyConfig | ( | Context | $context, |
| array & | $config ) |
| Wikibase\Repo\RepoHooks::onSkinTemplateNavigation__Universal | ( | $sktemplate, | |
| & | $links ) |
| Wikibase\Repo\RepoHooks::onTitleGetRestrictionTypes | ( | $title, | |
| & | $types ) |
Implemented to prevent people from protecting pages from being created or moved in an entity namespace (which is pointless).
| Wikibase\Repo\RepoHooks::onUnitTestsList | ( | & | $paths | ) |
|
static |
Called after fetching the core default user options.
| array | &$defaultOptions |
| Wikibase\Repo\RepoHooks::onVectorSearchResourceLoaderConfig | ( | array & | $vectorSearchConfig | ) |
Handler for the VectorSearchResourceLoaderConfig hook to overwrite search pattern highlighting for wikibase.
| array | &$vectorSearchConfig |
| Wikibase\Repo\RepoHooks::onWikibaseContentLanguages | ( | & | $contentLanguages | ) |