MediaWiki  master
MediaWiki\HookContainer\DeprecatedHooks Class Reference

Public Member Functions

 __construct (array $deprecatedHooks=[])
 
 getDeprecationInfo (?string $hook=null)
 Gets deprecation info for a specific hook or all hooks if hook not specified. More...
 
 isHookDeprecated (string $hook)
 Checks whether hook is marked deprecated. More...
 
 markDeprecated (string $hook, string $version, ?string $component=null, bool $silent=false)
 For use by extensions, to add to list of deprecated hooks. More...
 

Private Attributes

array[] $deprecatedHooks
 List of deprecated hooks. More...
 

Detailed Description

Definition at line 27 of file DeprecatedHooks.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\HookContainer\DeprecatedHooks::__construct ( array  $deprecatedHooks = [])
Parameters
array[]$deprecatedHooksList of hooks to mark as deprecated. Value arrays for each hook contain:
  • deprecatedVersion: (string) Version in which the hook was deprecated, to pass to wfDeprecated().
  • component: (string, optional) $component to pass to wfDeprecated().
  • silent: (bool, optional) True to not raise any deprecation warning

Definition at line 75 of file DeprecatedHooks.php.

References MediaWiki\HookContainer\DeprecatedHooks\$deprecatedHooks, and MediaWiki\HookContainer\DeprecatedHooks\markDeprecated().

Member Function Documentation

◆ getDeprecationInfo()

MediaWiki\HookContainer\DeprecatedHooks::getDeprecationInfo ( ?string  $hook = null)

Gets deprecation info for a specific hook or all hooks if hook not specified.

Parameters
string | null$hook(optional) Hook name
Returns
array|null Value array from $this->deprecatedHooks for a specific hook or all hooks

Definition at line 132 of file DeprecatedHooks.php.

References MediaWiki\HookContainer\DeprecatedHooks\$deprecatedHooks.

◆ isHookDeprecated()

MediaWiki\HookContainer\DeprecatedHooks::isHookDeprecated ( string  $hook)

Checks whether hook is marked deprecated.

Parameters
string$hookHook name
Returns
bool

Definition at line 123 of file DeprecatedHooks.php.

◆ markDeprecated()

MediaWiki\HookContainer\DeprecatedHooks::markDeprecated ( string  $hook,
string  $version,
?string  $component = null,
bool  $silent = false 
)

For use by extensions, to add to list of deprecated hooks.

Core-defined hooks should instead be added to $this->$deprecatedHooks directly. However, the preferred method of marking a hook deprecated is by adding it to the DeprecatedHooks attribute in extension.json

Parameters
string$hook
string$versionVersion in which the hook was deprecated, to pass to wfDeprecated()
string | null$component(optional) component to pass to wfDeprecated().
bool$silentTrue to not raise any deprecation warning
Exceptions
InvalidArgumentExceptionHook has already been marked deprecated

Definition at line 98 of file DeprecatedHooks.php.

Referenced by MediaWiki\HookContainer\DeprecatedHooks\__construct().

Member Data Documentation

◆ $deprecatedHooks

array [] MediaWiki\HookContainer\DeprecatedHooks::$deprecatedHooks
private
Initial value:
= [
'AddNewAccount' => [ 'deprecatedVersion' => '1.27', 'silent' => true ],
'BaseTemplateAfterPortlet' => [ 'deprecatedVersion' => '1.35' ],
'BeforeParserFetchTemplateAndtitle' => [ 'deprecatedVersion' => '1.36' ],
'BeforeParserrenderImageGallery' => [ 'deprecatedVersion' => '1.35' ],
'BeforeResetNotificationTimestamp' => [ 'deprecatedVersion' => '1.37' ],
'EditPageBeforeEditToolbar' => [ 'deprecatedVersion' => '1.36' ],
'InternalParseBeforeSanitize' => [ 'deprecatedVersion' => '1.35' ],
'LocalFile::getHistory' => [ 'deprecatedVersion' => '1.37' ],
'MagicWordwgVariableIDs' => [ 'deprecatedVersion' => '1.35', 'silent' => true ],
'PageContentSave' => [ 'deprecatedVersion' => '1.35', 'silent' => true ],
'ParserGetVariableValueVarCache' => [ 'deprecatedVersion' => '1.35' ],
'ParserSectionCreate' => [ 'deprecatedVersion' => '1.35' ],
'ParserTestTables' => [ 'deprecatedVersion' => '1.36', 'silent' => true ],
'PrefixSearchBackend' => [ 'deprecatedVersion' => '1.27', 'silent' => true ],
'ProtectionForm::buildForm' => [ 'deprecatedVersion' => '1.36', 'silent' => true ],
'ResourceLoaderTestModules' => [ 'deprecatedVersion' => '1.33' ],
'RollbackComplete' => [ 'deprecatedVersion' => '1.36', 'silent' => true ],
'SkinGetPoweredBy' => [ 'deprecatedVersion' => '1.37' ],
'SpecialMuteSubmit' => [ 'deprecatedVersion' => '1.35', 'silent' => true ],
'UserLoadFromDatabase' => [ 'deprecatedVersion' => '1.37' ],
'UserLoadOptions' => [ 'deprecatedVersion' => '1.37' ],
'UserResetAllOptions' => [ 'deprecatedVersion' => '1.37' ],
'UserSaveOptions' => [ 'deprecatedVersion' => '1.37' ],
'UserSetCookies' => [ 'deprecatedVersion' => '1.27' ],
'WikiPageDeletionUpdates' => [ 'deprecatedVersion' => '1.32', 'silent' => true ],
'userCan' => [ 'deprecatedVersion' => '1.37' ],
'ArticleDelete' => [ 'deprecatedVersion' => '1.37', 'silent' => true ],
'ArticleDeleteComplete' => [ 'deprecatedVersion' => '1.37', 'silent' => true ],
]

List of deprecated hooks.

Value arrays for each hook contain:

  • deprecatedVersion: (string) Version in which the hook was deprecated, to pass to wfDeprecated().
  • component: (string, optional) $component to pass to wfDeprecated().
  • silent (bool, optional) If true, no deprecation warning will be raised

Definition at line 36 of file DeprecatedHooks.php.

Referenced by MediaWiki\HookContainer\DeprecatedHooks\__construct(), and MediaWiki\HookContainer\DeprecatedHooks\getDeprecationInfo().


The documentation for this class was generated from the following file:
true
return true
Definition: router.php:90