MediaWiki
1.30.2
|
Static Public Member Functions | |
static | clear ( $name) |
Clears hooks registered via Hooks::register(). More... | |
static | getHandlers ( $name) |
Returns an array of all the event functions attached to a hook This combines functions registered via Hooks::register and with $wgHooks. More... | |
static | isRegistered ( $name) |
Returns true if a hook has a function registered to it. More... | |
static | register ( $name, $callback) |
Attach an event handler to a given hook. More... | |
static | run ( $event, array $args=[], $deprecatedVersion=null) |
Call hook functions defined in Hooks::register and $wgHooks. More... | |
static | runWithoutAbort ( $event, array $args=[], $deprecatedVersion=null) |
Call hook functions defined in Hooks::register and $wgHooks. More... | |
Static Protected Attributes | |
static | $handlers = [] |
Array of events mapped to an array of callbacks to be run when that event is triggered. More... | |
Static Private Member Functions | |
static | callHook ( $event, $hook, array $args, $deprecatedVersion=null, &$fname=null) |
|
staticprivate |
string | $event | Event name |
array | callable | $hook | |
array | $args | Array of parameters passed to hook functions |
string | null | $deprecatedVersion | [optional] |
string | &$fname | [optional] Readable name of hook [returned] |
Definition at line 119 of file Hooks.php.
References $args, $fname, and wfDeprecated().
Referenced by run(), and runWithoutAbort().
|
static |
Clears hooks registered via Hooks::register().
Does not touch $wgHooks. This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined.
string | $name | The name of the hook to clear. |
MWException | If not in testing mode. |
Definition at line 66 of file Hooks.php.
References $name.
Referenced by TestSetup\applyInitialConfig(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\hookMailer(), and HooksTest\setUp().
|
static |
Returns an array of all the event functions attached to a hook This combines functions registered via Hooks::register and with $wgHooks.
string | $name | Name of the hook |
Definition at line 97 of file Hooks.php.
References $name, $wgHooks, and global.
Referenced by HooksTest\testNewStyleHookInteraction().
|
static |
Returns true if a hook has a function registered to it.
The function may have been registered either via Hooks::register or in $wgHooks.
string | $name | Name of hook |
Definition at line 83 of file Hooks.php.
References $name, $wgHooks, and global.
Referenced by MediaWiki\Linker\LinkRenderer\buildAElement(), ChangeTags\listSoftwareActivatedTags(), ChangeTags\listSoftwareDefinedTags(), MediaWiki\Linker\LinkRenderer\runLegacyBeginHook(), and HooksTest\testNewStyleHookInteraction().
|
static |
Attach an event handler to a given hook.
string | $name | Name of hook |
callable | $callback | Callback function to attach |
Definition at line 49 of file Hooks.php.
References $name.
Referenced by MediaWiki\Auth\AuthPluginPrimaryAuthenticationProvider\__construct(), TestSetup\applyInitialConfig(), BenchmarkParse\execute(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\hookMailer(), TitleBlacklistHooks\onRegistration(), SpamBlacklistHooks\registerExtension(), HooksTest\testFalseReturn(), HooksTest\testFatalError(), HooksTest\testNewStyleHookInteraction(), HooksTest\testNewStyleHooks(), HooksTest\testRunWithoutAbort(), HooksTest\testRunWithoutAbortWarning(), and HooksTest\testUncallableFunction().
|
static |
Call hook functions defined in Hooks::register and $wgHooks.
For the given hook event, fetch the array of hook events and process them. Determine the proper callback for each hook and then call the actual hook using the appropriate arguments. Finally, process the return value and return/throw accordingly.
For hook event that are not abortable through a handler's return value, use runWithoutAbort() instead.
string | $event | Event name |
array | $args | Array of parameters passed to hook functions |
string | null | $deprecatedVersion | [optional] Mark hook as deprecated with version number |
Exception | |
FatalError | |
MWException |
Definition at line 203 of file Hooks.php.
References $args, $retval, as, and callHook().
Referenced by ExtensionsTestSuite\__construct(), UploadForm\__construct(), DatabaseOracle\__construct(), RenameuserSQL\__construct(), LinksUpdate\__construct(), DatabaseUpdater\__construct(), ApiQuery\__construct(), ApiMain\__construct(), RedirectSpecialArticle\__construct(), EmailNotification\actuallyNotifyOnPageChange(), User\addAutopromoteOnceGroups(), OutputPage\addCategoryLinks(), ApiBase\addDeprecation(), User\addGroup(), OutputPage\addParserOutputMetadata(), OutputPage\addParserOutputText(), Skin\afterContentHook(), SpecialPageLanguage\alterForm(), SpecialChangeEmail\attemptChange(), EditPage\attemptSave(), SearchEngine\augmentSearchResults(), MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\beginAuthentication(), Skin\bottomScripts(), MediaWiki\Linker\LinkRenderer\buildAElement(), SkinTemplate\buildContentNavigationUrls(), ProtectionForm\buildForm(), SkinTemplate\buildNavUrls(), SkinTemplate\buildPersonalUrls(), SpecialEditWatchlist\buildRemoveLine(), Skin\buildSidebar(), ChangeTags\canAddTagsAccompanyingChange(), ContentHandler\canBeUsedOn(), ChangeTags\canCreateTag(), ChangeTags\canDeleteTag(), User\canSendEmail(), EmailNotification\canSendUserTalkEmail(), Autopromote\checkCondition(), ApiMain\checkConditionalRequestHeaders(), ApiMain\checkExecutePermissions(), OutputPage\checkLastModified(), User\checkPasswordValidity(), Title\checkPermissionHooks(), MovePage\checkPermissions(), Title\checkQuickPermissions(), Title\checkReadPermissions(), User\clearNotification(), ApiFormatBase\closePrinter(), WikiPage\commitRollback(), SearchEngine\completionSearchBackend(), Article\confirmDelete(), User\confirmEmail(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAuthentication(), AbstractContent\convert(), ContentHandler\createDifferenceEngine(), ChangeTags\deleteTagEverywhere(), EditPage\displayViewSourcePage(), Block\doAutoblock(), UsersPager\doBatchLookups(), HistoryPager\doBatchLookups(), CategoryViewer\doCategoryQuery(), WikiPage\doCreate(), FileDeleteForm\doDelete(), SpecialNuke\doDelete(), Article\doDelete(), WikiPage\doDeleteArticleReal(), WikiPage\doEditContent(), Skin\doEditSectionLink(), WikiPage\doEditUpdates(), WikiImporter\doImport(), Language\doMagicHook(), RecentChange\doMarkPatrolled(), WikiPage\doModify(), RevDelRevisionList\doPostCommitUpdates(), WikiPage\doPurge(), RefreshLinks\doRefreshLinks(), Block\doRetroactiveAutoblock(), UserrightsPage\doSaveUserGroups(), MovePageForm\doSubmit(), TransformationalImageHandler\doTransform(), WatchAction\doUnwatch(), LinksUpdate\doUpdate(), WikiPage\doUpdateRestrictions(), LinkHolderArray\doVariants(), WikiPage\doViewUpdates(), WatchAction\doWatch(), WikiExporter\dumpFrom(), EditPage\edit(), ApiValidatePassword\execute(), SpecialRenameuser\execute(), ApiUndelete\execute(), SpecialLog\execute(), ApiChangeAuthenticationData\execute(), ApiExpandTemplates\execute(), ApiEditPage\execute(), ApiLogout\execute(), SpecialContributions\execute(), SpecialStatistics\execute(), SpecialUserLogout\execute(), MonoBookTemplate\execute(), SpecialTrackingCategories\execute(), BenchmarkHooks\execute(), ApiParse\execute(), ApiRemoveAuthenticationData\execute(), SpecialImport\execute(), ApiLogin\execute(), ApiOpenSearch\execute(), SpecialSearch\execute(), SpecialEmailUser\execute(), PasswordReset\execute(), SpecialUpload\execute(), ApiQuery\execute(), ApiMain\executeAction(), ApiPageSet\executeInternal(), Title\exists(), ApiQueryWatchlist\extractOutputData(), ApiQueryInfo\extractPageInfo(), Collation\factory(), WikiPage\factory(), ApiFeedContributions\feedItem(), Article\fetchContentObject(), FormatMetadata\fetchExtendedMetadata(), AuthManagerSpecialPage\fieldInfoToFormDescriptor(), WikiImporter\finishImportPage(), Linker\formatAutocomments(), UsersPager\formatRow(), DeletedContribsPager\formatRow(), SpecialNewpages\formatRow(), ContribsPager\formatRow(), File\generateAndSaveThumb(), CategoryViewer\generateLink(), MediaWiki\Widget\Search\FullSearchResultWidget\generateMainLinkHtml(), ParserCache\get(), MessageCache\get(), LegacyLogFormatter\getActionLinks(), BaseTemplate\getAfterPortlet(), ApiImport\getAllowedImportSources(), User\getAllRights(), ChangesList\getArticleLink(), Autopromote\getAutopromoteGroups(), User\getBlockedStatus(), OutputPage\getCacheVaryCookies(), MWNamespace\getCanonicalNamespaces(), Title\getCanonicalURL(), Title\getCategorySortkey(), Title\getCdnUrls(), CheckLanguageCLI\getCheckBlacklist(), EditPage\getCheckboxes(), EditPage\getCheckboxesDefinition(), EditPage\getCheckboxesWidget(), BacklinkCache\getConditions(), ResourceLoaderStartUpModule\getConfigSettings(), ContentHandler\getContentModels(), Skin\getCopyright(), EditPage\getCopyrightWarning(), SpecialRecentChanges\getCustomFilters(), SpecialWatchlist\getCustomFilters(), ChangesListSpecialPage\getCustomFilters(), ContentHandler\getDataForSearchIndex(), ContentHandler\getDefaultModelFor(), User\getDefaultOptions(), UsersPager\getDefaultQuery(), ParserOptions\getDefaults(), WikiPage\getDeletionUpdates(), ResourceLoaderForeignApiModule\getDependencies(), DifferenceEngine\getDiffBody(), MagicWord\getDoubleUnderscoreArray(), EditPage\getEditButtons(), Title\getEditNotices(), EditPage\getEditToolbar(), User\getEffectiveGroups(), User\getEmail(), User\getEmailAuthenticationTimestamp(), FormatMetadata\getExtendedMetadataFromHook(), WatchedItemQueryService\getExtensions(), SpecialVersion\getExtensionTypes(), LogEventsList\getExtraInputs(), SpecialRecentChanges\getExtraOptions(), LoginSignupSpecialPage\getFakeTemplate(), ApiBase\getFinalDescription(), ApiBase\getFinalParamDescription(), ApiBase\getFinalParams(), FormAction\getForm(), FormSpecialPage\getForm(), SpecialContributions\getForm(), SpecialBlock\getFormFields(), ContentHandler\getForModelID(), Title\getFullURL(), User\getGlobalBlock(), OutputPage\getHeadLinksArray(), ApiHelp\getHelpInternal(), LocalFile\getHistory(), Language\getHumanTimestamp(), User\getImplicitGroups(), Title\getInternalURL(), OutputPage\getJSVars(), RequestContext\getLanguage(), SkinTemplate\getLanguages(), PreferencesForm\getLegend(), IRCColourfulRCFeedFormatter\getLine(), EnhancedChangesList\getLineData(), Title\getLocalURL(), EnhancedChangesList\getLogText(), SpecialLog\getLogTypesOnUser(), DifferenceEngine\getMarkPatrolledLinkInfo(), Language\getMessagesFileName(), MediaHandler\getMetadataVersion(), MessageCache\getMsgFromNamespace(), Language\getNamespaces(), SearchNearMatcher\getNearMatch(), SearchNearMatcher\getNearMatchInternal(), User\getNewMessageLinks(), SpecialNuke\getNewPages(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getNewPasswordExpiry(), Skin\getNewtalks(), SpecialEditWatchlist\getNormalForm(), UsersPager\getPageHeader(), ContentHandler\getPageLanguage(), SpecialPageFactory\getPageList(), QueryPage\getPages(), AbstractContent\getParserOutput(), WebRequest\getPathInfo(), SpecialEmailUser\getPermissionsError(), UserPasswordPolicy\getPoliciesForUser(), Skin\getPoweredBy(), Preferences\getPreferences(), BacklinkCache\getPrefix(), EditPage\getPreviewLimitReport(), EditPage\getPreviewText(), NewPagesPager\getQueryInfo(), ShortPagesPage\getQueryInfo(), WantedPagesPage\getQueryInfo(), LonelyPagesPage\getQueryInfo(), UsersPager\getQueryInfo(), RandomPage\getQueryInfo(), ContribsPager\getQueryInfo(), HistoryPager\getQueryInfo(), RandomPage\getRandomTitle(), MWTimestamp\getRelativeTimestamp(), Title\getRestrictionTypes(), User\getRights(), ApiRsd\getRsdApiList(), ResourceLoaderJqueryMsgModule\getScript(), SearchEngine\getSearchIndexFields(), SpecialSearch\getSearchProfiles(), AbstractContent\getSecondaryDataUpdates(), BaseTemplate\getSidebar(), Skin\getSiteNotice(), RequestContext\getSkin(), UploadForm\getSourceSection(), Language\getSpecialPageAliases(), ApiQueryRevisions\getTokenFunctions(), ApiQueryRecentChanges\getTokenFunctions(), ApiQueryUsers\getTokenFunctions(), ApiQueryInfo\getTokenFunctions(), SpecialResetTokens\getTokensList(), ApiTokens\getTokenTypes(), ApiQueryTokens\getTokenTypeSalts(), BaseTemplate\getToolbox(), LoginHelper\getValidErrorMessages(), MagicWord\getVariableIDs(), GitInfo\getViewers(), SpecialVersion\getwgVersionLinked(), SpecialSearch\goResult(), ApiMain\handleException(), WikiImporter\handleLogItem(), WikiImporter\handlePage(), WikiImporter\handleRevision(), EditPage\handleStatus(), WikiImporter\handleUpload(), OutputPage\headElement(), HistoryPager\historyLine(), ImageHistoryList\imageHistoryLine(), EditPage\importFormData(), LinksUpdate\incrTableUpdate(), ChangesList\initChangesListRows(), SearchResult\initFromTitle(), MediaWiki\initializeArticle(), MediaWiki\Auth\AuthManagerAuthPlugin\initUser(), Revision\insertOn(), EditPage\internalAttemptSave(), User\invalidateEmail(), UploadFromUrl\isAllowedUrl(), Title\isAlwaysKnown(), User\isBlockedFrom(), User\isBot(), User\isEmailConfirmed(), User\isEveryoneAllowed(), Article\isFileCacheable(), User\isHidden(), TransformationalImageHandler\isImageAreaOkForThumbnaling(), User\isLocked(), MWNamespace\isMovable(), Title\isMovable(), ProxyLookup\isTrustedProxy(), User\isUsableName(), MovePage\isValidMove(), ApiMain\lacksSameOriginSecurity(), SpecialWhatLinksHere\listItem(), ChangeTags\listSoftwareActivatedTags(), ChangeTags\listSoftwareDefinedTags(), MediaWiki\Interwiki\ClassicInterwikiLookup\load(), User\load(), User\loadDefaults(), ImagePage\loadFile(), User\loadFromDatabase(), User\loadFromSession(), ImageGalleryBase\loadModes(), DifferenceEngine\loadNewText(), User\loadOptions(), DifferenceEngine\loadRevisionIds(), MediaWiki\Session\SessionManager\loadSessionInfoFromStore(), DifferenceEngine\loadText(), MWExceptionHandler\logError(), MWExceptionHandler\logException(), LogEventsList\logLine(), User\logout(), MediaWiki\main(), Linker\makeExternalImage(), Linker\makeExternalLink(), Linker\makeImageLink(), Linker\makeMediaLinkFile(), ApiParse\makeParserOptions(), Linker\makeSelfLinkObj(), DifferenceEngine\markPatrolledLink(), MergeHistory\merge(), MovePage\move(), MovePage\moveToInternal(), ChangesList\newFromContext(), UserArray\newFromResult(), TitleArray\newFromResult(), Article\newFromTitle(), MediaWiki\MediaWikiServices\newInstance(), SearchEngine\normalizeNamespaces(), EditPage\noSuchSectionPage(), SpecialChangeCredentials\onAuthChangeFormFields(), SpecialChangeContentModel\onSubmit(), RawAction\onView(), InfoAction\onView(), HistoryAction\onView(), XmlDumpWriter\openPage(), ImagePage\openShowImage(), ParserOptions\optionsHash(), MediaWiki\Widget\Search\SearchFormWidget\optionsHtml(), OutputPage\output(), MediaWikiTestCase\overrideMwServices(), WikiPage\pageData(), ApiStashEdit\parseAndStash(), MediaWiki\performAction(), AuthManagerSpecialPage\performAuthenticationStep(), MediaWiki\performRequest(), MediaWiki\Session\CookieSessionProvider\persistSession(), User\pingLimiter(), MediaWiki\Widget\Search\SearchFormWidget\powerSearchBox(), Skin\preloadExistence(), WikiPage\prepareContentForEdit(), SkinTemplate\prepareQuickTemplate(), SpecialBlock\preText(), SpecialBlock\processForm(), ApiQueryBase\processRow(), SpecialUnblock\processUnblock(), SpecialUpload\processUpload(), RecentChangesUpdateJob\purgeExpiredRows(), LocalFile\purgeOldThumbnails(), LocalFile\purgeThumbnails(), DeletedContribsPager\reallyDoQuery(), ContribsPager\reallyDoQuery(), LocalisationCache\recache(), EnhancedChangesList\recentChangesBlockLine(), OldChangesList\recentChangesLine(), LocalFile\recordUpload2(), SpecialWatchlist\registerFilters(), ChangesListSpecialPage\registerFilters(), User\removeGroup(), RenameuserSQL\rename(), MediaWiki\Widget\Search\FullSearchResultWidget\render(), CologneBlueTemplate\renderAfterPortlet(), DifferenceEngine\renderNewRevision(), MessageCache\replace(), LinkHolderArray\replaceInternal(), WikitextContent\replaceSection(), ImportReporter\reportPage(), User\requiresHTTPS(), User\resetOptions(), ApiQueryWatchlist\run(), SpecialPage\run(), MediaWiki\Linker\LinkRenderer\runBeginHook(), MediaWiki\Linker\LinkRenderer\runLegacyBeginHook(), SpecialRecentChanges\runMainQueryHook(), SpecialWatchlist\runMainQueryHook(), ChangesListSpecialPage\runMainQueryHook(), EditPage\runPostMergeFilters(), ProtectionForm\save(), RecentChange\save(), ParserCache\save(), MediaWiki\Session\SessionBackend\save(), User\saveOptions(), User\saveSettings(), PrefixSearch\search(), SearchEngineConfig\searchableNamespaces(), PrefixSearch\searchBackend(), MediaWiki\Auth\AuthManager\securitySensitiveOperationStatus(), ApiQueryBase\select(), UserMailer\send(), UserMailer\sendInternal(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\sendNewAccountEmail(), WebResponse\setCookie(), User\setEmail(), User\setEmailAuthenticationTimestamp(), Article\setOldSubtitle(), MediaWiki\Auth\AuthManager\setSessionDataForUser(), SpecialNewpages\setup(), SkinVector\setupSkinUserCss(), MediaWikiTestCase\setupTestDB(), EditAction\show(), EditPage\showConflict(), SpecialSearch\showCreateLink(), DifferenceEngine\showDiff(), EditPage\showDiff(), DifferenceEngine\showDiffPage(), EditPage\showEditForm(), SpecialUndelete\showHistory(), SpecialAutoblockList\showList(), SpecialBookSources\showList(), SpecialBlockList\showList(), LogEventsList\showLogExtract(), ProtectionForm\showLogExtract(), Article\showMissingArticle(), EditPage\showPreview(), Article\showRedirectedFromHeader(), SpecialSearch\showResults(), LoginHelper\showReturnToPage(), SpecialUndelete\showRevision(), EditPage\showStandardInputs(), ImagePage\showTOC(), EditPage\showTosSummary(), Article\showViewFooter(), SpecialVersion\softwareInformation(), SpecialEmailUser\submit(), Skin\subPageSubtitle(), SpecialCreateAccount\successfulAction(), SpecialUserLogin\successfulAction(), SkinTemplate\tabAction(), MediaWikiTestCase\teardownTestDB(), HooksTest\testFalseReturn(), HooksTest\testFatalError(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\ThrottlePreAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\testForAuthentication(), HooksTest\testNewStyleHookInteraction(), HooksTest\testNewStyleHooks(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testOnLocalUserCreated(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testOnUserGroupsChanged(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testOnUserLoggedIn(), MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testOnUserSaveSettings(), HooksTest\testUncallableFunction(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\testUserForCreation(), TraditionalImageGallery\toHTML(), ThumbnailImage\toHtml(), MonoBookTemplate\toolbox(), WikiPage\triggerOpportunisticLinksUpdate(), Preferences\tryFormSubmit(), MediaWiki\tryNormaliseRedirect(), AuthManagerSpecialPage\trySubmit(), PageArchive\undelete(), SpecialUndelete\undelete(), PageArchive\undeleteRevisions(), SpecialEditWatchlist\unwatchTitles(), WikiPage\updateCategoryCounts(), MediaWiki\Auth\AuthManagerAuthPlugin\updateExternalDBGroups(), ChangeTags\updateTags(), MediaWiki\Auth\AuthManagerAuthPlugin\updateUser(), HTMLFileCache\useFileCache(), Linker\userToolLinks(), CategoryPage\view(), ImagePage\view(), Article\view(), and XmlDumpWriter\writeRevision().
|
static |
Call hook functions defined in Hooks::register and $wgHooks.
string | $event | Event name |
array | $args | Array of parameters passed to hook functions |
string | null | $deprecatedVersion | [optional] Mark hook as deprecated with version number |
MWException | If a callback is invalid, unknown |
UnexpectedValueException | If a callback returns an abort value. |
Definition at line 234 of file Hooks.php.
References $args, $fname, $retval, as, and callHook().
Referenced by HooksTest\testRunWithoutAbort(), and HooksTest\testRunWithoutAbortWarning().
|
staticprotected |