Merge "Pass $context to 'GetPreferences' hook"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 1 Nov 2018 04:00:23 +0000 (04:00 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 1 Nov 2018 04:00:23 +0000 (04:00 +0000)
1  2 
RELEASE-NOTES-1.33
docs/hooks.txt
includes/preferences/DefaultPreferencesFactory.php

diff --combined RELEASE-NOTES-1.33
@@@ -8,11 -8,7 +8,11 @@@ production
  === Configuration changes in 1.33 ===
  
  ==== New configuration ====
 -* …
 +* $wgEnablePartialBlocks – This enables the Partial Blocks feature, which gives
 +  accounts with block permissions the ability to block users, IPs, and IP ranges
 +  from editing specific pages, while allowing them to edit the rest of the wiki.
 +* $wgMediaInTargetLanguage – whether multilingual images should be dispalyed in
 +  the current parse language where available.
  
  ==== Changed configuration ====
  * …
@@@ -21,6 -17,7 +21,7 @@@
  * …
  
  === New features in 1.33 ===
+ * The 'GetPreferences' hook now receives an additional $context parameter.
  * …
  
  === External library changes in 1.33 ===
  * …
  
  === Action API internal changes in 1.33 ===
 +* A number of deprecated methods for API documentation, intended for overriding
 +  by extensions, are no longer called by MediaWiki, and will emit deprecation
 +  notices if your extension attempts to use them:
 +  * ApiBase::getDescription() (deprecated in 1.25)
 +  * ApiBase::getParamDescription() (deprecated in 1.25)
 +  * ApiBase::getExamples() (deprecated in 1.25)
 +  * ApiBase::getDescriptionMessage() (deprecated in 1.30)
 +  Additionally, the  'APIGetDescription' and 'APIGetParamDescription' hooks have
 +  been removed, as their only use was to let extensions override values returned
 +  by getDescription() and getParamDescription(), respectively.
  * …
  
  === Languages updated in 1.33 ===
@@@ -77,30 -64,6 +78,30 @@@ because of Phabricator reports
  * The "Parsoid v1" compatibility mappings in ParsoidVirtualRESTService and
    RestbaseVirtualRESTService, deprecated since 1.26, have been removed.
    Use the RESTBase v1 or Parsoid v3 API instead.
 +* ParserOptions defaults 'tidy' to true now, since the untidy modes of the
 +  parser are being deprecated and ParserOptions::getCanonicalOverrides()
 +  has always been true at any rate.
 +* A number of deprecated methods for API documentation, intended for overriding
 +  by extensions, are no longer called by MediaWiki, and will emit deprecation
 +  notices if your extension attempts to use them:
 +  * ApiBase::getDescription() (deprecated in 1.25)
 +  * ApiBase::getParamDescription() (deprecated in 1.25)
 +  * ApiBase::getExamples() (deprecated in 1.25)
 +  * ApiBase::getDescriptionMessage() (deprecated in 1.30)
 +  Additionally, the  'APIGetDescription' and 'APIGetParamDescription' hooks have
 +  been removed, as their only use was to let extensions override values returned
 +  by getDescription() and getParamDescription(), respectively.
 +* The authentication hooks 'AbortAutoAccount' 'AbortNewAccount', 'AbortLogin',
 +  'LoginUserMigrated', 'UserCreateForm', and 'UserLoginForm', all deprecated by
 +  the creation of AuthManager in 1.27, have been removed. This also means that
 +  the FakeAuthTemplate and LoginForm classes are removed, that FakeAuthTemplate
 +  is no longer passed into LoginSignupSpecialPage->getFieldDefinitions(), and
 +  that LoginSignupSpecialPage->getBCFieldDefinitions() is removed.
 +* The 'jquery.localize' module, deprecated in 1.32, has been removed. Instead,
 +  use 'jquery.i18n'.
 +* The hooks LanguageGetSpecialPageAliases and LanguageGetMagic, deprecated since
 +  1.16, have now been removed. Instead, use $specialPageAliases or $magicWords
 +  respectively in a $wgExtensionMessagesFiles file.
  * …
  
  === Deprecations in 1.33 ===
    applied for Arabic and Malayalam in the future.  Please enable these on
    your local wiki (if you have them explicitly set to false) and run
    maintenance/cleanupTitles.php to fix any existing page titles.
 +* OutputPage::parse() and OutputPage::parseInline() have been deprecated
 +  due to untidy output and inconsistent handling of wrapper divs and
 +  interface/content language defaults.  Use OutputPage::parseAsContent(),
 +  OutputPage::parseAsInterface(), or OutputPage::parseInlineAsInterface()
 +  as appropriate.
  * The LegacyHookPreAuthenticationProvider class, deprecated since its creation
    in 1.27 as part of the AuthManager re-write, now emits deprecation warnings.
    This will help identify the issue if you added it to $wgAuthManagerConfig.
 +* wfSplitWikiId() is now deprecated. Cache key generation should have the wiki
 +  domain ID as a key component and use makeGlobalKey().
  * …
  
  === Other changes in 1.33 ===
diff --combined docs/hooks.txt
@@@ -240,6 -240,13 +240,6 @@@ MediaWiki 1.4rc1
  This is a list of known events and parameters; please add to it if you're going
  to add events to the MediaWiki code.
  
 -'AbortAutoAccount': DEPRECATED since 1.27! Create a PreAuthenticationProvider
 -instead. Return false to cancel automated local account creation, where normally
 -authentication against an external auth plugin would be creating a local
 -account.
 -$user: the User object about to be created (read-only, incomplete)
 -&$abortMsg: out parameter: name of error message to be displayed to user
 -
  'AbortAutoblock': Return false to cancel an autoblock.
  $autoblockip: The IP going to be autoblocked.
  &$block: The block from which the autoblock is coming.
@@@ -252,6 -259,25 +252,6 @@@ $editor: The User who made the change
  $title: The Title of the page that was edited.
  $rc: The current RecentChange object.
  
 -'AbortLogin': DEPRECATED since 1.27! Create a PreAuthenticationProvider instead.
 -Return false to cancel account login.
 -$user: the User object being authenticated against
 -$password: the password being submitted, not yet checked for validity
 -&$retval: a LoginForm class constant to return from authenticateUserData();
 -  default is LoginForm::ABORTED. Note that the client may be using a machine
 -  API rather than the HTML user interface.
 -&$msg: the message identifier for abort reason (new in 1.18, not available
 -  before 1.18)
 -
 -'AbortNewAccount': DEPRECATED since 1.27! Create a PreAuthenticationProvider
 -instead. Return false to cancel explicit account creation.
 -$user: the User object about to be created (read-only, incomplete)
 -&$msg: out parameter: HTML to display on abort
 -&$status: out parameter: Status object to return, replaces the older $msg param
 -  (added in 1.23)
 -  Create the object with Status::newFatal() to ensure proper API error
 -  messages are returned when creating account through API clients.
 -
  'AbortTalkPageEmailNotification': Return false to cancel talk page email
  notification
  $targetUser: the user whom to send talk page email notification
@@@ -389,10 -415,21 +389,10 @@@ $format: API format code for $text
  &$params: Array of parameters
  $flags: int zero or OR-ed flags like ApiBase::GET_VALUES_FOR_HELP
  
 -'APIGetDescription': DEPRECATED since 1.25! Use APIGetDescriptionMessages
 -instead. Use this hook to modify a module's description.
 -&$module: ApiBase Module object
 -&$desc: String description, or array of description strings
 -
  'APIGetDescriptionMessages': Use this hook to modify a module's help message.
  $module: ApiBase Module object
  &$msg: Array of Message objects
  
 -'APIGetParamDescription': DEPRECATED since 1.25! Use
 -APIGetParamDescriptionMessages instead.
 -Use this hook to modify a module's parameter descriptions.
 -&$module: ApiBase Module object
 -&$desc: Array of parameter descriptions
 -
  'APIGetParamDescriptionMessages': Use this hook to modify a module's parameter
  descriptions.
  $module: ApiBase Module object
@@@ -1735,6 -1772,7 +1735,7 @@@ $out: OutputPage object (to check what 
  'GetPreferences': Modify user preferences.
  $user: User whose preferences are being modified.
  &$preferences: Preferences description array, to be fed to an HTMLForm object
+ $context: IContextSource object (added in 1.33)
  
  'GetRelativeTimestamp': Pre-emptively override the relative timestamp generated
  by MWTimestamp::getRelativeTimestamp(). Return false in this hook to use the
@@@ -1962,11 -2000,23 +1963,11 @@@ $user: User the password is being valid
  $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 since 1.16! 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
@@@ -2186,6 -2236,15 +2187,6 @@@ in LoginForm::$validErrorMessages)
  &$messages: Already added messages (inclusive messages from
    LoginForm::$validErrorMessages)
  
 -'LoginUserMigrated': DEPRECATED since 1.27! Create a PreAuthenticationProvider
 -instead. Called during login to allow extensions the opportunity to inform a
 -user that their username doesn't exist for a specific reason, instead of letting
 -the login form give the generic error message that the account does not exist.
 -For example, when the account has been renamed or deleted.
 -$user: the User object being authenticated against.
 -&$msg: the message identifier for abort reason, or an array to pass a message
 -  key and parameters.
 -
  'LogLine': Processes a single log entry on Special:Log.
  $log_type: string for the type of log entry (e.g. 'move'). Corresponds to
    logging.log_type database field.
@@@ -2818,9 -2877,7 +2819,9 @@@ $context: ResourceLoaderContext|nul
  ResourceLoaderStartUpModule::getConfigSettings(). Use this to export static
  configuration variables to JavaScript. Things that depend on the current page
  or request state must be added through MakeGlobalVariablesScript instead.
 +Skin is made available for skin specific config.
  &$vars: [ variable name => value ]
 +$skin: Skin
  
  'ResourceLoaderJqueryMsgModuleMagicWords': Called in
  ResourceLoaderJqueryMsgModule to allow adding magic words for jQueryMsg.
@@@ -3635,6 -3692,10 +3636,6 @@@ messages!" message, return false to no
  &$user: User (object) that will clear the message
  $oldid: ID of the talk page revision being viewed (0 means the most recent one)
  
 -'UserCreateForm': DEPRECATED since 1.27! Create an AuthenticationProvider
 -instead. Manipulate the login form.
 -&$template: SimpleTemplate instance for the form
 -
  'UserEffectiveGroups': Called in User::getEffectiveGroups().
  &$user: User to get groups for
  &$groups: Current effective groups
@@@ -3753,6 -3814,10 +3754,6 @@@ $direct: (bool) The hook is called dire
    only happen once per login. A UserLoginComplete call with direct=false can
    happen when the user visits the login page while already logged in.
  
 -'UserLoginForm': DEPRECATED since 1.27! Create an AuthenticationProvider
 -instead. Manipulate the login form.
 -&$template: QuickTemplate instance for the form
 -
  'UserLogout': Before a user logs out.
  &$user: the user object that is about to be logged out
  
@@@ -127,7 -127,7 +127,7 @@@ class DefaultPreferencesFactory impleme
                $this->watchlistPreferences( $user, $context, $preferences );
                $this->searchPreferences( $preferences );
  
-               Hooks::run( 'GetPreferences', [ $user, &$preferences ] );
+               Hooks::run( 'GetPreferences', [ $user, &$preferences, $context ] );
  
                $this->loadPreferenceValues( $user, $context, $preferences );
                $this->logger->debug( "Created form descriptor for user '{$user->getName()}'" );
                                continue;
                        }
  
 -                      if ( isset( $userGroupMemberships[$ueg] ) ) {
 -                              $groupStringOrObject = $userGroupMemberships[$ueg];
 -                      } else {
 -                              $groupStringOrObject = $ueg;
 -                      }
 +                      $groupStringOrObject = $userGroupMemberships[$ueg] ?? $ueg;
  
                        $userG = UserGroupMembership::getLink( $groupStringOrObject, $context, 'html' );
                        $userM = UserGroupMembership::getLink( $groupStringOrObject, $context, 'html',
                        $user,
                        ParserOptions::newFromContext( $context )
                );
 -              $oldsigHTML = $context->getOutput()->parseInline( $oldsigWikiText, true, true );
 +              $oldsigHTML = Parser::stripOuterParagraph(
 +                      $context->getOutput()->parseAsContent( $oldsigWikiText )
 +              );
                $defaultPreferences['oldsig'] = [
                        'type' => 'info',
                        'raw' => true,