* Reintroduce $wgAvailableRights so that the above function is not so terribly slow and broken
*/
$wgAddGroups = $wgRemoveGroups = array();
+
+/**
+ * A list of available rights, in addition to the ones defined by the core.
+ * For extensions only.
+ */
+$wgAvailableRights = array();
+
/**
* Optional to restrict deletion of pages with higher revision counts
* to users with the 'bigdelete' permission. (Default given to sysops.)
define( 'MW_MATH_MATHML', 5 );
/**#@-*/
-/**
- * User rights list
- * @deprecated
- */
-$wgAvailableRights = array(
- 'block',
- 'bot',
- 'createaccount',
- 'delete',
- 'edit',
- 'editinterface',
- 'import',
- 'importupload',
- 'move',
- 'patrol',
- 'protect',
- 'read',
- 'rollback',
- 'siteadmin',
- 'unwatchedpages',
- 'upload',
- 'userrights',
-);
-
/**#@+
* Cache type
*/
return md5( mt_rand( 0, 0x7fffffff ) . $salt );
}
-
-/**
- * Generate a list of all available rights.
- * @todo Doesn't list any rights which aren't assigned to a group.
- */
-function wfGetAvailableRights() {
- global $wgGroupPermissions;
-
- $rights = array();
-
- foreach( $wgGroupPermissions as $permissions ) {
- $rights = array_merge( array_keys($permissions),$rights );
- }
-
- $rights = array_unique($rights);
-
- wfRunHooks( 'GetAvailableRights', array( &$rights ) );
-
- return $rights;
-}
'mGroups',
);
+ /**
+ * Core rights
+ * Each of these should have a corresponding message of the form "right-$right"
+ */
+ static $mCoreRights = array(
+ 'apihighlimits',
+ 'autoconfirmed',
+ 'autopatrol',
+ 'bigdelete',
+ 'block',
+ 'blockemail',
+ 'bot',
+ 'browsearchive',
+ 'createaccount',
+ 'createpage',
+ 'createtalk',
+ 'delete',
+ 'deletedhistory',
+ 'edit',
+ 'editinterface',
+ 'editusercssjs',
+ 'import',
+ 'importupload',
+ 'ipblock-exempt',
+ 'markbotedits',
+ 'minoredit',
+ 'move',
+ 'nominornewtalk',
+ 'patrol',
+ 'protect',
+ 'proxyunbannable',
+ 'purge',
+ 'read',
+ 'reupload',
+ 'reupload-shared',
+ 'rollback',
+ 'suppressredirect',
+ 'trackback',
+ 'undelete',
+ 'unwatchedpages',
+ 'upload',
+ 'upload_by_url',
+ 'userrights',
+ );
+ static $mAllRights = false;
+
/**
* The cache variable declarations
*/
);
}
+ /**
+ * Get a list of all available permissions
+ */
+ static function getAllRights() {
+ if ( self::$mAllRights === false ) {
+ global $wgAvailableRights;
+ if ( count( $wgAvailableRights ) ) {
+ self::$mAllRights = array_unique( array_merge( self::$mCoreRights, $wgAvailableRights ) );
+ } else {
+ self::$mAllRights = self::$mCoreRights;
+ }
+ wfRunHooks( 'UserGetAllRights', array( &self::$mAllRights ) );
+ }
+ return self::$mAllRights;
+ }
+
/**
* Get a list of implicit groups
*