Merge "New 'UserResetAllOptions' hook from the wikiHow codebase."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 10 Jul 2014 21:51:41 +0000 (21:51 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 10 Jul 2014 21:51:41 +0000 (21:51 +0000)
docs/hooks.txt
includes/User.php

index ab23bc0..6e140ba 100644 (file)
@@ -2920,6 +2920,15 @@ to be switched to HTTPS.
 $user: User in question.
 &$https: Boolean whether $user should be switched to HTTPS.
 
+'UserResetAllOptions': Called in User::resetOptions() when user preferences
+have been requested to be reset. This hook can be used to exclude certain
+options from being reset even when the user has requested all prefs to be reset,
+because certain options might be stored in the user_properties database table
+despite not being visible and editable via Special:Preferences.
+$user: the User (object) whose preferences are being reset
+&$newOptions: array of new (site default) preferences
+$options: array of the user's old preferences
+$resetKinds: array containing the kinds of preferences to reset
 
 'UserRetrieveNewTalks': Called when retrieving "You have new messages!"
 message(s).
index 909a749..62e35e8 100644 (file)
@@ -2746,6 +2746,8 @@ class User implements IDBAccessObject {
                        }
                }
 
+               wfRunHooks( 'UserResetAllOptions', array( $this, &$newOptions, $this->mOptions, $resetKinds ) );
+
                $this->mOptions = $newOptions;
                $this->mOptionsLoaded = true;
        }