*/
const MAX_WATCHED_ITEMS_CACHE = 100;
+ /**
+ * Exclude user options that are set to their default value.
+ * @since 1.25
+ */
+ const GETOPTIONS_EXCLUDE_DEFAULTS = 1;
+
/**
* @var PasswordFactory Lazily loaded factory object for passwords
*/
'deletelogentry',
'deleterevision',
'edit',
+ 'editcontentmodel',
'editinterface',
'editprotected',
'editmyoptions',
* @return int|null The corresponding user's ID, or null if user is nonexistent
*/
public static function idFromName( $name ) {
- // We don't want to call Title::makeTitleSafe yet, since that call path
- // ends up needing the user language, which ends up trying to load the
- // user object, which ends up back here (bug 54193).
- $nt = Title::makeTitle( NS_USER, $name );
+ $nt = Title::makeTitleSafe( NS_USER, $name );
+ if ( is_null( $nt ) ) {
+ // Illegal name
+ return null;
+ }
+
if ( isset( self::$idCacheByName[$name] ) ) {
return self::$idCacheByName[$name];
}
/**
* Get all user's options
*
+ * @param int $flags Bitwise combination of:
+ * User::GETOPTIONS_EXCLUDE_DEFAULTS Exclude user options that are set
+ * to the default value. (Since 1.25)
* @return array
*/
- public function getOptions() {
+ public function getOptions( $flags = 0 ) {
global $wgHiddenPrefs;
$this->loadOptions();
$options = $this->mOptions;
}
}
+ if ( $flags & self::GETOPTIONS_EXCLUDE_DEFAULTS ) {
+ $options = array_diff_assoc( $options, self::getDefaultOptions() );
+ }
+
return $options;
}
global $wgImplicitGroups;
$groups = $wgImplicitGroups;
- # Deprecated, use $wgImplictGroups instead
- wfRunHooks( 'UserGetImplicitGroups', array( &$groups ) );
+ # Deprecated, use $wgImplicitGroups instead
+ wfRunHooks( 'UserGetImplicitGroups', array( &$groups ), '1.25' );
return $groups;
}
}
$title = self::getGroupPage( $group );
if ( $title ) {
- $page = $title->getPrefixedText();
+ $page = $title->getFullText();
return "[[$page|$text]]";
} else {
return $text;