'editmyuserjs',
'editmywatchlist',
'editsemiprotected',
+ 'editsitecss',
+ 'editsitejson',
+ 'editsitejs',
'editusercss',
'edituserjson',
'edituserjs',
* will be loaded once more from the database when accessing them.
*
* @param stdClass $row A row from the user table
- * @param array $data Further data to load into the object (see User::loadFromRow for valid keys)
+ * @param array|null $data Further data to load into the object
+ * (see User::loadFromRow for valid keys)
* @return User
*/
public static function newFromRow( $row, $data = null ) {
* @param string|array $groups A single group name or an array of group names
* @param int $limit Max number of users to return. The actual limit will never exceed 5000
* records; larger values are ignored.
- * @param int $after ID the user to start after
+ * @param int|null $after ID the user to start after
* @return UserArrayFromResult
*/
public static function findUsersByGroup( $groups, $limit = 5000, $after = null ) {
* Initialize this object from a row from the user table.
*
* @param stdClass $row Row from the user table to load.
- * @param array $data Further user data to load into the object
+ * @param array|null $data Further user data to load into the object
*
* user_groups Array of arrays or stdClass result rows out of the user_groups
* table. Previously you were supposed to pass an array of strings
/**
* Update the 'You have new messages!' status.
* @param bool $val Whether the user has new messages
- * @param Revision $curRev New, as yet unseen revision of the user talk
+ * @param Revision|null $curRev New, as yet unseen revision of the user talk
* page. Ignored if null or !$val.
*/
public function setNewtalk( $val, $curRev = null ) {
* Get the user's current setting for a given option.
*
* @param string $oname The option to check
- * @param string|array $defaultOverride A default value returned if the option does not exist
+ * @param string|array|null $defaultOverride A default value returned if the option does not exist
* @param bool $ignoreHidden Whether to ignore the effects of $wgHiddenPrefs
* @return string|array|int|null User's current value for the option
* @see getBoolOption()
*
* @see User::listOptionKinds
* @param IContextSource $context
- * @param array $options Assoc. array with options keys to check as keys.
+ * @param array|null $options Assoc. array with options keys to check as keys.
* Defaults to $this->mOptions.
* @return array The key => kind mapping data
*/
* never expire.)
*
* @param string $group Name of the group to add
- * @param string $expiry Optional expiry timestamp in any format acceptable to
+ * @param string|null $expiry Optional expiry timestamp in any format acceptable to
* wfTimestamp(), or null if the group assignment should not expire
* @return bool
*/
*
* @param WebRequest|null $request WebRequest object to use; $wgRequest will be used if null
* is passed.
- * @param bool $secure Whether to force secure/insecure cookies or use default
+ * @param bool|null $secure Whether to force secure/insecure cookies or use default
* @param bool $rememberMe Whether to add a Token cookie for elongated sessions
*/
public function setCookies( $request = null, $secure = null, $rememberMe = false ) {
* @param string $val Input value to compare
* @param string|array $salt Optional function-specific data for hashing
* @param WebRequest|null $request Object to use or null to use $wgRequest
- * @param int $maxage Fail tokens older than this, in seconds
+ * @param int|null $maxage Fail tokens older than this, in seconds
* @return bool Whether the token matches
*/
public function matchEditToken( $val, $salt = '', $request = null, $maxage = null ) {
* @param string $val Input value to compare
* @param string|array $salt Optional function-specific data for hashing
* @param WebRequest|null $request Object to use or null to use $wgRequest
- * @param int $maxage Fail tokens older than this, in seconds
+ * @param int|null $maxage Fail tokens older than this, in seconds
* @return bool Whether the token matches
*/
public function matchEditTokenNoSuffix( $val, $salt = '', $request = null, $maxage = null ) {
* @param string $body Message body
* @param User|null $from Optional sending user; if unspecified, default
* $wgPasswordSender will be used.
- * @param string $replyto Reply-To address
+ * @param string|null $replyto Reply-To address
* @return Status
*/
public function sendMail( $subject, $body, $from = null, $replyto = null ) {
*/
public static function getAllGroups() {
global $wgGroupPermissions, $wgRevokePermissions;
- return array_diff(
+ return array_values( array_diff(
array_merge( array_keys( $wgGroupPermissions ), array_keys( $wgRevokePermissions ) ),
self::getImplicitGroups()
- );
+ ) );
}
/**
/**
* Load the user options either from cache, the database or an array
*
- * @param array $data Rows for the current user out of the user_properties table
+ * @param array|null $data Rows for the current user out of the user_properties table
*/
protected function loadOptions( $data = null ) {
global $wgContLang;
}
}
- // Convert the email blacklist from a new line delimited string
- // to an array of ids.
- if ( isset( $data['email-blacklist'] ) && $data['email-blacklist'] ) {
- $data['email-blacklist'] = array_map( 'intval', explode( "\n", $data['email-blacklist'] ) );
- }
-
foreach ( $data as $property => $value ) {
$this->mOptionOverrides[$property] = $value;
$this->mOptions[$property] = $value;
// Not using getOptions(), to keep hidden preferences in database
$saveOptions = $this->mOptions;
- // Convert usernames to ids.
- if ( isset( $this->mOptions['email-blacklist'] ) ) {
- if ( $this->mOptions['email-blacklist'] ) {
- $value = $this->mOptions['email-blacklist'];
- // Email Blacklist may be an array of ids or a string of new line
- // delimnated user names.
- if ( is_array( $value ) ) {
- $ids = array_filter( $value, 'is_numeric' );
- } else {
- $lookup = CentralIdLookup::factory();
- $ids = $lookup->centralIdsFromNames( explode( "\n", $value ), $this );
- }
- $this->mOptions['email-blacklist'] = $ids;
- $saveOptions['email-blacklist'] = implode( "\n", $this->mOptions['email-blacklist'] );
- } else {
- // If the blacklist is empty, set it to null rather than an empty string.
- $this->mOptions['email-blacklist'] = null;
- }
- }
-
// Allow hooks to abort, for instance to save to a global profile.
// Reset options to default state before saving.
if ( !Hooks::run( 'UserSaveOptions', [ $this, &$saveOptions ] ) ) {